Quick start
Send a WhatsApp message through a channel sender.
The one rule
Use a template outside the open customer-service window; use free text only inside it.
import { createWhatsAppSender } from "sently/whatsapp";
import { WhatsAppCloudTransport } from "sently/transports/whatsapp-cloud";
const whatsapp = createWhatsAppSender({
transport: new WhatsAppCloudTransport({
accessToken: process.env.WHATSAPP_TOKEN!,
phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID!,
}),
});await whatsapp.send({
to: "15551234567",
template: { name: "welcome", language: "en_US" },
});