Using Data from External APIs

If you have already configured a custom integration, you can use this integration to retrieve useful information from external APIs.

Let’s say that you have your customers’ information stored in a custom CRM and that a customer calls in for an update on the status of an order. You can use the custom integration to retrieve the order status from this CRM without the intervention of an agent.

To see an example of how the custom integration can be used to provide the caller with information on the status of the order, follow the steps below:

  1. Create a new flow and open the Inbound voice component.
  2. Select the Preferences tab and add a value for the “source_phone” variable. The API we are using in this example needs to get the value as an input parameter.
  1. Use the Exits tab to route the call to a Standard IVR component. We’ve named ours “Welcome IVR”.
  2. Open this component and on the Preferences tab, choose Text to speech as the message type.
  3. Select the language in which your welcome message will be written and type it in the “Text to speech” field.
    Example: Welcome to our contact center. Please select 1 to get the status of your order.
  1. Select the Exits tab and, under “Custom Exits”, choose 1 as the key that the caller should press to get the status of the order.
  2. Enter a name for the exit (for example, “Order status”) and, under “Send to”, add an Input IVR component to gather the information being input by the user. In our example, this component is named “Get order ID”.
  3. Scroll down to the “Timeout” section to enter the number of seconds the system will wait for the caller’s value input and define a step to route the call in case the timeout is exceeded. In this scenario, we will send it again to the "Welcome IVR” to instruct the caller to input the value one more time.
  1. In the “Invalid” section, add a step to which the call should be routed in case of a value misentry. Here, we will also use “Welcome IVR”.
  2. Open the Input IVR “Get order ID”, and select Text to Speech as message type.
  3. Select the language in which the voice message will be conveyed and add it to the “Text to Speech” field.
    Example: Please add your order ID followed by #.
  4. Fill in the remaining fields of the Preferences tab with the maximum allowed number of digits and the end keypress.
  5. Under “Variables”, add a new variable - “order_id”.
  1. Go to the Exits tab and add the Execute action component under the “OK” section.
  1. Under “Timeout”, add the number of seconds and the exit that the call will take if the caller’s value input times out. In this use case, we choose to add the “Get order ID” again, to give the caller the possibility to reenter the order ID.
  2. Go to the Execute action component, which we’ve named “Get shipping details”, and open the Preferences tab.
  3. Select the name of a preconfigured connection under “Connections” and the desired action in “Actions”.
  4. Fill in the “Inputs” fields with the variables that represent the data to be sent to the external API through the HTTP request.
  5. Under “Outputs”, enter the variables that will retrieve the intended results.
  1. Open the Exits tab. Add a Play audio component to which the call will be directed when the HTTP request succeeds, and which will output the status of the order to the caller. We’ve named ours “Play order status”.
  2. Add an additional Play audio component under “Error” to route the call when the HTTP request presents an error. In this example, we use “Play no results”.
  3. Open the Preferences tab of the “Play order status” component, choose Text to speech as message type and select the audio output language.
  4. In the “Text to speech” field, enter the message that will be rendered to the caller:
    Example: This order is %{current_flow.order_status} and it is planned to arrive at your place on %{current_flow.day_of_the_week} on %{current_flow.month} %{}.
    Thank you.
  5. Repeat the process for the other Play audio component (“Play no results”), by adding a “Text to Speech” message to inform the caller that it was not possible to retrieve any results.
  6. Since in both cases, the information has been provided to the caller, the call can be terminated. To do that, go to the Exits tab of each Play audio component, and add an “End flow” component.