Skip to main content

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 sendAIAssistantMessage method 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

  1. Validate Input: Always check that messages are not empty before sending
  2. Check Call State: Verify an active AI call exists before sending messages
  3. User Feedback: Provide visual feedback when messages are sent
  4. Error Handling: Handle network errors and call state issues gracefully
  5. UI Updates: Update the conversation UI immediately for better user experience

Integration with Transcript Updates

Text messages will appear in the transcript flow:
This feature enables rich conversational experiences where users can seamlessly switch between voice and text communication with the AI Assistant.