【发布时间】:2017-06-29 19:50:45
【问题描述】:
我正在尝试使用传入的 webhook 向松弛通道发送通知,下面是我的 bash 脚本
# !/bin/sh
curl -X POST --data-urlencode 'payload={"channel": "#aws_webhooks", "username": "webhookbot",
"attachments":[
{
"fallback":"blahb",
"pretext":"blahblahblahblahbla",
"color":"warning",
"fields":[
{
"title":"Alarms Updates",
"value":" blahblahblahblahblahblah",
"short":false
}
]
}
]
}'
https://hooks.slack.com/services/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
运行此脚本后我遇到此错误,有人可以帮助我解决我在编写脚本时做错了什么
sh new.sh
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
【问题讨论】:
-
您需要在有效载荷的末尾和
https之前使用反斜杠。另外,删除第一行中#之后的空格(尽管这不是您的问题的原因)。 -
还是不行