Skip to content

Instantly share code, notes, and snippets.

@kbens
Last active July 5, 2016 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbens/d3e8a53dc91c116ef4c45cf730e28a43 to your computer and use it in GitHub Desktop.
Save kbens/d3e8a53dc91c116ef4c45cf730e28a43 to your computer and use it in GitHub Desktop.
# Testing Slack API
# psadminio.slack.com
notify="@YOUR_USERNAME"
gist="https://gist.github.com/kbens/d3e8a53dc91c116ef4c45cf730e28a43"
text="This is a test of the Slack API. - $gist \nPlease let $notify know that you recived this message!"
url="https://hooks.slack.com/services/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"
conttype="Content-type: application/json"
method="POST"
chan="@TEST_USER"
username="slack api tester"
icon=":sleuth_or_spy:"
data="\"channel\": \"$chan\",\"username\": \"$username\",\"text\":\"$text\",\"icon_emoji\": \"$icon\""
response=$(curl -sbX $method -H "$conttype" --data "{$data}" $url)
echo "Data: $data"
echo "Response: $response"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment