-
-
Save pedrolaxe/4a56b462c8d4e7e7ee386df7a374bc23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ####################################################################### | |
| ## | |
| # | |
| # Basic Slack notifier | |
| # | |
| # Author: Freibuis | |
| # Web: https://github.com/freibuis | |
| # Inspiration: The Internet! | |
| # Api Information: https://api.slack.com/incoming-webhooks | |
| # | |
| # Change slack details as needed | |
| # This can be modified to take arguments if neeed. | |
| # example: | |
| # MESSAGE=$1 | |
| # SLACK_CHANNEL=$2 | |
| # | |
| ## | |
| ####################################################################### | |
| SLACK_HOSTNAME="yourcompany.slack.com" | |
| SLACK_CHANNEL="#channel-to-post-to" | |
| SLACK_BOTNAME="mybotname-bot" | |
| SLACK_WEBHOOK_API="https://hooks.slack.com/services/000000000/1111111111111111111111111111111111" | |
| MESSAGE="Test message to send to slack" | |
| slack_notify() { | |
| curl -X POST \ | |
| --data "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_BOTNAME}\", \"text\": \"$MESSAGE \"}" \ | |
| $SLACK_WEBHOOK_API | |
| } | |
| slack_notify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment