A simple LLM chatbot webhook on WhatsApp.
Send a WhatsApp message to +65 8646 2570 or +1 555 133 0603. GPT-4o-mini will reply.
- Log into Meta for Developers and create a new app
- Set up WhatsApp as a product
- Generate a system user access token
- Add the phone number to the WhatsApp Business app and add a payment method
- Log into https://dash.cloudflare.com/ as [email protected]
- Create a worker called
whatsllm
deployed at https://whatsllm.sanand.workers.dev - Clone this repository
- Run
npm install
- Run
npx wrangler secret put <key>
also add them to.dev.vars
asKEY=value
:WEBHOOK_VERIFY_TOKEN
: Via Meta Developer ConsoleACCESS_TOKEN
: Via Meta Developer Console -- or generated viacurl https://graph.facebook.com/oauth/access_token?client_id=1247415196273061&client_secret=$APP_SECRET&grant_type=client_credentials
LLMFOUNDRY_TOKEN
: Via LLM Foundry
- Run
npm run deploy
to deploy on Cloudflare
- If WhatsApp's webhook receives an error, it keeps retrying at 0.33, 0.66, 2, 30, 390, ... seconds