Sending Multiple IVR Objects in a single request

As it turns out, having a singular say or play is not sufficient in conveying your message. We heard you.

In this article, you will be acquainted with the payload that allows you to send multiple ivr objects in one single request.

Single Say or Play

This is a standard sample payload to make an outbound call that collects a response. It allows you to either say a message in one language. Or it allows you to play a single audio file.

{
	"recipient":["+966111111111"],
	"type" : "ivr",
	"callerId" : "+966115219086",
	"ivr":
	{
        "language" : "english",
	    	"voice" : "male",
        "say":"Did you like our service? Press 1 to say yes. Press 2 to say yes.",
        "responseUrl":"https://myresponseurl.com/1"
	}
}

or

{
	"recipient":["+966111111111"],
	"type" : "ivr",
	"callerId" : "+966115219086",
	"ivr":
	{
        "play": "audioId",
        "responseUrl":"https://myresponseurl.com/1"
	}
}

Multiple Say and Play with non skippable audios

In order for you to have a series of multiple text-to-speech messages, audio messages, you will need to use an IVR array instead of an IVR object.

Introducing the new sample payload:

{
  "recipient": [
    "+966111111111"
  ],
  "type": "ivr",
  "callerId": "+966115219086",
  "ivr": [
    {
      "language": "english",
      "voice": "male",
      "say": "Hi Jacob",
      "pause": "2"
    },
    {
      "play": "audioId",
      "loop": "2"
    },
    {
      "message": [
        {
          "say": "Press, one, or, say, one, for, I strongly agree",
          "voice": "male",
          "language": "english",
          "pause": "1"
        },
        {
          "say": "اضغط على ثلاثة، أو، على سبيل المثال، ثلاثة، لأنني لا أوافق على ذلك",
          "voice": "male",
          "language": "arabic",
          "pause": "1"
        }
      ],
      "messageLoop": "2",
      "responseUrl": "https://myresponseurl.com/1"
    }
  ]
}

Unifonic would configure the message based on the IVR array from top to bottom, so the sequencing is very important.

🚧

End user cannot skip any IVR objects prior to the responseUrl

As the sequence of the message is initialized top to bottom on the IVR object, all prior IVR objects are not going to be skippable. This means, even if the end user presses a DTMF digit, it does not get collected until we reach the IVR object that has the responseUrl. Any digits pressed prior to reaching the object with responseUrl will be ignored and not collected.

Upon reaching the IVR object that possess the responseUrl - if any digit is now pressed, or any speech collection activity takes place, the message embedded with the responseUrl will be interrupted as an input has already been collected. Hence, it makes sense for you to exclude all non skippable messages outside of the IVR object that has the responseUrl.

Multiple Say and Play with skippable audios

In case you have no audios prior to the response collection that cannot be unskippable, you can follow this sample payload.

{
  "recipient": [
    "+966111111111"
  ],
  "type": "ivr",
  "callerId": "+966115219086",
  "ivr":{
      "message": [
        {
          "say": "Hello customer. This is Unifonic. Do you like our services?",
          "voice": "male",
          "language": "english",
          "pause": "1"
        }
        {
          "say": "Press, one, or, say, one, for, yes",
          "voice": "male",
          "language": "english",
          "pause": "1"
        },
        {
          "say": "اضغط على ثلاثة، أو، على سبيل المثال، ثلاثة، لأنني لا أوافق على ذلك",
          "voice": "male",
          "language": "arabic",
          "pause": "1"
        }
      ],
      "messageLoop": "2",
      "responseUrl": "https://myresponseurl.com/1"
    }
  ]
}

Multiple say and play in subsequent interactions

Customers can configure multiple say and play in any further interactions, just simply return the IVR array to us in the Post/responseUrl API response. On how to create further questions and answers on the call, read this guide.

Here are samples for the two scenarios:

i. Un-skippable audio and no collections of DTMF input prior to responseUrl

[
    {
      "language": "english",
      "voice": "male",
      "say": "Hi Jacob",
      "pause": "2"
    },
    {
      "play": "audioId",
      "loop": "2"
    },
    {
      "message": [
        {
          "say": "Press, one, or, say, one, for, I strongly agree",
          "voice": "male",
          "language": "english",
          "pause": "1"
        },
        {
          "say": "اضغط على ثلاثة، أو، على سبيل المثال، ثلاثة، لأنني لا أوافق على ذلك",
          "voice": "male",
          "language": "arabic",
          "pause": "1"
        }
      ],
      "messageLoop": "2",
      "responseUrl": "https://myresponseurl.com/1"
    }
  ]

ii. Skippable audio anytime DTMF is pressed

{
      "message": [
        {
          "say": "Hello customer. This is Unifonic. Do you like our services?",
          "voice": "male",
          "language": "english",
          "pause": "1"
        }
        {
          "say": "Press, one, or, say, one, for, yes",
          "voice": "male",
          "language": "english",
          "pause": "1"
        },
        {
          "say": "اضغط على ثلاثة، أو، على سبيل المثال، ثلاثة، لأنني لا أوافق على ذلك",
          "voice": "male",
          "language": "arabic",
          "pause": "1"
        }
      ],
      "messageLoop": "2",
      "responseUrl": "https://myresponseurl.com/1"
    }

👍

Notice that you can create text to speech in different language

As part of this new feature, you will be able to mix and match text to speech in different languages, allowing you to reach the full flexibility of programmable voice calls.