Use this workflow to deploy the Atlas webhook route to Vercel and connect a Telegram bot to the deployed HTTPS endpoint for a real smoke test.
- The Vercel project points at this repository with
apps/webas the Next.js app. - The database and migrations are configured for the target environment.
- You have a Telegram bot token and can call the Telegram Bot API.
Set these in the Vercel project for the target environment before deploying:
DATABASE_URLAPP_BASE_URLOPENAI_API_KEYTELEGRAM_BOT_TOKENTELEGRAM_WEBHOOK_SECRETTELEGRAM_ALLOWED_USER_IDSGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_OAUTH_REDIRECT_URIGOOGLE_LINK_TOKEN_SECRETGOOGLE_CALENDAR_TOKEN_ENCRYPTION_KEYCRON_SECRET
Vercel Preview and Vercel Production must use different DATABASE_URL values. Preview must not target the production database.
- The Telegram webhook endpoint is
POST /api/telegram/webhook. - The route expects the
x-telegram-bot-api-secret-tokenheader to exactly matchTELEGRAM_WEBHOOK_SECRET. - The route is intended for dynamic Node.js execution on Vercel and should not be cached.
- Connect the repo to a new Vercel project.
- Set the framework to Next.js.
- Set the Root Directory to
apps/web. - Enable the Vercel setting that allows the build to access workspace files outside the Root Directory if Vercel does not detect it automatically.
- Add the required environment variables in Vercel for Preview or Production, including separate Preview and Production
DATABASE_URLvalues. - Deploy the latest
maincommit.
After Vercel gives you a deployment URL, register the webhook with Telegram using the deployed HTTPS route and the same secret stored in Vercel.
curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/setWebhook" \
-H "content-type: application/json" \
-d '{
"url": "https://YOUR-DEPLOYMENT-DOMAIN/api/telegram/webhook",
"secret_token": "YOUR-TELEGRAM-WEBHOOK-SECRET",
"allowed_updates": ["message", "edited_message"]
}'Confirm Telegram accepted the webhook:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getWebhookInfo"- Send a plain text message to the Telegram bot.
- Verify the Vercel function returns HTTP 200 for the delivery.
- Confirm the response body includes
accepted: true. - Confirm duplicate redelivery of the same Telegram
update_idreturnsduplicate: true. - Confirm invalid or missing secret headers return HTTP 401 without persisting ingress state.
- Vercel only hosts the protected cron endpoints. Scheduled follow-up dispatch and Google Calendar reconciliation now come from GitHub Actions via
.github/workflows/send-followups.ymland.github/workflows/reconcile-google-calendar.yml, not from Vercel Cron Jobs. - Production database migrations are owned by
packages/dband are applied by.github/workflows/apply-db-migrations.yml, not by ad hoc local commands or Vercel deploy hooks. - Do not log the webhook secret in Vercel function logs or error output.
- Keep the route handler thin and continue moving persistence and planning behavior into workspace packages.
- After the first Vercel smoke test, the next backend milestone is replacing the
processInboxItemstub with planner-owned persistence that reads canonicalinbox_items, creates validatedtasks, and recordsplanner_runsas operational audit state.