Skip to content

Slack Webhooks for System Alerts

Create an incoming webhook URL in your Slack workspace.

Store it as an environment variable:

  • SLACK_WEBHOOK_URL
slack_webhook.py
import os
import requests
 
 
def slack_alert(text: str):
    url = os.environ["SLACK_WEBHOOK_URL"]
    r = requests.post(url, json={"text": text}, timeout=10)
    r.raise_for_status()
 
 
# slack_alert("Job succeeded")

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading