Skip to content

Instantly share code, notes, and snippets.

@Jimmy-Xu
Created September 28, 2017 02:54
Show Gist options
  • Save Jimmy-Xu/7c044bafd9c4b692269ab42d256495cd to your computer and use it in GitHub Desktop.
Save Jimmy-Xu/7c044bafd9c4b692269ab42d256495cd to your computer and use it in GitHub Desktop.
slack.sh
#!/bin/bash
TOKEN="$1"
CHANNEL_ID="$2"
MESSAGE="$3"
ATTACHMENT="$4"
NICK="HykinsBot"
EMOJI=":jenkins:"
curl -X POST \
-F token=$TOKEN \
-F channel=$CHANNEL_ID \
-F "text=$MESSAGE" \
-F username=$NICK \
-F "attachments=${ATTACHMENT}" \
-F "icon_emoji=$EMOJI" \
https://slack.com/api/chat.postMessage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment