Skip to main content

Send Message

Send a message (notification or OTP delivery) to a bound customer.

POST /api/v1/merchant/message/send

Headers

Include X-Api-Key, X-Api-Secret, Idempotency-Key (see Authentication).

Body

FieldTypeRequiredDescription
customerExternalIdstringCustomer ID in your system
categorystringNOTIFICATION (default) or OTP, for classification only
textstring✅*Raw text; one of text / templateCode
templateCodestring✅*Approved template code; one of text / templateCode
variablesobjectTemplate variables, e.g. {"otp":"395217"}

Provide at least one of text / templateCode. With a template, LOMA renders {placeholders} using variables.

Example (raw text)

{
"customerExternalId": "C10086",
"category": "OTP",
"text": "Your OTP is 395217, valid for 5 minutes."
}

Example (template)

{
"customerExternalId": "C10086",
"category": "OTP",
"templateCode": "otp_msg",
"variables": { "otp": "395217", "minutes": 5 }
}

Success 200

{
"code": "OK",
"message": "Success",
"requestId": "req_...",
"data": {
"messageRequestId": "2072...014",
"status": "SENT"
}
}
  • messageRequestId: message request id, use it to check status.
  • status: QUEUED / SENT / FAILED.

Common errors

codeHTTPDescription
CUSTOMER_NOT_BOUND409Customer not bound to LINE
CUSTOMER_UNFOLLOWED409Customer hasn't added the OA as a friend; cannot push
TEMPLATE_NOT_FOUND404Template missing or not approved
TEMPLATE_VAR_MISSING400Missing template variable
QUOTA_EXCEEDED429Monthly message quota used up
VALIDATION_ERROR400Validation failed

See Errors for the full list.