You can publish the snippet to the Slack channel using the files.upload API method .
For this you need:
- Use the
content(not file) option to load the contents of your file - Indicate the name of the channel in the parameter
channelswhere the fragment should be published.
. Slack " " .