Jerrod Horton
Jerrod Horton

Reputation: 1692

How do I post a snippet to slack channel

I am trying to post log info to slack and some of these logs can get pretty big. Is there a way to send it as a snippet so that slack doesn't chunk the text into multiple messages?

Upvotes: 20

Views: 24210

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32697

You can post a snippet to a Slack channel using the API method files.upload.

In order for this to work you need to:

  • Use the content (not the file) parameter to upload the content of your file.
  • Provide the name of the channel in the channels parameter where the snippet should be posted.
  • The filetype is optional. Slack will determine the type of your file based on the filename or "magic bytes" of the file. e.g. using text as filetype will work.

Upvotes: 18

Related Questions