Portable Discord webhook transport — Python package + multi-language reference.
+ icon → Create My Own → name my-app-prod.#general (or make a new #alerts
channel) → Edit Channel → Integrations → Webhooks →
New Webhook → Copy Webhook URL.Stash the URL somewhere safe. Treat it like an API key — anyone with the URL can post to your channel (they cannot read it, just post).
pip install discord-alert-transport
Python 3.10+. Zero runtime dependencies (stdlib only).
from discord_alert_transport import Channel, DiscordSender, build_embed
s = DiscordSender(
webhooks={
Channel.ALERTS: "https://discord.com/api/webhooks/.../...",
},
enabled=True,
username="my-app",
)
s.send_embed(
Channel.ALERTS,
build_embed(
title="Backup completed",
description="Nightly Postgres dump finished",
color=0x00cc66,
fields=[
{"name": "Size", "value": "12.4 GB", "inline": True},
{"name": "Duration", "value": "8m 14s", "inline": True},
],
footer="cron / backup.sh",
),
)
Phone buzzes (assuming Discord mobile app installed + channel notifications set to “All Messages”).
curl -X POST -H "Content-Type: application/json" \
-d '{"username":"my-bot","content":"hello world"}' \
https://discord.com/api/webhooks/.../...
Returns 204 No Content on success. Try it from node, go, bash,
PHP, etc. See languages for ready-to-paste examples.
discord.com/api/webhooks/<long>/<long>
patterns (sample one in this repo)Next: how it works.