Send text
Send a plain-text message — up to 4,096 characters, optional URL preview. Body shape mirrors Meta’s WhatsApp Cloud API exactly.
curl -X POST \ https://api.kirimdev.com/v1/$PHONE_ID/messages \ -H "Authorization: Bearer $KIRIM_KEY" \ -H "Content-Type: application/json" \ -d '{ "messaging_product": "whatsapp", "to": "+628123456789", "type": "text", "text": { "body": "Halo dari Kirimdev" } }'import { Kirim } from '@kirimdev/sdk'
const kirim = new Kirim({ apiKey: process.env.KIRIM_KEY! })const phone = kirim.phoneNumbers(process.env.PHONE_ID!)
await phone.messages.send({ messaging_product: 'whatsapp', to: '+628123456789', type: 'text', text: { body: 'Halo dari Kirimdev' },})Optional: link previews
Section titled “Optional: link previews”Set text.preview_url: true to ask WhatsApp to render a rich preview
for the first URL found in body. Meta fetches the page server-side —
no extra payload needed from your side.
{ "messaging_product": "whatsapp", "to": "+628123456789", "type": "text", "text": { "body": "Cek harga terbaru: https://example.com/pricing", "preview_url": true }}Send to a Business-Scoped User ID (BSUID)
Section titled “Send to a Business-Scoped User ID (BSUID)”WhatsApp usernames (2026 rollout) let users hide their phone number.
When you receive an inbound message from a username-adopted user, the
webhook may omit wa_id and only carry user_id — a
Business-Scoped User ID in the form US.13491208655302741918.
Send back to that user by setting recipient instead of to:
curl -X POST \ https://api.kirimdev.com/v1/$PHONE_ID/messages \ -H "Authorization: Bearer $KIRIM_KEY" \ -H "Content-Type: application/json" \ -d '{ "messaging_product": "whatsapp", "recipient": "US.13491208655302741918", "type": "text", "text": { "body": "Halo dari Kirimdev" } }'await phone.messages.send({ messaging_product: 'whatsapp', recipient: 'US.13491208655302741918', type: 'text', text: { body: 'Halo dari Kirimdev' },})- Either
toorrecipientis required. If both are supplied, Meta usesto(documented precedence). - BSUIDs are scoped to the business portfolio that received the inbound. You cannot cross-message a BSUID from another business.
- Authentication OTP templates (one-tap / zero-tap / copy-code) do NOT accept BSUID recipients — Meta rejects them with error
131062and the public API mirrors the error before hitting Meta. Send auth OTP to a phone number (to). - The response echoes back
bsuid,parent_bsuid, andusernamefor the recipient contact so you can persist them.
Reply to a message
Section titled “Reply to a message”Add optional context.message_id with the inbound wamid from your
webhook (messages[0].id) to send a quoted reply. Use the Meta id, not a
Kirim msg_* external id.
curl -X POST \ https://api.kirimdev.com/v1/$PHONE_ID/messages \ -H "Authorization: Bearer $KIRIM_KEY" \ -H "Content-Type: application/json" \ -d '{ "messaging_product": "whatsapp", "to": "+628123456789", "type": "text", "context": { "message_id": "wamid...." }, "text": { "body": "Terima kasih, sudah kami terima." } }'await phone.messages.send({ messaging_product: 'whatsapp', to: '+628123456789', type: 'text', context: { message_id: inboundWamid }, text: { body: 'Terima kasih, sudah kami terima.' },})See also
Section titled “See also”- API Reference — Send a WhatsApp message
- Quickstart — full account-setup walkthrough before your first send
- Idempotency — safely retrying a send