Skip to content

Automating Discord Messages

Create a webhook in a Discord channel and store it as:

  • DISCORD_WEBHOOK_URL
discord_webhook.py
import os
import requests
 
 
def discord_send(content: str):
    url = os.environ["DISCORD_WEBHOOK_URL"]
    r = requests.post(url, json={"content": content}, timeout=10)
    r.raise_for_status()
 
 
# discord_send("Automation finished")

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading