2-way messaging works on an RCS agent that is yours, launched for your brand. Messages sent to a shared Prelude agent are not forwarded. The agent must be a transactional, promotional or multi-use agent: an OTP agent cannot send free text, so it takes no part in 2-way messaging. Ask your Customer Success Manager to enable 2-way messaging on your agent and to register the callback URL that receives its messages.
How it works
1
User sends an RCS message
A user writes to your agent from a conversation your agent opened.
2
Prelude receives and forwards the message
Prelude stores the message and sends an
inbound.message.received webhook event to the callback URL registered for your agent. The event includes the message text, the sender’s phone number, your agent identifier, and a message ID you can use to reply.3
You send a reply
Your application calls the Reply to an inbound message endpoint with the
to, text, and reply_to fields to send a reply.4
User receives a reply
The user sees your reply as an RCS text from your agent.
Reply timing
RCS has no reply window: you can reply to an inbound message at any time, and the reply leaves from the agent that received it. Unlike WhatsApp, a reply sent more than 24 hours after the user’s latest message is not rejected.Reserved keywords
STOP, START and HELP are handled by Prelude and are not forwarded to your callback URL. A user who sent STOP is unsubscribed from your agent until they send START. A reply to an unsubscribed user is not sent: the message fails with the reasonunsubscribed.
Sending a reply
To reply to an inbound message, use the dedicated Reply to an inbound message endpoint:string
required
The recipient’s phone number in E.164 format. Must match the phone number that sent the original inbound message.
string
required
The reply message body, sent as a plain RCS text from the agent that received the message.
string
required
The inbound message ID (prefixed with
im_) to reply to. This ID is provided in the inbound.message.received webhook event.The
to field must match the phone number that sent the original inbound message. A phone_number_mismatch error is returned otherwise.SDK examples
Receiving inbound messages
When a user sends a text to your agent, Prelude forwards it as aninbound.message.received webhook event to the callback URL registered for that agent.
Webhook event
string
The unique inbound message identifier (prefixed with
im_). Use this value in reply_to to send a reply.string
The channel the message was received on:
rcs.string
The sender’s phone number in E.164 format.
string
The identifier of your RCS agent that received the message.
string
The text content of the inbound message.
RFC3339 date string
24 hours after the message. On RCS it is for information only: a reply sent after this time is still delivered.
Error handling
The following errors are specific to 2-way messaging:Limitations
- Only text messages are forwarded. Other content a user sends is not.
- Replies are sent as plain RCS texts, not as rich cards.
- 2-way messaging is only available on your own RCS agent, not on shared Prelude agents, and not on OTP agents.