NAV
message

SmartRouting WebHooks

This document describes Enreach SmartRouting webhook implementation, providing possibility to implement advanced callcontrol based on external logic.

Simply put, SmartRouting webhooks send a HTTPS POST request to predefined URL for each incoming call. The request contains JSON data providing information about the call. Receiving party is expected to respond with JSON data containing routing instructions for the call.

Some possible use scenarios include:

Example use case

Business need:

External CRM system holds information of VIP customers. When VIP customer calls to service, calls should be routed to a separate ‘VIP service queue’, which has higher priority than the normal service queue. If the caller is not recognized as a VIP, the call will be handled in a normal service queue.

Solution:

Smartrouting

Configuration

Smartrouting can be configured to any EnreachVoice service queue or IVR queue.

Smartrouting configuration is done by Enreach support.

Endpoint implementation

Endpoint requirements

SmartRouting Request

Example SmartRouting request

POST /your-path
X-Benemen-APIKey: 1234
Content-Type: application/json

{ 
  "anum": "+358501231234", 
  "bnum": "+4612312345", 
  "targetid": "SALES_QUEUE" 
}

Authentication

Smartrouting webhook request can use either API Key or HTTP Basic Authentication for authentication.

API Key

If using API key method, additiona header X-Benemen-APIKey is included in the request, containing the API key value.

HTTP Basic Authentication

If using HTTP Basic Authentication, the request contains Authorization header with value Basic <base64(username:password)>

Request body

SmartRouting Response

Status code

Endpoint should respond with 200 OK status code only, if enfpoint can provide routing instructions for the call, which differs from default routing.

For example in Example use case, if the caller is recognized as a VIP customer like in , the endpoint should respond with 200 OK and routing instructions for the call. If the caller is not recognized, the endpoint should respond with 204 No Content, which means that the call will be handled normally.

Error codes should be reserved for proper error situations.

StatusCode Description Call Contorl
200 OK Caller recognized, special routing instructions included Call is routed according to the routing instructions
204 No Content Caller not recognized Call is routed according default configuration
4xx,5xx Errors Error Call is routed according default configuration

Response content

Response content must be JSON formatted.

Response header must have Content-Type: application/json

Only set the properties you want to touch, do not set your own defaults

See Example responses for some example scenarios.

Response body properties

Key Type Values Description
InitialTarget string <any-target>/DISCONNECT: Forward the call to another location (queue, user) for handling or disconnect the call. To disconnect call, return "DISCONNECT:". If empty, no direct forwarding is performed.
FailTarget string <any-target> If the call would overflow from the initial target, override the default target with this. For example, if the initial target is a user and they do not answer, redirect to some specific queue.
RequiredTarget string <user-target> Primary agent who is required to be present in the targeted queue to handle the call. If the agent is currently unavailable, but potentially becomes available within the timeout period (10 seconds default), the caller waits until the timeout expires. Only applies if InitialTarget is a queue.
AllocationTargets List List of <user-target> Agents that should be preferred in allocation. Non-blocking - if the agents are not available, other agents are chosen instead. Only applies if InitialTarget is a queue.
Priority int Integer from 0 to 10000 Priority for the call (e.g., for VIP customers). Bigger value is better: makes the call that many seconds "older" in allocation processing. Setting this value overrides the default priority configured for the queues. Only set this if you really want to override and do have the values coordinated with queue configurations.
ExtraPriority int Integer from -10000 to 10000 Extra priority for the call (e.g., for VIP customers). Bigger value is better: makes the call that many seconds "older" in allocation processing. This is the new preferred way of boosting (or reducing) call priority without overriding the priority set by the routing core, typically with service queue configuration. Both priorities are added for the composite priority value.
CustomTTS string TTS prompt definition Advanced. When this value is provided, the TTS prompt is played forcibly as the next transfer or mandatory prompt. Must be orchestrated with the other configuration! Language can be specified by .NET Culture code in brackets.
CustomMSI string MSI (dynamic billing) configuration Advanced: This value must be orchestrated with other MSI configuration. See separate documentation. <MSI tag>,<validFor>[,<action>,<re-entrant>]

Legend

Example responses

Below are some common scenarios and example responses for them.

Example response: Route to a specific target number

{
  "InitialTarget": "+358123456789"
}

Route call to the target number

Example response: Text-to-speech message and route call

{
  "InitialTarget": "cd1258fb-0aae-4159-ba9e-41c57c69c398",
  "CustomTTS": "[en-GB] Greetings caller. [fi-FI] Tervehdys soittaja"
}

Play text-to-speech message to caller in English and in Finnish, then route to specific queue by QueueId

Example response: Text-to-speech and disconnect

{
  "InitialTarget": "DISCONNECT:",
  "CustomTTS": "This call will be disconnected, sorry about that"
}

Play text-to-speech message to the caller, then disconnect the call

Example response: Required agent

{
  "InitialTarget":"+358123456789",
  "RequiredTarget":"agent1@customer.com"
}

Route to a specific queue and require a specific agent to handle the call.

If teh agent is currently on a call or i a wrap up state, the call will wait for a configured timeout period (default 10s) until the agent becomes available or the timeout expires.

If the agent is not available, the call will overflow based on queue configuration.

Example response: Preferred agents

{
  "InitialTarget": "+358123456789",
  "AllocationTargets": [
    "agent1@customer.com", 
    "agent2@customer.com"
  ]
}

Route call to a specific queue, have one of the preferred agents handle the call.

If the preferred agents are not available for immediate allocation, the call will be allocated to other agents.

Example response: Override priority

{
  "Priority": 10000
}

Make the call high priority overriding the QueuePriority configured for the service queue

Example response: Add extra priority

{
  "ExtraPriority": 100
}

Make the call high priority by setting call-specific ExtraPriority.

Total priority of the call will be QueuePriority + ExtraPriority