Last active
October 25, 2022 15:24
-
-
Save aashishrbhandari/7379652d8432098ad0f6872af810cf4c 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
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