I work on GetSetSales, a WhatsApp Business API provider in India, so the examples use our public API. The mistakes are the same on most WhatsApp APIs, because they come from Meta's rules.
The call
Sending a WhatsApp message from your own code (an order confirmation, an OTP, a reminder) means sending a template: a message Meta approved in advance. Free-form text only works inside the 24 hours after the customer last messaged you.
const res = await fetch("https://api.getsetsales.in/public/v1/messages", { method: "POST", headers: { Authorization: `Bearer ${process.env.GSS_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": `order-${order.id}`, }, body: JSON.stringify({ to: "919999999999", templateName: "order_confirmation", languageCode: "en", parameters: [order.customerName, `#${order.id}`], }), }); if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`); const { messageId } = await res.json(); // "wamid.HBgM..." parameters fills {{1}}, {{2}} and so on, in order. If the template says "Hi {{1}}, your order {{2}} is confirmed", the customer reads "Hi Raksha, your order #1234 is confirmed".
Mistake 1: the phone number format
to is digits only, with the country code: 919999999999. Not +91 99999 99999, not 09999999999. Strip spaces, dashes and the plus before you send, and add 91 to Indian ten-digit numbers.
const toWhatsApp = (raw) => { const d = raw.replace(/\D/g, "").replace(/^0+/, ""); return d.length === 10 ? `91${d}` : d; }; Mistake 2: a template that is not approved yet, or a different name
templateName must match an approved template on the sending number exactly. A template still "In review", or one approved under order_confirmation_v2 while your code says order_confirmation, is refused. Keep template names in config, not scattered through the code.
Mistake 3: the wrong language code
languageCode must match the language the template was approved in. A template approved as en_US is not the same as en, and a Hindi template is hi. If you approved one template in two languages, they are two separate sends.
Mistake 4: a template with an image header and no image
If the template was approved with an IMAGE header, Meta rejects the send unless you pass one:
"headerImageUrl": "https://cdn.yoursite.com/banner.jpg" It must be a public https link to a JPG or PNG. Meta fetches it itself, so a link behind a login or a signed URL that expires in a minute will fail.
Mistake 5: retrying and sending twice
Network calls time out. If you retry blindly, the customer gets the OTP twice. Send an Idempotency-Key header (an order ID works well). Retrying with the same key returns the first response again with Idempotent-Replayed: true, and nothing is re-sent. Reusing the key for a different message body returns 422. Keys last 24 hours.
Mistake 6: looping over 5,000 numbers
Each account can make 20 requests a second. Past that you get 429 with a Retry-After header. More importantly, a loop of single sends is the wrong tool for a broadcast: schedule a campaign instead (POST /public/v1/campaigns), which is paced for you and checks up front that the wallet can cover the whole send.
The status codes, in one place
| Code | Usually means |
|---|---|
| 400 | A required field is missing or wrong, or no connected number matches phoneNumberId |
| 402 | The wallet is below the ₹100 minimum |
| 403 | The account is not approved yet, or the feature is not switched on |
| 409 | Same idempotency key while the first call is still running |
| 422 | Same idempotency key, different message |
| 429 | Over 20 requests a second; wait Retry-After seconds |
Before you write the template
Most rejections happen before any code runs, at Meta's template review. Two rules catch most people: do not start or end the template with a variable (put a word before {{1}} and after the last one), and do not put an offer inside a "utility" template, because Meta will call it marketing. There is a free checker for this at https://getsetsales.in/whatsapp-template-checker, no account needed.
Full API reference: https://docs.getsetsales.in