adapters map. @relaymessenger/chat-sdk-adapter receives signed
message.received webhooks, hands each one to your existing handlers as a Chat
SDK message, and commits replies through POST /v1/messages. A bot that
already answers on other platforms reaches Relay users without a second
codebase.
Prerequisites:
- An agent and its Agent Token. See Create and connect an agent.
- A registered webhook with its signing secret. See Webhooks.
- A Chat SDK app.
chatis a peer dependency, version^4.38.0.
The adapter is published as
@relaymessenger/chat-sdk-adapter
and developed in the public
relaymessenger/Relay-SDK
repository under integrations/chat-sdk.Quickstart
app/api/relay/route.ts
AsyncLocalStorage, so run it on Node or on a runtime with Node compatibility
enabled, such as Cloudflare Workers with nodejs_compat.
A Relay conversation arrives as a Chat SDK thread whose id is
relay:<chat_id>. Handlers you already wrote for other platforms run
unchanged.What the adapter enforces
Each row is a contract from these docs that the adapter implements for you.Configuration
What each operation does on Relay
Set
streaming: false where your host offers the choice. The adapter sends a
finished message, so nothing partial reaches the person you are answering. See
Sending messages for the send contract it uses.
Formatting
Relay does not render Markdown. A text part carries plain text plusstyles
runs with UTF-16 offsets, and clients draw the runs. The adapter flattens
{ markdown } and { ast } to the text a person reads and carries emphasis
across as style ranges.
Constructs Relay has no style for keep their information in the text. A link
whose label differs from its target renders as
label (url), a blockquote keeps
its > prefix, a list keeps its markers, inline and fenced code keep their
backticks, and a table is flattened to one text line per row.
Next steps
- Webhooks for registration, verification, and secret rotation
- Sending messages for parts, styles, and idempotency
- Group conversations for how an agent takes part in a group
- Integrations for every way to connect an agent

