Sending Text Messages to AI Agents
Overview
In addition to voice conversation, you can send text messages directly to the AI Agent during an active call. This allows for mixed-mode communication where users can both speak and type messages to the AI Assistant.Method Signature
Call object during an active AI Assistant conversation.
Parameters
message(String): The text message to send to the AI Agentbase64Image(String?, optional): A base64 encoded image string for vision-capable AI models
base64Image parameter accepts either:
- A complete data URL format:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ... - A raw base64 string (will be automatically formatted as JPEG):
/9j/4AAQSkZJRgABAQAAAQ...
Basic Usage
Getting the Active Call
Important Notes
- AI Assistant Only: The
sendConversationMessagemethod is only available during AI Assistant conversations - Transcript Integration: Text messages sent this way will appear in the transcript updates alongside spoken conversation
- Processing: The AI Agent will process and respond to text messages just like spoken input
- Active Call Required: You must have an active call established before sending text messages
- Real-time: Messages are sent in real-time and will be processed immediately by the AI agent
- Vision Models: Base64 image support requires vision-capable AI models to be configured in your AI Assistant
- Image Formats: Supported image formats include JPEG, PNG, GIF, and WebP
- Image Size: Consider image file size and compression for optimal performance
- Multimodal: You can send text and images together, or send images without text for pure visual analysis
Troubleshooting
Message Not Sent
If messages aren’t being sent:- Verify the call is active (
call.callState.isActive) - Check that you’re in an AI Assistant conversation (after
anonymousLogin) - Ensure the call object is not null
- Verify network connectivity
Messages Not Appearing in Transcript
If sent messages don’t appear in the transcript:- Confirm
onTranscriptUpdatecallback is properly set - Check that the message was successfully sent
- Wait a moment for the transcript to update
Next Steps
- Learn about transcript updates to handle responses