我正在尝试向 Slack 频道发布消息。Slack 提供了一个 cURL 命令的示例,但是逐字运行此命令不起作用。
提供的命令是:
curl -X POST --data-urlencode 'payload={"channel": "#deployment", "username": "webhookbot", "text": "This is posted to #deployment and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/SomeCode/OtherCode/3rdCode
我已经在我的机器上安装了最新的 cURL(运行 windows 8.1),当运行上面的脚本时,我得到:
curl: (6) Could not resolve host: #deployment,
curl: (6) Could not resolve host: username
curl: (6) Could not resolve host: webhookbot,
等等
我认为这可能与 Windows 控制台如何处理单引号和双引号有关,但我一直无法让它工作。
我发现如果我用文件替换 json 字符串,payload@filename.txt 那么它可以工作,但我真的需要 json 是动态的。
谁能建议这里有什么问题?