Last active
December 16, 2020 17:51
-
-
Save steinn/7920131 to your computer and use it in GitHub Desktop.
Post random number from random.org to a channel on 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 | |
RANDOM_URL=http://www.random.org/integers/?num=1\&min=1\&max=100\&col=1\&base=10\&format=plain\&rnd=new | |
RND_NUMBER=$(curl $RANDOM_URL) | |
MESSAGE=$RND_NUMBER | |
USERNAME="random.org" | |
CHANNEL="#random" | |
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MESSAGE\"}" | |
TOKEN=<ADD_TOKEN> | |
SLACK_URL=https://jive.slack.com/services/hooks/incoming-webhook?token=$TOKEN | |
curl -X POST --data "$PAYLOAD" $SLACK_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment