Search code examples
slackslack-api

Slack webhook: send stringified json that can be directly downloaded when in slack?


What I want to do is make an ajax call to a slack webhook with a stringified json attachment that can be downloaded from the message (without having to putz around and select all of the json text in the message).

So, when the message is in slack, I want the "Download" button will appear as it does after you uploaded a file or it created a snippet.

Is this even possible?

I can send a message with text=the json, but you then have to select the json text in the window, which is a pain.


Solution

  • It's not currently possible to upload files through Slack Webhooks.

    You should look at the Slack API's files.upload method to upload a downloadable file or snippet to a channel.