Cloudflare Worker that transcribes WhatsApp voice messages using Workers AI (Whisper) and replies with the transcript. Optional AI summary via GENERATE_SUMMARY.
-
Meta / WhatsApp
- Create a Meta app and add the WhatsApp product.
- Get your Phone Number ID and Access Token.
- Configure a webhook URL:
https://<your-worker>.<account>.workers.dev/webhook. - Set a verify token (any string you choose).
-
Secrets (required):
npx wrangler secret put WEBHOOK_SECRET # same as verify token in Meta npx wrangler secret put WHATSAPP_PHONE_NUMBER_ID npx wrangler secret put WHATSAPP_ACCESS_TOKEN -
Optional
WHITELISTED_PHONE_NUMBERS— comma-separated numbers; if set, only these receive transcript replies. Omit to allow all.- In
wrangler.jsoncvars:GENERATE_SUMMARY(true/false),WORKERS_AI_MODEL,WORKERS_AI_SUMMARY_MODEL.
npm install
npm run deployUse the worker URL as your WhatsApp webhook and for verification.
POST /webhook— WhatsApp webhook (receives events).GET /webhook— Verification (Meta sendshub.mode,hub.verify_token,hub.challenge).GET /health— ReturnsOK.