POST/api/v2/messages
Send a message
One endpoint for WhatsApp (scan QR) and WhatsApp Official: text, a file, a template, or an OTP code.
Choose the channel with channel. Klik Flow uses the first number the key may use, or the number in from. Outside 24 hours since the customer last wrote, WhatsApp Official can only send template or otp. Send an Idempotency-Key header so a retry does not produce a second message. Test keys send only to test numbers.
Send an Idempotency-Key header (for example a new UUID per request). A repeat with the same key within 24 hours gets the first answer again, so nothing is sent twice.
OTP code: {"channel":"whatsapp_official","to":"62812…","type":"otp","otp":{"template":"kode_login","code":"482913"}}.
Body (JSON)
channelstring: whatsapp_qr | whatsapp_officialrequiredSending channel.
tostringrequiredDestination number with country code; 08… is changed to 628….
typestring: text | image | video | audio | document | template | otprequiredMessage type.
templateandotpare for whatsapp_official only.fromstringA specific sender number: the device id (whatsapp_qr) or number id (whatsapp_official), from
GET /api/v2/channels.textobject{ "body": "…" }, at most 4,000 characters. For type text.mediaobjecturl(https) orbase64+mime, withfilenameandcaption. For file types.templateobjectname,language,variables(object or array),header_variables,media_url,button_url,coupon_code.otpobjecttemplate(an Authentication template) andcode(1–15 letters, digits, or-). The code is not stored.
Possible errors
- 400
invalid_jsonBody is not valid JSON - 400
idempotency_key_invalidInvalid Idempotency-Key - 401
missing_keyAPI key not sent - 401
key_invalidUnknown API key - 401
key_revokedAPI key revoked - 401
key_expiredAPI key expired - 401
member_inactiveKey creator is no longer a member - 403
ip_not_allowedServer IP not in the key's list - 403
plan_no_apiPlan does not include the API for live keys - 403
tenant_blockedBusiness access suspended - 403
scope_missingKey lacks this permission - 403
permission_missingKey creator's role lacks this permission - 403
test_number_requiredTest keys send only to test numbers - 403
channel_not_allowedChannel not allowed for this key - 403
channel_pausedChannel paused - 404
not_foundNot found - 404
template_not_foundTemplate not found or not approved - 409
idempotency_conflictIdempotency-Key used for different content - 409
request_in_progressThe same request is still being processed - 409
channel_unavailableNo usable WhatsApp number - 409
window_closedOutside the 24-hour window - 413
media_too_largeFile too large - 422
invalid_requestInvalid field - 422
invalid_phoneInvalid destination number - 422
message_too_longMessage too long - 422
contact_blockedContact blocked or unsubscribed - 422
template_valuesTemplate variables incomplete - 422
template_not_supportedTemplate type not supported yet - 422
otp_code_invalidInvalid OTP code - 429
rate_limitedToo many requests per minute - 429
daily_limitDaily message limit reached - 429
new_chat_limitLimit of chats to new numbers reached - 500
internal_errorProblem at Klik Flow - 502
send_failedMessage failed to send - 502
channel_refusedWhatsApp refused the message
Try it
Try it with a test key
/api/v2/messages