Vonage AI Studio
  • Welcome to AI Studio!
  • ✨Platform Updates
  • AI Studio
    • Create a new agent
    • NLU AI Engine - Traditional vs Hybrid
    • Agent Building Features
    • Agent Templates
      • Take Message
      • Updating Details
      • Survey
      • FAQ
      • Package Tracking
      • Caller Identification
      • Customer Service
      • Hotels
      • Appointment Management
    • Tester
    • Editor Mode & Publish
    • Reports
    • Users
    • Knowledge AI
  • Properties
    • Entities
      • System Entities List
      • Best Practices
    • Intents
      • How do we analyze user input?
      • Generate Training Data
      • System Intents
      • Intent Annotation
    • Parameters
    • Contacts
    • Tags
    • Recordings
  • Voice
    • Get started
      • Create your first conversational flow!
      • Triggering Outbound Call API
      • Sending an Outbound Call Request via Postman
      • Integration via SIP for Telephony Agents
    • Nodes
      • Start node
      • Conversation
        • Classification
          • Intent Ambiguity
        • Collect Input
          • Entity Ambiguation
        • Speak
        • Conditions
        • Listen
        • Q&A Node
      • Advanced
        • Reset Counter
        • Counter
        • Set Parameter
        • Custom Code
        • NCCO Node
      • Actions
        • Send Email
        • Call Routing
        • End Call
        • Start Recording
        • Stop Recording
        • Send SMS
      • Integrations
        • Webhook
        • Legacy SalesForce Authentication Node
          • SalesForce Authentication
            • How to create a SalesForce Connected App
        • SalesForce Actions
        • Generative AI
          • Setting up Generative AI Node Integration
          • Migrating from the GenAI node to Knowledge AI
      • Flow Control
        • Context Switch
        • Flows
    • Events
  • WhatsApp
    • Get started
      • Create your first conversational flow!
      • Triggering an outbound WhatsApp virtual agent
    • Nodes
      • Start node
      • Conversation
        • Collect Input
          • Entity Ambiguation
        • Classification
          • Intent Ambiguity
        • Send Message
        • Conditions
      • Advanced
        • Reset Counter
        • Counter
        • Set Parameter
        • Custom Code
      • Actions
        • Send Email
        • End Conversation
        • Send SMS
        • Live Agent Routing
      • Integrations
        • Webhook
        • Legacy SalesForce Authentication Node
          • SalesForce Authentication
            • How to create a SalesForce Connected App
        • SalesForce Actions
        • Generative AI
          • Setting up Generative AI Node Integration
          • Endless FAQs on WhatsApp With Generative AI and AI Studio
      • Flow Control
        • Context Switch
        • Flows
    • Events
  • SMS
    • Get started
      • Create your first conversational flow!
      • Triggering an outbound SMS Virtual Agent
    • Nodes
      • Start node
      • Conversation
        • Classification
          • Intent Ambiguity
        • Conditions
        • Send Message
        • Collect Input
          • Entity Ambiguation
      • Advanced
        • Reset Counter
        • Counter
        • Set Parameter
        • Custom Code
      • Actions
        • Send Email
        • End Conversation
        • Send SMS
        • Live Agent Routing
      • Integrations
        • Webhook
        • Legacy SalesForce Authentication Node
          • SalesForce Authentication
            • How to create a SalesForce Connected App
        • SalesForce Actions
        • Generative AI
          • Setting up Generative AI Node Integration
          • Use Case Example: Gym Business
      • Flow Control
        • Context Switch
        • Flows
    • Events
  • HTTP
    • Get started
      • Create your first conversational flow!
    • Nodes
      • Start node
      • Conversation
        • Classification
          • Intent Ambiguity
        • Collect Input
          • Entity Ambiguation
        • Send Message
        • Conditions
      • Advanced
        • Reset Counter
        • Counter
        • Set Parameter
        • Custom Code
      • Action
        • Send Email
        • Send SMS
        • Live Agent Routing
          • Websockets connections for Live agent Routing
      • Integrations
        • Webhook
        • Legacy SalesForce Authentication Node
          • SalesForce Authentication
            • How to create a SalesForce Connected App
        • SalesForce Actions
        • Generative AI
          • Setting up Generative AI Node Integration
          • Use case Example : Online Shopping
      • Flow Control
        • Context Switch
        • Flows
    • Events
  • API Integration
    • Authentication
    • Insights
  • There's more
    • FAQs
    • Languages Available
Powered by GitBook
On this page

Was this helpful?

  1. HTTP
  2. Nodes
  3. Action
  4. Live Agent Routing

Websockets connections for Live agent Routing

The WebSocket protocol is an event driven API that enables two-way communication over a single, persistent, low latency TCP connection without the overhead of HTTP request/response. This can be referred to as a full duplex connection.

HTTP agents now have the ability to maintain WebSocket connections. This means that as long as WebSocket communication is set up, any client can directly interact with your HTTP Virtual Agent.

This allows you to enjoy the benefits of asynchronous flows, such as using the live agent node to route the conversation from a virtual agent to a human agent

WebSocket Protocol is currently the only means of connecting your HTTP virtual agent to a live agent.

HTTP agents can support both synchronous (HTTP request/response) and asynchronous (WebSockets) communication and should work without any additional changes. However the means of communication is dependent on the way the client is set up to communicate with the virtual agent.

Working with WebSockets

Communication with virtual agents using WebSockets is similar to HTTP requests.

Before you connect your client app using WebSockets to your Virtual agent, you will need to send an init HTTP request, which is the same init endpoint as the HTTP request/response use case.

For EU based agents: https://studio-api-eu.ai.vonage.com/http/init

For US based agent: https://studio-api-us.ai.vonage.com/http/init

You need to use your X-Vgai-Key to authenticate.

The body of the request looks as follows:-

{
“agent_id”: “string”
}

The response received will be as follows:-

{
"session_id": "string",
"session_start_time": "Timestemp",
"session_expiration_time": "Timestamp",
"session_token": "token"
}

The “session_token” is valid only for interacting with a single session. If the token is attempted to be used for other sessions you will receive an invalid response.

We recommend running the init request on your server side, so that your X-Vgai-Key is not exposed to your client.

Once you get the session_token, you can connect using any WebSockets client you choose to the studio and interact with your Virtual Agent.

You can then use the following region specific WebSockets URLs:-

EU: wss://http-sockets-eu-central-1.ai.vonage.com

US: wss://http-sockets-us-east-1.ai.vonage.com

The message syntax should be as follows:

{
“action”: “step”,
“input “: “your input”
}

When does the WebSocket communication disconnect?

  1. When the client closes the connection

  2. When session has ended in either of the following cases:-

    1. Due to the flow ending.

    2. Due to the session running for more than 24 hours.

  3. After 10 minutes of idle time.

PreviousLive Agent RoutingNextIntegrations

Last updated 1 year ago

Was this helpful?