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:
- Create a new flow and open the Inbound voice component.
- 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.
- Use the Exits tab to route the call to a Standard IVR component. We’ve named ours “Welcome IVR”.
- Open this component and on the Preferences tab, choose Text to speech as the message type.
- 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.
- 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.
- 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”.
- 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.
- 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”.
- Open the Input IVR “Get order ID”, and select Text to Speech as message type.
- 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 #. - Fill in the remaining fields of the Preferences tab with the maximum allowed number of digits and the end keypress.
- Under “Variables”, add a new variable - “order_id”.
- Go to the Exits tab and add the Execute action component under the “OK” section.
- 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.
- Go to the Execute action component, which we’ve named “Get shipping details”, and open the Preferences tab.
- Select the name of a preconfigured connection under “Connections” and the desired action in “Actions”.
- Fill in the “Inputs” fields with the variables that represent the data to be sent to the external API through the HTTP request.
- Under “Outputs”, enter the variables that will retrieve the intended results.
- 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”.
- 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”.
- Open the Preferences tab of the “Play order status” component, choose Text to speech as message type and select the audio output language.
- 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} %{current_flow.day}.
Thank you. - 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.
- 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.
Updated about 1 year ago