Skip to content
Send messages

Send text

Send a plain-text message — up to 4,096 characters, optional URL preview. Body shape mirrors Meta’s WhatsApp Cloud API exactly.

Terminal window
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" }
}'

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
}
}

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:

Terminal window
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" }
}'
  • Either to or recipient is required. If both are supplied, Meta uses to (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 131062 and the public API mirrors the error before hitting Meta. Send auth OTP to a phone number (to).
  • The response echoes back bsuid, parent_bsuid, and username for the recipient contact so you can persist them.

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.

Terminal window
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." }
}'