Created
August 29, 2024 14:44
-
-
Save khoipro/177f370c9cc4638fcc1c2b2f422ce7d3 to your computer and use it in GitHub Desktop.
Sample Bash script to trigger web hook in Slack
This file contains 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
#!/bin/bash | |
slack_webhook_url="https://hooks.slack.com/services/xxx" | |
function send_slack_message() { | |
message="$1" | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\": \"$message\"}" "$slack_webhook_url" | |
} | |
message="Testing\n\n" | |
# Multiple rows | |
message+=" 1, 2, 3!!!\n\n" | |
send_slack_message "$message" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment