#can I send text input to conversational agent over the websocket?

1 messages · Page 1 of 1 (latest)

shell reefBOT
#
AI-generated Answer for hshreeshail

Yes, you can send text input to a conversational agent over the WebSocket. To do this, you need to establish a WebSocket connection with the appropriate endpoint:

wss://api.elevenlabs.io/v1/convai/conversation?agent_id={agent_id}

Once connected, you can send a message of type conversation_initiation_client_data to configure the conversation. For example:

{
  "type": "conversation_initiation_client_data",
  "conversation_config_override": {
    "agent": {
      "prompt": {
        "prompt": "You are a helpful AI assistant."
      },
      "first_message": "Hi! How can I help you today?",
      "language": "en"
    }
  }
}

After the conversation is initiated, you can send user input (text or audio) and listen for responses from the agent. The agent's text responses will be sent as messages of type agent_response. For example:

{
  "type": "agent_response",
  "agent_response_event": {
    "agent_response": "Hello! How can I assist you today?"
  }
}

Make sure your WebSocket connection is stable and that the input data is formatted correctly. If you encounter issues, verify your setup and ensure the agent is properly configured.

soft bough
#

this does not contain information on how to send input in the form of text during the conversation