Skip to content

Instantly share code, notes, and snippets.

@aashishrbhandari
Last active October 25, 2022 15:24
Show Gist options
  • Save aashishrbhandari/7379652d8432098ad0f6872af810cf4c to your computer and use it in GitHub Desktop.
Save aashishrbhandari/7379652d8432098ad0f6872af810cf4c to your computer and use it in GitHub Desktop.
import requests, json
# Slack WebHook Required
slack_webhook_url = "https://hooks.slack.com/services/XXXXXXXXXX/XXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"
# Use the blocks from slack_webhook_blocks.txt
message = {
"blocks": [
{
"type": "divider"
},
{
"type": "header",
"text": {
"type": "plain_text",
"text": "[Alert] Event Update Triggered, Details are Added Below"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "• *EventName1* \n \t ➜ EventDetail1 \n\n• *EventName2* \n \t ➜ EventDetail2 \n\n• *EventName3* \n \t ➜ EventDetail3 \n\n"
}
},
{
"type": "divider"
}
]
}
response = requests.post(slack_webhook_url, json.dumps(message))
print(f"[+] Response: {response}: {response.text}: {response.request.body}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment