Created
December 19, 2017 11:26
-
-
Save xaman/dd0df583bfa9481973ce02dc5b50a763 to your computer and use it in GitHub Desktop.
Send message and file to Slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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