WhatsApp Business directly with Meta.
Install
Terminal
npx shadcn@latest add @tendkit/channel-whatsappIt lands in lib/support/channels/. Import whatsappChannel from there.
Set up
Create a Meta app
Type Business, with the WhatsApp product, and add your business number.
Create a System User token
Business settings → System users. Assign the app and WhatsApp account, and generate a token with whatsapp_business_messaging and whatsapp_business_management.
Register the webhook
App → WhatsApp → Configuration: callback URL = the channel's webhook URL, verify token = your
verifyToken; subscribe tomessages. Meta verifies with a GET, so export GET from your route too.Add a payment method
Meta charges replies per message after a monthly free tier, and stops delivering them when the tier runs out without one.
Configure
lib/support/index.ts
whatsappChannel({
id: "whatsapp",
phoneNumberId: process.env.WA_PHONE_NUMBER_ID!,
accessToken: process.env.WA_ACCESS_TOKEN!,
appSecret: process.env.WA_APP_SECRET!,
verifyToken: process.env.WA_VERIFY_TOKEN!,
displayNumber: "+1 415 555 0133",
})Options
| Name | Type | Description |
|---|---|---|
id* | string | Stable channel id, stored on every ticket and used in the webhook URL. Never change it. |
phoneNumberId* | string | The business number's id, not the number itself. |
accessToken* | string | A System User token. |
appSecret* | string | App settings → Basic. Signs webhook deliveries. |
verifyToken* | string | Any string; Meta echoes it when you register the webhook. |
displayNumber* | string | The number customers write to, for display. |
apiVersion | string | Graph API version. |
Behaviour
- Replies are allowed for 24 hours after the customer's last message; this adapter doesn't send templates.
- Reactions and system notices are ignored, so they never reopen a ticket.