rpcAiMessage
Send a message, global data, or both to the AI agent running on another call. Useful for cross-call coordination, such as notifying a held caller’s agent about a status change.
The two payloads behave differently. messageText lands as a turn in the other
agent’s conversation, where it competes with everything else arriving at that
moment. globalData is merged into the other call’s global data, where it stays
silent until a prompt expands it with ${global_data.your_key}, so data is the
better channel for content a later step needs to say. To send data only, use
rpcAiGlobalData().
Parameters
callId
Call ID of the target call whose AI agent should receive the message.
messageText
The message text to inject into the target AI’s conversation.
role
Role for the injected message, sent with the message. Typically "system" for
instructions.
globalData
Object merged into the target call’s global data.
Throws an Error when neither messageText nor globalData is given.
Returns
FunctionResult — this, for chaining.