Skip to content

Instantly share code, notes, and snippets.

@LightAxe
Forked from madcoda/slack.sh
Last active October 10, 2017 23:01
Show Gist options
  • Save LightAxe/8d47a3cf2b81abfb7291e682baa00c15 to your computer and use it in GitHub Desktop.
Save LightAxe/8d47a3cf2b81abfb7291e682baa00c15 to your computer and use it in GitHub Desktop.
Slack Webhook bash script
#!/bin/bash
CHANNEL="#general"
USERNAME="MyBot"
EMOJI=":ghost:"
MSG=$*
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MSG\", \"link_names\": 1, \"icon_emoji\": \"$EMOJI\"}"
HOOK=https://hooks.slack.com/services/T00000000/XXXXYYYZ/XXXXXXXX
curl -X POST --data-urlencode "$PAYLOAD" "$HOOK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment