Skip to main content

A reply sends a message back into the conversation. Agents can reply with plain text, markdown with files, or interactive cards, depending on provider capabilities.

Interactive cards include buttons, dropdowns, links, and text inputs. When a user interacts with a card, the onAction handler fires with the action ID and selected value.

Use replies when the agent needs to communicate something to the participant in the conversation.

Replies are user-facing messages your agent sends back into the conversation. Use signals when you need to update conversation state, trigger workflows, or resolve the thread without messaging the user. Use ctx.emit when your client needs a named payload during the turn.

The public API is ctx.reply(content, options?). You can also return a string or JSX card from a handler instead of calling ctx.reply() directly.

To send a reply from your backend without going through the bridge handler, use the Send an agent reply API.

Channel support#

CapabilitySlackTeamsWhatsAppTelegramEmail
Plain / rich textYesYesBold / italicsYesHTML
Tap-to-respond buttonsYesYesYes (up to 3)YesAction links
Outbound file attachmentsYesYesNot yetNot yetNot yet
Quote replyPlain postPlain postNativeNative—

See Channels overview for the full matrix.

Reply types#

The following table summarizes the reply types your agent can send:

TypeContentAttachmentsUser interaction
Plain textStringVia options.filesNone
MarkdownString with markdownVia options.filesNone
Interactive cardsCard and child componentsNot on cardsButtons, dropdowns, links, inputs trigger onAction

To change a message after you send it, see Edit sent messages.

Plain text#

Send a simple string reply with ctx.reply():

Markdown#

Send formatted text by passing a markdown string to ctx.reply():

Quote reply#

Pass quoteReply to pin the reply to a specific inbound message. WhatsApp and Telegram render a native quote. Other channels send a normal post.

Stream a reply#

Pass an async iterable of text, such as an AI SDK textStream, to send the reply as it is generated. ctx.reply() resolves once the stream ends. You can also return the stream from a handler.

Slack, Telegram, and Web Chat show the reply as it is written. Other channels receive it once the stream ends. The AI SDK and LangChain adapters stream returned results for you.

Sending attachments#

Include files with string or markdown replies via the optional second argument.

Note

Outbound file attachments are delivered on Slack and Microsoft Teams. WhatsApp, Telegram, and email do not support outbound files yet. See Channels overview.

When sending attachments, keep these limits in mind:

  • Attachments are limited to 25 MB per file.
  • Files are only supported with string or markdown replies, not card replies.
  • Provide each file with exactly one of url or data.
  • Prefer url for larger files. Inline data is capped at 5 MB per file (and 5 MB aggregate per message).

File reference type#

Each file uses a FileRef object with the following shape:

Use url for larger files. Novu fetches public HTTP(S) URLs server-side. Use data for small generated files in memory.

The following examples show both approaches:

Interactive cards#

Cards are structured messages with buttons, dropdowns, links, and more. Build them with function calls or JSX.

The following example builds a card with the function call API:

When a user clicks a button or selects a dropdown value, onAction fires with action.id and action.value. See Handlers and context. On Web Chat, the same tree arrives as a card part. The web UI draws it and calls sendAction.

Available card components#

The following table lists the card components you can use in replies:

ComponentDescription
CardContainer with an optional title
CardTextText block inside a card
ButtonInteractive button; id maps to action.id in onAction
LinkButtonButton that opens a URL; goes inside Actions
ActionsRequired wrapper around Button and LinkButton elements
Select / SelectOptionDropdown; triggers onAction with selected value
DividerVisual separator
CardLinkInline clickable link
TableStructured data table with headers and rows
ChartBar, line, area, or pie chart
TextInputText input field

All components are exported from @novu/framework (and from @novu/framework/cards and every server entrypoint), so you do not need to install a separate package. Each one works in both the function call API and the JSX API.

Table, Chart, and LinkButton render structured content inside a card. On channels with native support (such as Slack), they map to the platform’s rich blocks; on others they fall back to plain text.

  • Table takes headers (column labels) and rows (an array of cell-string arrays). Optional caption labels the table, and pageSize sets rows per page on channels that paginate (Slack: 1-100, default 5).
  • Chart takes a title and a chart definition. Use type: 'bar' | 'line' | 'area' with categories and series, or type: 'pie' with segments. On Slack the title is capped at 50 characters, and series and categories are capped at 12.
  • LinkButton renders a button that opens a url, unlike CardLink, which renders an inline link. Place it inside Actions.
Note

On Slack, Table ignores per-column align. A chart or table that exceeds the platform limits falls back to a plain-text section.