Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_ExcerptVirtualAssistant
_ExcerptVirtualAssistant
nopaneltrue

...

  1. Get an API key for Vonage AI API. Ask Vonage to store this key in a custom configuration value for your account. For information about getting an API key for Vonage AI API, see Vonage AI Studio authentication.
  2. Create a virtual agent and configure the agent's conversation. Save the agent's ID and virtual number to use later. For information about creating a virtual agent, see Create a new Vonage AI Studio agent.
  3. Make a note of response parameters that your virtual agent can return. For information about response parameters, see Vonage AI Studio parameters.

The following visualization shows an interaction plan that routes interactions to a virtual agent, and collects data about the interaction:

...

Code Block
languagexml
titleInteraction Definition
<ApiInteraction>
  <Request>
<!--Replace *** with the root of the URL of the Vonage AI API-->
    <Url>https://***/flow/init</Url>
    <Method>POST</Method>
    <Headers>
      <Header>
<!--Include the API key for the Vonage AI API. Hardcode the key or store the value in a custom configuration value or data source. This example uses a custom configuration value.-->
        <Key>X-Vgai-Key</Key>
        <Value>#(api_key)</Value>
      </Header>
    </Headers>
    <Body>
<!--Include the ID of the virtual agent using this session. Hardcode the key or store the value in a data source. This example hardcodes the value.-->
<!--Include the type of event. In all cases, hardcode event to 'inbound _call'.-->
        <![CDATA[
        {
          "agent_id": "65d9634bf3a2412eb16e7adf",
          "event": "inbound _call"
        }      
        ]]>
    </Body>
  </Request>
  <Response>
    <Type>JSON</Type>
    <ResponseCodeDestination>CreateSessionResponseCode</ResponseCodeDestination>
    <Fields>
<!--Store session_id and session_start_time from response in SessionId and SessionStartTime data sources.-->
      <Field>
        <Locator>session_id</Locator>
        <Destination>SessionId</Destination>
        <DataType>string</DataType>
      </Field>
      <Field>
        <Locator>session_start_time</Locator>
        <Destination>SessionStartTime</Destination>
        <DataType>string</DataType>
      </Field>
    </Fields>
  </Response>
</ApiInteraction>

...

Code Block
languagexml
titleCaller Name
<Body>
<!--Include required and optional parameters in the body element.-->
  <![CDATA[ 
    {
      "agent_id": "65d9634bf3a2412eb16e7adf",
      "event": "inbound _call",
      "parameters": [
    {
      "name": "CALLER_NAME",
      "value": "$(Name)"
    }
  ] 
  }
]]></Body>

...