Overview
sendMessage sends a message from the View into the host’s chat interface, appearing as if the user typed it. This enables the app to drive the conversation — for example, submitting a user selection, asking a follow-up question, or triggering the model to act on data displayed in the UI.
The message is always sent with role: "user". The host may reject the message (for example, if sending is rate-limited or disabled), in which case isError will be true in the response.
Signature
Parameters
Optional request configuration.
An
AbortSignal to cancel the request.Returns
true if the host rejected the message. When absent or false, the message was accepted.Usage
Send a text message
Send a message based on user interaction
Combine with updateModelContext for large payloads
When you need to send a large amount of data along with a message, offload the data to model context first, then send a brief trigger message:Related
- Requests overview — all available View-to-host request methods
useSendMessage— sunpeak React convenience hook- updateModelContext — set model context without triggering a response