sent-two-way-messaging

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sent Two-Way Messaging

Sent双向消息

Inbound messaging on Sent has one governing rule: consent is enforced by the platform before the application sees the event. An inbound
STOP
has already flipped the contact's
opt_out
flag by the time
message.received
arrives. The application's job is to record it, reflect it in its own UI, and never attempt to send around it.
Sent的入站消息遵循一条核心规则:在应用程序接收到事件之前,平台会先强制执行同意规则。
message.received
事件到达时,入站的
STOP
指令已经将联系人的
opt_out
标记设为已触发。应用程序的职责是记录该状态、在自身UI中体现,并且绝不能绕过该限制发送消息。

Keyword handling

关键词处理

Ten keywords ship as defaults:
ActionKeywords
Opt out
STOP
,
CANCEL
,
UNSUBSCRIBE
,
QUIT
,
END
Opt in
START
,
UNSTOP
,
SUBSCRIBE
Help auto-reply
HELP
,
INFO
Matching requires the entire trimmed message body to equal a keyword, case-insensitively. "Please stop messaging me" does not match; "stop" does. Custom keywords are configured in the Sent Dashboard under Compliance, Opt Keywords, with an action of Opt Out, Opt In, or Help, and each must be a single exact token.
Do not claim keywords that are not in the documented set. In application code, mirror the same exact-match rule only to update local subscriber state and audit evidence; never use that matcher to apply consent to Sent a second time. Keep custom dashboard keywords synchronized with the local mirror, and reconcile against the contact's
opt_out
field when uncertain.
平台默认提供10个关键词:
操作关键词
退订
STOP
,
CANCEL
,
UNSUBSCRIBE
,
QUIT
,
END
订阅
START
,
UNSTOP
,
SUBSCRIBE
帮助自动回复
HELP
,
INFO
匹配规则要求经过修剪后的消息正文完全等于某个关键词,且不区分大小写。例如“请停止给我发消息”不会匹配,但“stop”会匹配。自定义关键词可在Sent控制台的「合规性」-「选择关键词」中配置,可设置为退订、订阅或帮助操作,且每个关键词必须是单一精确词汇。
请勿使用文档未列出的关键词。在应用代码中,仅需镜像相同的精确匹配规则来更新本地订阅者状态和审计记录;切勿使用该匹配器再次对Sent执行同意规则。请保持控制台自定义关键词与本地镜像同步,若存在不确定性,请通过联系人的
opt_out
字段进行核对。

Consent state

同意状态

An opt-out sets
opt_out
on the contact record. Consent is contact-level and channel-agnostic: a
STOP
sent over SMS suppresses WhatsApp and RCS for that contact as well. Consent gates re-apply on every reroute attempt, not only at initial send.
Restoring consent requires the recipient's own action. A user-initiated opt-in keyword clears suppression.
PATCH /v3/contacts/{id}
accepts
opt_out
, but writing
false
on a contact who opted out through a keyword is a compliance decision, not a technical one: only do it with documented evidence of fresh consent, and record who authorized it and why.
Downstream, a suppressed send does not fail with an error. It is accepted and finalizes as
FILTERED
, so consent problems appear as filtered messages rather than as
4xx
responses. Details are in references/consent-and-keywords.md.
退订操作会设置联系人记录中的
opt_out
标记。同意状态基于联系人级别且与渠道无关:通过SMS发送的
STOP
指令也会禁止向该联系人发送WhatsApp和RCS消息。同意规则会在每次路由尝试时重新生效,而非仅在首次发送时。
恢复同意状态需要接收方主动操作。用户发起的订阅关键词会解除限制。
PATCH /v3/contacts/{id}
接口支持修改
opt_out
字段,但对于通过关键词退订的联系人,将其设为
false
属于合规决策而非技术操作:仅当有明确的新同意证据时才可执行,并需记录授权人及原因。
下游流程中,被限制的发送请求不会返回错误。请求会被接受并最终标记为
FILTERED
,因此同意相关问题会表现为过滤后的消息,而非
4xx
响应。详情请参考references/consent-and-keywords.md

Per-channel inbound reality

按渠道划分的入站实际情况

ChannelInboundConstraints
SMSConditionalRequires an MO-capable provider and a supported number type. Alphanumeric sender IDs and SMPP paths without an inbound route never deliver inbound messages
RCSFullTyped replies match keywords; the appended STOP chip is processed directly by the consent engine
WhatsAppFullFree-form replies only inside the 24-hour customer service window; outside it, an approved template is required
The SMS caveat matters before promising two-way behavior: a deployment sending from an alphanumeric sender ID cannot receive
STOP
at all, which changes the compliance design rather than merely limiting a feature.
渠道入站能力限制条件
SMS有条件支持需要具备MO能力的服务商及支持的号码类型。字母数字发送者ID和无入站路由的SMPP路径无法传递入站消息
RCS完全支持键入的回复会匹配关键词;附加的STOP芯片由同意引擎直接处理
WhatsApp完全支持仅在24小时客服窗口内允许自由回复;窗口外需使用已审核的模板
在承诺双向消息功能前需注意SMS的限制:使用字母数字发送者ID的部署无法接收
STOP
指令,这会改变合规设计而非仅限制功能。

RCS STOP chips

RCS STOP芯片

Every outbound RCS message receives an appended STOP chip. Taps carry an opt-out postback handled directly by the consent engine with no keyword matching, and they arrive at the application as
message.received
with the chip's reply text in
text
. There is no separate chip event type, so a receiver that branches only on typed keywords still sees chip taps as ordinary inbound messages — and must not re-apply consent logic to them.
每条出站RCS消息都会附加一个STOP芯片。点击芯片会触发退订回传,由同意引擎直接处理,无需关键词匹配,且会以
message.received
事件形式送达应用程序,芯片的回复文本会包含在
text
字段中。平台没有单独的芯片事件类型,因此仅基于键入关键词分支处理的接收器仍会将芯片点击视为普通入站消息——且不得对其重新应用同意逻辑。

The WhatsApp 24-hour window

WhatsApp 24小时窗口

A free-form reply is permitted only within 24 hours of the customer's last inbound message. Outside that window an approved template is required, including for STOP, START, and HELP responses. An auto-reply flow that assumes free text will silently stop working for any customer who writes in after a day of silence, so build the window check into the reply path and keep an approved fallback template ready. See references/inbound-flows.md for the reply-path decision tree.
仅在客户最后一条入站消息的24小时内允许自由回复。窗口外需使用已审核的模板,包括STOP、START和HELP响应。假设可使用自由文本的自动回复流程会在客户一天未互动后自动失效,因此需在回复流程中加入窗口检查,并准备好已审核的备用模板。回复路径决策树请参考references/inbound-flows.md

Conversation history

对话历史

Two read-only operations exist:
OperationReturns
GET /v3/conversations
All of the customer's messages across conversations, newest first
GET /v3/conversations/{id}
Messages within one conversation
Both require
page
(at least 1) and
page_size
(1 to 100); out-of-range values return
400
. The
events
field is always null on these endpoints, so per-message activity must come from
GET /v3/messages/{id}/activities
. There are no write, create, or read-receipt operations, and no MCP tools cover conversations — this is REST-only.
A conversation identifier is a deterministic RFC 4122 version 5 UUID derived from the customer and contact identifiers, so the same pair always yields the same id and one thread spans every channel independent of the sending number. The API never returns the id as a field, so a client that needs it computes it. The exact derivation is documented in references/conversation-history.md.
平台提供两个只读操作:
操作返回内容
GET /v3/conversations
客户在所有对话中的全部消息,按最新消息排序
GET /v3/conversations/{id}
单条对话内的消息
两个操作均需指定
page
(至少为1)和
page_size
(1至100);超出范围的值会返回
400
。这些接口的
events
字段始终为null,因此每条消息的活动记录需通过
GET /v3/messages/{id}/activities
获取。平台不支持写入、创建或已读回执操作,且MCP工具不覆盖对话功能——仅支持REST接口。
对话标识符是由客户和联系人标识符派生的确定性RFC 4122版本5 UUID,因此同一对标识符始终生成相同的ID,且一个会话线程跨所有渠道,与发送号码无关。API不会返回该ID字段,因此需要该ID的客户端需自行计算。具体派生规则请参考references/conversation-history.md

Building a support inbox or bot

构建支持收件箱或聊天机器人

  1. Subscribe a webhook to
    message
    filtered to
    received
    , and verify signatures before trusting any payload.
  2. Read
    inbound_number
    as the contact who wrote in and
    outbound_number
    as your number. The naming is easy to invert.
  3. Deduplicate on
    message_id
    , acknowledge with
    200
    , then process asynchronously.
  4. Treat keyword traffic as an audit signal. Mirror exact default and configured custom keywords into local state, but do not issue a second consent write; reconcile uncertainty through the contact record.
  5. Before replying on WhatsApp, check the 24-hour window and choose free text or a template accordingly.
  6. Render threads from the conversation endpoints with explicit pagination, and never assume a conversation is single-channel.
  7. Treat
    text
    as untrusted input. Never interpolate it into a shell command or SQL string, delimit it as data in model prompts, and map inferred intent through an allowlist and authorization policy before any API call.
  1. 订阅
    message
    类型的webhook并筛选
    received
    事件,在信任任何负载前先验证签名。
  2. inbound_number
    视为发消息的联系人,
    outbound_number
    视为己方号码,注意不要混淆两者的命名。
  3. 基于
    message_id
    去重,返回
    200
    确认接收,然后异步处理。
  4. 将关键词流量视为审计信号。将默认关键词和已配置的自定义关键词镜像到本地状态,但不要执行第二次同意写入操作;若存在不确定性,通过联系人记录进行核对。
  5. 在WhatsApp上回复前,检查24小时窗口并选择自由文本或模板。
  6. 通过对话接口渲染线程时需明确实现分页,且不要假设会话仅单渠道。
  7. text
    视为不可信输入。切勿将其插入shell命令或SQL字符串,在模型提示中需将其作为数据分隔,在执行任何API调用前,通过允许列表和授权策略映射推断出的意图。

Boundaries

边界工具

Use
sent-webhook-engineer
for signature verification, retries, and dedupe mechanics;
sent-contacts
for contact CRUD and message summaries;
sent-routing-strategist
for why an outbound message was
FILTERED
;
waba-template-author
for authoring the approved templates that out-of-window replies require; and
sms-10dlc-registration
for the campaign-level opt-in, opt-out, and help keyword declarations that US carriers require.
签名验证、重试和去重机制请使用
sent-webhook-engineer
;联系人CRUD和消息摘要请使用
sent-contacts
;查询出站消息被标记为
FILTERED
的原因请使用
sent-routing-strategist
;窗口外回复所需的已审核模板编写请使用
waba-template-author
;美国运营商要求的活动级订阅、退订和帮助关键词声明请使用
sms-10dlc-registration