Overview

Using the Interactions API’s Invoke action you can invoke interaction flows through one or more named routes within VCC. You can invoke an interaction flow through any interaction plan that you have configured in VCC’s Interaction Architect. Depending on the configuration of your interaction plan, you can perform a wide variety of tasks, such as:

You can route an interaction with or without registering a provider first. If you register a provider, you can permit or restrict agent actions on an associated interaction or interactions, and, optionally, VCC can send notifications back to an API when an agent performs permitted actions. For information about registering a provider and using that provider when routing interactions, see How to register a provider and route interactions using the Interactions API.

Setting up your named route and applet in the VCC Admin Portal

Without a named route, you’ve got nothing to invoke, so your first task is to set up a named route, interaction plan and one or more applets using Interaction Architect in the VCC Admin Portal. For information about using Interaction Architect to create named routes and interaction plans, see Interaction Plans Architect.

What is a named route/interaction plan/applet?

You can think of a named route as the address of an interaction plan. Without an address, your request wouldn’t know where to go.

An interaction plan is a collection of one of more applets that contain the description of what to do with your request. When your request reaches the target named route, it goes to the plan’s initial applet.

The applet or applets in your interaction plan determine what happens when your request travels through the interaction plan. In this example, the applet in your interaction plan routes an interaction to an agent.

Example named route

In the following example, there is just one named route Route Interaction NR. The Route Interaction NR named route has one applet, Route Interaction applet, which is an Automatic Call Distributor (ACD) applet in skills based routing (or UCD) mode. The Route Interaction applet is set as the initial applet.

Route Interaction Named Route

Example applet

In the following example, the Route Interaction applet routes the interaction to the agent who has been waiting longest. In a more complex interaction plan, configured skills and service level agreements, and other settings in the ACD applet, would also affect the routing.

For more information about the ACD applet, see Automatic Call Distributor (ACD) or Universal Contact Distributor (UCD) applet.

Route Interaction Applet

Preparing your request

Right, so you know how to use VCC APIs, and you’ve got your interaction plan set up in the VCC Admin Portal… Finally you can get started with using the Interactions API.

Currently there are just two actions in the Interactions API: Invoke and Register. We can ignore the Register action at this point. The Invoke action’s endpoint—POST /Invoke—invokes an interaction plan, located using the named route you specify.

Request URL

The format for the POST /Invoke request URL is:

https://***.api.newvoicemedia.com/interactions/Invoke

Request parameters

The POST /Invoke endpoint requires the following parameters:

Invocation object

The Invocation is a JSON object that contains two properties:

Using the example above, provide the following information in your Interaction object:

PropertyValue
actiondispatch
routeRoute Interaction NR
requestiduniqueRequestId
externalidsourceObjectName
interactiontype (within routingdata)nonlive

Example Invocation object

{
  "requests":
  	[
  		{
  		"action": "dispatch",
  		"requestid": "uniqueRequestId",
  		"externalid": "sourceObjectName",
  		"route": "Route Interaction NR",
  		"routingdata":
  			{
  			"interactiontype" : "nonlive"
  			}
  		}
  	]
}

Putting it all together

Using a tool for making API requests, send the required parameters in your request.

Example request

The bearer access token has been replaced with <access_token>.

curl
  -X POST
  -H "accept: application/vnd.newvoicemedia.v1+json"
  -H "authorization: Bearer <access_token>"
  -H "content-type: application/json"
  -d '{
    "requests":
    	[
    		{
    		"action": "dispatch",
    		"requestid": "uniqueRequestId",
    		"externalid": "sourceObjectName",
    		"route": "Route Interaction NR",
    		"routingdata":
    			{
    			"interactiontype" : "nonlive"
    			}
    		}
    	]
    }'
  "https://***.api.newvoicemedia.com/interactions/Invoke"

This example sends a request to the /Invoke end point, passing in the required headers and the Invocation object. The object contains a single Interaction object. The request invokes the interaction plan that contains just the Route Interaction applet applet. The Route Interaction applet assigns a nonlive interaction defined in the Interaction object to the longest waiting agent.

If our request is successful, we will receive a 200 Success response.

Because we provided a value in externalid, we can later send a second POST /Invoke request to release the interaction. See How to release an existing interaction using the Interactions API to find out how to release the interaction.