I'm trying to post a message to a Slack channel. Slack provides an example of a cURL command, but running this verbatim doesn't work.
The command provided is:
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
I've installed the latest cURL on my machine (running windows 8.1), and when running the script above I get:
curl: (6) Could not resolve host: #deployment,
curl: (6) Could not resolve host: username
curl: (6) Could not resolve host: webhookbot,
etc.
I've thought it might be something about how windows console is dealing with the single and double quotes, but I've been unable to get it to work.
I've found that if I replace the json string with a file, payload@filename.txt then it works, but I really need for the json to be dynamic.
Can anyone suggest what is wrong here?