Visit Official API Documentation. And Visit Platform WhatsApp Business for more information.
npm install whatsapp-api-client
import whatsapp from "whatsapp-api-client";
// or for CommonJS
const whatsapp = require("whatsapp-api-client");
const client = whatsapp.createClient({
accessToken: "YOUR_ACCESS_TOKEN",
waBusinessAccountid: "YOUR_WA_BUSINESS_ACCOUNT_ID",
});
await client.utils.sendOtpWithCopyCode({
phoneNumberId: "YOUR_PHONE_NUMBER_ID", // get this ID from https://developers.facebook.com
to: "YOUR_ACTIVE_PHONE_NUMBER", // including country code
templateName: "YOUR_OTP_TEMPLATE_ID",
templateLanguageCode: "en_US", // en_US | id | etc.
code: "123456", // Your OTP Code
});