Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bug-assassin/31d2bac321785f659ba2aa9c38e2a7fc to your computer and use it in GitHub Desktop.
Save bug-assassin/31d2bac321785f659ba2aa9c38e2a7fc to your computer and use it in GitHub Desktop.
Example discord webhook notification in python
import requests
webhook = "WEBHOOK_URL"
def sendNotification(title, url):
data = {
"content" : f"{title}",
"embeds" : [
{"title" : f"{title}",
"url" : f"{url}"}
]
}
result = requests.post(webhook, json = data)
try:
result.raise_for_status()
except requests.exceptions.HTTPError as err:
print(err)
else:
print("Payload delivered successfully, code {}.".format(result.status_code))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment