aiMessage

View as MarkdownOpen in Claude

Send a message to an active AI session on a call. This injects instructions or context into the AI agent’s conversation without the caller hearing the message directly.

Request

idstringRequiredformat: "uuid"
The unique identifying ID of an existing call.
paramsobjectRequired
An object of parameters that will be utilized by the active command.

Response

Call LegobjectRequired
Returned when the call is a standard PSTN, SIP, or WebRTC call.
OR
Fabric Subscriber Device LegobjectRequired

Returned when the call is a Fabric subscriber device leg. The status field is always null for this type.

Example

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
// Inject a system instruction into the AI session
await client.calling.aiMessage("call-id-xxx", {
message_text: "The caller's account has been verified. You can proceed with the transfer.",
role: "system",
});