> ## Documentation Index
> Fetch the complete documentation index at: https://www.voiceflow.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Adapt agent replies

> Keep the text reply usable in each destination.

This guide uses the [Messaging relay](/docs/guides/channels/messaging) to adapt agent replies.

## Before you begin

Start with an installed text relay, a Voiceflow agent you can edit and test customers for the destination. The supplied adapter supports plain text; a provider’s richer API does not automatically render Voiceflow trace types.

## Make the text experience complete

### 1. Build a text-first response

Have the agent ask questions in words and accept free-text answers. Link to an ordinary HTTPS page when a task needs a browser. Keep the response short enough for the destination and avoid relying on a widget card, button or image that the relay cannot display.

| Runtime result | Supplied behavior |
| --- | --- |
| `text` | Join `payload.message` strings in order; preserve paragraphs and send smaller platform-safe chunks. |
| `end` | Deliver its accompanying text, then clear the stored session key. |
| `debug`, `block`, `flow`, `path` | Treat as execution metadata, not customer text. |
| Choice, card, image, speak, hand-off or another unhandled type | Stop and pause the job; do not silently discard the required interaction. |
| No text | Pause the job so an operator can investigate. |

See [Chat agents](/docs/api-reference/agent-runtime/chat) for the runtime’s trace references. The archive’s `textResult()` is the exact allowlist, not a claim that the runtime only produces these types.

### 2. Check the platform envelope

The installed adapter owns formatting and limits. Telegram omits parse mode; Slack disables Markdown interpretation and unfurls; Teams sends `textFormat: plain`; Discord disables automatic mentions. Plain text can still contain literal Markdown characters—write the agent’s output to read naturally without markup.

LINE sends up to five chunks in one reply-token request. Discord edits the deferred original response and adds private follow-ups. Other adapters save each accepted chunk before sending the next. A partial reply can still fail; preserve its sent-part records.

Do not paste raw SSML, trace JSON or customer-supplied mention syntax into a different message contract. Keep outbound request construction in the provider adapter rather than the agent prompt.

### 3. Decide how unsupported inputs work

For a message attachment without supported text, the sample sends a short request for a text question without calling Voiceflow. It does not download arbitrary attachment URLs. Platform control events, bot echoes and unsupported event categories are filtered instead of becoming customer turns.

Adding a richer interaction requires both directions: render the returned trace, verify and map the selection event back to its supported Voiceflow action, keep the same customer/session, and test the resulting answer. File access also needs authorization, content checks and lifecycle handling. Keep that work in its platform adapter; adding an API permission alone does not complete it.

## Verify the visible result

### 1. Check short, long and non-Latin text

Ask the agent for a short answer, a paragraph with a link, and a long answer containing emoji or non-Latin text. Confirm readable paragraph boundaries, preserved code points, correct destination and an accepted reply within the platform’s deadline. Use your manual’s documented limits rather than assuming every API accepts the same length.

### 2. Check a required interaction

In a test agent, return a button/choice or other unhandled trace. Confirm the job pauses with `Unsupported trace`, instead of telling the customer that an invisible button works. Restore the text-only agent and reconcile the test job before resuming.

### The agent runs but the customer sees nothing

Inspect traces before changing provider credentials.

Check the saved `traces` and `launchTraces` privately. A speak-only or card-only answer does not contain a usable text message. Convert the agent’s response to text, or implement and validate the missing adapter before offering that interaction.

### Only the first part arrives

Check accepted chunks and platform-specific constraints.

Compare saved `sent` parts with the platform’s message IDs and failed-delivery receipts. A later rejected chunk does not undo earlier messages. Follow [Recover failed messages](/docs/guides/channels/messaging/recover-failed-messages); do not rerun the original agent turn to reconstruct an already saved answer.
