Sending JSON to Slack in a HTTP POST request

I’m a bit late, but I hope this can help other people who stumble into this issue like me. I’ve just been in touch with Slack, and this is what they told me:

The Slack Web API doesn’t accept JSON data at all — so along with changing the Content-Type those variables should be posted using standard HTTP form attributes.

We plan to support JSON data in the future for consistency in the future.

So, your cURL line should look like:

curl -X POST -d 'token=my-token-here&channel=#channel-name-or-id&text=Text here.&username=otherusername'`

I hope this helps! 🙂

Leave a Comment