The POST /invoke endpoint allows you to create a new interaction and process it through an Interaction Plan.

Headers

Header parameters in Requests (Interactions API) apply to this endpoint.

Authorization scopes supported:

ScopeAccess granted
interactions:writeEntire endpoint

Requests

Example Request

curl -L -X POST "https://***.api.newvoicemedia.com/interactions/invoke" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Accept: application/vnd.newvoicemedia.v1+json" \
-H "Content-Type: application/json" \
--data-raw "<JSON BODY>"

Example body (Full dispatch)

{
   "provider":"ProviderName",
   "requests":[
      {
         "action":"dispatch",
         "requestid":"13141f79-79bb-4e4f-a7bc-a96f3a08d1bb",
         "externalid":"40a4b50f",
         "route":"APIRouting",
         "linkeddata":[
            {
               "type":"clid",
               "value":"Cases 40a4b50f"
            },
            {
               "type":"url",
               "label":"40a4b50f",
               "value":"https://vonage.com"
            },
            {
               "type":"name",
               "value":"Case Friendly Name"
            },
            {
               "type":"mediatype",
               "value":"Case-External"
            }
         ],
         "routingdata":{
            "interactiontype":"nonlive",
            "personalqueue":{
               "agent":"AgentUsername",
               "loggedintimeout":20,
               "loggedouttimeout":30
            },
            "skills":[
               {
                  "name":"skillOptional",
                  "expiryafter":0
               },
               {
                  "name":"skillExpiring",
                  "expiryafter":60
               },
               {
                  "name":"skillMandatory"
               }
            ]
         }
      }
   ]
}

Dispatching and interaction with interaction properties to send an SMS

The SendSMS Interaction plan must be configured to use these properties within a Send SMS applet.


{
  "requests":
  [
    {
      "route": "SendSMS",
      "linkeddata":
      [
        {"type": "interactionproperty", "key": "ToNum", "value": "07700936658"},
        {"type": "interactionproperty", "key": "FromNum", "value": "0654321"},
        {"type": "interactionproperty", "key": "Message", "value": "Hello!"}
      ]
    }
  ]
}

In some applets you will need to specify an additional property from a list of data sources. If the data source name contains spaces, we cannot guarantee success when you use an interactionproperty to set the value. Wherever possible, instead of setting the value of that data source using an interactionproperty in the request, use a Data Connector applet in your interaction plan to set the value.

Dispatching a case with a registered provider

{
    "provider": "CrmIntegration",
    "requests":
    [
        {
            "action": "dispatch",
            "requestid": "8762187187",
            "externalid": "ObjectId_001",
            "route": "CrmCallRouting",
            "linkeddata":
            [
                {"type": "clid", "value": "+44123456789"},
                {"type": "url", "label": "Click me", "value": "https://developer.newvoicemedia.com"}
            ],
            "routingdata":
            {
                "interactiontype" : "nonlive"
            }
        }
    ]
}

Dispatching a case with preset skills

{
    "provider": "CrmIntegration",
    "requests":
    [
        {
            "action": "dispatch",
            "requestid": "8762187187",
            "externalid": "ObjectId_001",
            "route": "CrmCallRouting",
            "linkeddata":
            [
                {"type": "clid", "value": "+44123456789"},
                {"type": "url", "label": "Click me", "value": "https://developer.newvoicemedia.com"}
            ],
            "routingdata":
            {
                "interactiontype" : "nonlive",
                "skills":
                [
                    {"name": "skillOptional", "expiryafter": 0},
                    {"name": "skillExpiring", "expiryafter": 60},
                    {"name": "skillMandatory"}
                ]
            }
        }
    ]
}

Dispatching a case tagged with personal queue

{
    "provider": "CrmIntegration",
    "requests":
    [
        {
            "action": "dispatch",
            "requestid": "8762187187",
            "externalid": "ObjectId_001",
            "route": "CrmCallRouting",
            "linkeddata":
            [
                {"type": "clid", "value": "+44123456789"},
                {"type": "url", "label": "Click me", "value": "https://developer.newvoicemedia.com"}
            ],
            "routingdata":
            {
                "interactiontype" : "nonlive",
                "personalqueue":
                {
                    "agent": "AgentUsername",
                    "loggedintimeout": 20,
                    "loggedouttimeout": 30
                }
            }
        }
    ]
}

Releasing interaction from the system

{
    "requests":
    [
        {
            "action": "release",
            "requestid": "8762187190",
            "externalid": "ObjectId_001"
        }
    ]
}

Responses

Successful response

Successful requests return a 200 Success code and an empty array:

[]

Failed response

Failed requests return a 200 Success code and and an array entry for every requestId that failed:

[
    "8762187190"
]