Skip to content

Instantly share code, notes, and snippets.

@andrelugomes
Created November 18, 2020 17:37
Show Gist options
  • Save andrelugomes/6ec4ddb3d3e8418dad6d47ebf3540b7e to your computer and use it in GitHub Desktop.
Save andrelugomes/6ec4ddb3d3e8418dad6d47ebf3540b7e to your computer and use it in GitHub Desktop.
How to send my IP over Slack
#!/bin/sh
#MEU_IP=$(dig +short myip.opendns.com @resolver1.opendns.com);
#MEU_IP=$(curl ifconfig.co)
MEU_IP=$(curl 'https://api.ipify.org?format=human')
USER=$(whoami)
curl -X POST --data-urlencode \
"payload={\"channel\": \"#channel\", \"username\": \"meu-ip\", \"text\": \"$USER : $MEU_IP\", \"icon_emoji\": \":aaaa:\"}" \
https://hooks.slack.com/services/WEB_HOOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment