This Supabase Edge Function receives webhook notifications from Vercel deployments and forwards them to a Telegram chat.
# From your project root
cd supabase/functions
supabase functions deploy deployment-notification --no-verify-jwt
- Open Telegram and search for "BotFather"
- Send
/newbot
and follow the instructions to create a new bot - BotFather will give you a token - save this for later
- Add your bot to the desired chat/group
- Send a message in the chat
- Visit
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
in your browser - Look for the
chat
object and note theid
field - this is your chat ID
supabase secrets set TELEGRAM_BOT_TOKEN=<YOUR_BOT_TOKEN>
supabase secrets set TELEGRAM_CHAT_ID=<YOUR_CHAT_ID>
supabase secrets set WEBHOOK_SECRET=<YOUR_VERCEL_WEBHOOK_SECRET>
The WEBHOOK_SECRET
is used to verify that the webhook is actually coming from Vercel. You can create this secret in your Vercel project settings when configuring the webhook.
- Go to your Vercel project settings
- Navigate to "Git Integration" > "Deploy Hooks"
- Add a new webhook with the URL:
https://<PROJECT_REF>.supabase.co/functions/v1/deployment-notification
You can test the function by making a POST request that simulates a Vercel deployment webhook.
curl -X POST https://<PROJECT_REF>.supabase.co/functions/v1/deployment-notification \
-H "Content-Type: application/json" \
-d '{
"id": "dPUnTTNYPXi2-example",
"payload": {
"user": {
"id": "user123"
},
"team": {
"id": "team_123"
},
"deployment": {
"id": "dpl_123",
"meta": {
"githubCommitAuthorName": "Developer Name",
"githubCommitMessage": "Fix navigation bug",
"githubCommitRef": "main",
"githubCommitRepo": "upperhandai"
},
"name": "upperhandai",
"url": "upperhandai-example.vercel.app",
"inspectorUrl": "https://vercel.com/example/upperhandai/123"
},
"links": {
"deployment": "https://vercel.com/example/upperhandai/123",
"project": "https://vercel.com/example/upperhandai"
},
"name": "upperhandai",
"plan": "pro",
"project": {
"id": "prj_123"
},
"regions": [
"iad1"
],
"target": "production",
"type": "LAMBDAS",
"url": "upperhandai-example.vercel.app"
},
"createdAt": 1741656811704,
"type": "deployment.ready"
}'
curl -X POST https://<PROJECT_REF>.supabase.co/functions/v1/deployment-notification \
-H "Content-Type: application/json" \
-d '{
"id": "dPUnTTNYPXi2-example",
"payload": {
"deployment": {
"id": "dpl_123",
"meta": {
"githubCommitAuthorName": "Developer Name",
"githubCommitMessage": "Broken Build",
"githubCommitRef": "feature/new-feature",
"githubCommitRepo": "upperhandai"
},
"name": "upperhandai",
"url": "upperhandai-example.vercel.app",
"inspectorUrl": "https://vercel.com/example/upperhandai/123"
},
"name": "upperhandai",
"target": "production",
"url": "upperhandai-example.vercel.app"
},
"createdAt": 1741656811704,
"type": "deployment.error"
}'
The function is specifically designed to handle the Vercel webhook format currently used in 2025. The webhook payload contains:
id
: A unique identifier for the webhookpayload
: Contains all deployment information:deployment
: Details about the deployment including meta info with commit detailsname
: Project nameurl
: Deployment URLtarget
: Deployment target (production, preview, etc.)
createdAt
: Timestamp of when the event occurredtype
: Type of event (deployment.ready, deployment.error, etc.)
The function extracts this information and formats a helpful message for Telegram notifications.