Making an Outgoing Voice Call to Send an OTP

In this section, you will be acquainted with making an Outgoing call which could be achieved by using Unifonic Voice APIs.

curl --location --request POST 'https://voice.unifonic.com/v1/calls' \
--header 'AppsId: 'XXXXXXXXXXXXX'\
--header 'Content-Type: application/json' \
{
	"recipient":["+966111111111"],
	"type" : "otp",
	"callerId" : "+966115219232",
	"otp":{
		"language":"english",
		"code" : "1111",
		"loop" : "2",
		"audioUrl" : "https://audiofiles111.s3.ap-southeast-1.amazonaws.com/otp.wav"
	}
}

📘

This is a sample payload that creates a phone call to the recipient +966111111111 and plays an OTP notification.

{
    "status": "Request has been sent.",
    "callId": "1c9ebf6a-dd62-4c49-b0b3-c1b1494e01f1"
}
  • Once an API attempt is accepted, an API response will be returned.

📘

How do I know if the call has taken place?

Each call status can be tracked via a Webhook