Skip to content

Instantly share code, notes, and snippets.

@xaman
Created December 19, 2017 11:26
Show Gist options
  • Save xaman/dd0df583bfa9481973ce02dc5b50a763 to your computer and use it in GitHub Desktop.
Save xaman/dd0df583bfa9481973ce02dc5b50a763 to your computer and use it in GitHub Desktop.
Send message and file to Slack
# Send message
WEBHOOK_URL="<SLACK_WEBHOOK_URL>"
curl -X POST --data "payload={\"text\": \":robot_face: MESSAGE\"}" ${WEBHOOK_URL}
# Rename versions and send them to Slack
SLACK_CHANNEL='#example'
SLACK_TOKEN='<SLACK_TOKEN>'
FILE_PATH="./path-to-file";
echo "Sending $FILE_PATH to Slack";
curl -F file=@"$FILE_PATH" -F channels=${SLACK_CHANNEL} -F token=${SLACK_TOKEN} https://slack.com/api/files.upload;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment