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
Parameters
Basic Usage
Complete Example
Advanced Usage with Call State Checking
UI Integration Example
Message Types and Formatting
Error Handling
Important Notes
- Active Call Required: You must have an active call established before sending text messages
- AI Assistant Only: The
sendAIAssistantMessagemethod is only available during AI Assistant conversations - Transcript Integration: Text messages sent this way will appear in transcript updates alongside spoken conversation
- Processing: The AI Agent will process and respond to text messages just like spoken input
- Mixed Communication: Users can seamlessly switch between voice and text communication
Best Practices
- Validate Input: Always check that messages are not empty before sending
- Check Call State: Verify an active AI call exists before sending messages
- User Feedback: Provide visual feedback when messages are sent
- Error Handling: Handle network errors and call state issues gracefully
- UI Updates: Update the conversation UI immediately for better user experience