Making an Outbound Call to Collect Response

In this section, you will be acquainted with how to start sending voice calls on a particular caller ID.


For more information on how to create a Voice Application, which is necessary for this context, refer to the guide - Getting Started with Unifonic

To make an outbound call to collect a response

  1. Plan out your IVR Flow.
  1. Send a Voice Call via API.
curl --location --request POST '' \
--header 'AppsId: 'XXXXXXXXXXXXX'\
--header 'Content-Type: application/json' \
	"type" : "ivr",
	"callerId" : "+966115219086",
        "language" : "english",
	    	"voice" : "male",
        "say":"Did you like our service? Press 1 to say yes. Press 2 to say yes.",
        "onEmptyResponse":"We did not receive your response. Good bye.",


In this code sample, we will play a TTS recording of the content specified in the said parameter. and collect a response which will be sent to this responseUrl.
The responseUrl should be a POST API with no Authorization required. If the parameter speechCollectionLanguage is present, then it represents that you would like to collect a response via user speech. If this parameter is not present, then the response collection activity will be done by DTMF.

  1. POST/responseUrl
    Note that not every field in this code sample will be present. If your response collection activity is speech, there will be confidence level and speechResult sent to the responseUrl. Otherwise, it will just be digits. Recipients and callerId will always be sent so that you are able to map a user response to a user.


What if I want to receive a ID or referenceId to map a DTMF response collection in my system?

You would simply just add a query in your responseUrl. For example:**referenceId=123456789**

This referenceId would then be included when we post the DTMF response to you.

Below is a sample of the payload we will send to your responseUrl.

“confidence”:0.6, //refers to accuracy of this speech recognition activity
“digits”: “1”,
“recipient”: “+966XXXXXXXXX”,
“callerId”: “+966XXXXXXXXX”
  1. Provide us with a response to this POST request
    A response is required as it tells us what is the next IVR instruction after you have analyzed the IVR response. It can be a simple thank you, which will then result in a call hang-up. Or, you can conduct another response collection activity by simply providing another responseUrl.
  "say":"thank you",
  1. Host the APIs on your API Server and expose it to your inbound voice application on the Unifonic Console.

Alternatively, you can skip past all of these and simply make use of the Unifonic Flow Studio to create a flow and be provided with a URL that you can use as the responseUrl in the payload.