RCS Message
RCS Business Messaging (RCS) is a Google RCS channel that supports rich messages: carousels, action buttons, images, and more. RCS messages are sent through a dedicated endpoint.
Endpoint
Section titled “Endpoint”POST https://messaging.mahadata.io/v1/agents/{agent_id}/messagesReplace {agent_id} with your RCS agent UUID (obtained from the app.mahadata.io page Channels). This UUID is also used to validate that the agent actually belongs to your account.
Request Body
Section titled “Request Body”{ "to": "6281234567890", "rbm": { "rich_message_id": "f7a816e2-8397-11f0-8e34-010203040506", "rbm_agent_id": "a1b2c3d4-5678-9012-abcd-ef0123456789" }}Request Field
Section titled “Request Field”| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number in E.164 format (without +) |
rbm | object | Yes | RCS message object (contains rich_message_id and rbm_agent_id) |
rbm.rich_message_id | string (UUID) | Yes | Rich message ID that has been configured in the portal |
rbm.rbm_agent_id | string (UUID) | Yes | UUID of the RCS agent used for sending. Should be the same as {agent_id} in the URL |
sms_failover | object | No | Fallback SMS message if RCS is unavailable |
SMS Failover
Section titled “SMS Failover”If the recipient does not support RCS, the platform can send an SMS as a fallback:
{ "to": "6281234567890", "rbm": { "rich_message_id": "f7a816e2-8397-11f0-8e34-010203040506", "rbm_agent_id": "a1b2c3d4-5678-9012-abcd-ef0123456789" }, "sms_failover": { "body": "Kode OTP Anda: 123456. Berlaku 5 menit." }}Field sms_failover
Section titled “Field sms_failover”| Field | Type | Required | Description |
|---|---|---|---|
body | string | Yes | Content of the fallback SMS message |
Complete Example
Section titled “Complete Example”curl -X POST https://messaging.mahadata.io/v1/agents/YOUR_RBM_AGENT_ID/messages \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "to": "6281234567890", "rbm": { "rich_message_id": "f7a816e2-8397-11f0-8e34-010203040506", "rbm_agent_id": "a1b2c3d4-5678-9012-abcd-ef0123456789" } }'import requests
url = "https://messaging.mahadata.io/v1/agents/YOUR_RBM_AGENT_ID/messages"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "to": "6281234567890", "rbm": { "rich_message_id": "f7a816e2-8397-11f0-8e34-010203040506", "rbm_agent_id": "a1b2c3d4-5678-9012-abcd-ef0123456789" }}
response = requests.post(url, json=payload, headers=headers)print(response.json())const response = await fetch( 'https://messaging.mahadata.io/v1/agents/YOUR_RBM_AGENT_ID/messages', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ to: '6281234567890', rbm: { rich_message_id: 'f7a816e2-8397-11f0-8e34-010203040506', rbm_agent_id: 'a1b2c3d4-5678-9012-abcd-ef0123456789', }, }), });const data = await response.json();console.log(data);Response
Section titled “Response”Message received for processing with status 202 Accepted:
{ "messaging_product": "whatsapp", "messages": [ { "id": "msg_f7a816e2-8397-11f0-8e34-010203040506" } ]}Webhook Statuses You Will Receive
Section titled “Webhook Statuses You Will Receive”message.status.sent— RCS message successfully sentmessage.status.delivered— Message reached the recipient’s devicemessage.status.read— Message read by the recipient
If it fails, you receive message.status.failed.
See the page Webhook for details on the payload format of each event.