Skip to content

Instantly share code, notes, and snippets.

@mikeabreu
Created November 9, 2017 02:16
Show Gist options
  • Save mikeabreu/2545883919fa97833485182fc541b88a to your computer and use it in GitHub Desktop.
Save mikeabreu/2545883919fa97833485182fc541b88a to your computer and use it in GitHub Desktop.
#!/bin/bash
# SLACK_WEBHOOK=$(printenv YOUR_SLACK_WEBHOOK)
SLACK_WEBHOOK="<INSERT_YOUR_SLACK_WEBHOOK>"
f_send_slack() {
SLACK_TEXT="$@"
SLACK_JSON="""payload={
\"channel\": \"#general\",
\"username\": \"your-slack-bot\",
\"icon_emoji\": \":monkey_face:\",
\"text\": \"${SLACK_TEXT}\"
}"""
curl -s -X POST \
--data-urlencode "${SLACK_JSON}" \
$SLACK_WEBHOOK > /dev/null
}
# f_send_slack "Your messages"
f_send_slack "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment