Skip to content

Instantly share code, notes, and snippets.

@madcoda
Created April 6, 2017 06:40
Show Gist options
  • Save madcoda/9a57530edfbe32a9df4ce113312fa768 to your computer and use it in GitHub Desktop.
Save madcoda/9a57530edfbe32a9df4ce113312fa768 to your computer and use it in GitHub Desktop.
Slack Webhook bash script
#!/bin/bash
CHANNEL="#general"
USERNAME="MyBot"
EMOJI=":ghost:"
MSG=$1
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MSG\", \"icon_emoji\": \"$EMOJI\"}"
HOOK=https://hooks.slack.com/services/T00000000/XXXXYYYZ/XXXXXXXX
curl -X POST --data-urlencode "$PAYLOAD" "$HOOK"
@LightAxe
Copy link

Chang MSG to $* to get the full line passed instead of just the first word

@meshungina
Copy link

How might one attach an image link in here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment