{"_id":"5a1fe6d8681312001e23b5a1","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"category":{"_id":"59b8eeeb707542001076d3b6","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-09-13T08:40:11.892Z","from_sync":false,"order":14,"slug":"voice-ivr","title":"Voice IVR"},"user":"583ee4a14828d50f00126d0f","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-11-30T11:09:12.963Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Below are examples and instructions for how to use inbound or outbound IVR with your customers. \n\nCreate a scenario and link it with an inbound or outbound flow by following these steps:\n\n1. [Create scenario](#create-scenario) using [available actions](#actions). \n2. Once you have done the first step, you will have a scenarioID. \nYou may [read](#read-scenario) and [update your scenario](#update-the-scenario) or [get the list of all scenarios](#get-the-scenario) created by you.\n3. Use a scenarioID for the [Setup of inbound IVR](/docs/inbound-ivr-setup) or [Launch of an outbound IVR](/docs/launch-outbound-ivr).\n\nBrowse our list of simple or more complex [IVR scenarios](#ivr-use-cases) before starting to build your own. \n[block:api-header]\n{\n  \"title\": \"IVR scenario\"\n}\n[/block]\nScenario is the major element of the IVR. Create it carefully and remember that simple scenarios are better for you and your customers. \n\nAvailable methods:\n\n  * [Create scenario](#create-scenario) \n  * [Read scenario by scenario name](#read-scenario) \n  * [Update scenario](#update-the-scenario) \n  * [Get scenario by ID](#get-the-scenario) \n[block:api-header]\n{\n  \"title\": \"Create scenario\"\n}\n[/block]\nCreate scenario API is a simple REST API with a well-structured body. In the response, you will get the ScenarioID to be used for the IVR flow on inbound or outbound calls.\n\nUse this method to create a new scenario:\n```\nPOST https://api.infobip.com/voice/ivr/1/scenarios\n```\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"name (required)\",\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Describe\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Scenario name.\",\n    \"1-0\": \"description\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Scenario description.\",\n    \"2-0\": \"script (required)\",\n    \"2-1\": \"Array\",\n    \"2-2\": \"List scenario's action.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /voice/ivr/1/scenarios HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"description\\\": \\\"This simple scenario is used as an example how to implement two actions (say and hangup).\\\",\\n  \\\"script\\\": [\\n    { \\\"say\\\": \\\"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\\\" },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n###Response format\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"E83E787CF2613450157ADA3476171E3F\\\",\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"description\\\": \\\"This simple scenario is used as an example how to implement two actions (say and hangup).\\\",\\n  \\\"createTime\\\": \\\"2017-10-03T12:36:01.667+0000\\\",\\n  \\\"updateTime\\\": null,\\n  \\\"script\\\": [\\n    {\\n      \\\"say\\\": \\\"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\\\"\\n    },\\n    \\\"hangup\\\"\\n  ],\\n}\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Read scenario\"\n}\n[/block]\nUse this method to read the specific scenario by using the (scenario) name parameter or read all scenarios you have created.\n\nUse this method to read scenarios:\n```\nGET https://api.infobip.com/voice/ivr/1/scenarios\n```\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Describe\",\n    \"0-0\": \"name\",\n    \"0-1\": \"String (Default = \\\"\\\")\",\n    \"h-3\": \"Describe\",\n    \"0-2\": \"Scenario name for filtering\",\n    \"1-0\": \"page\",\n    \"1-1\": \"Integer (Default = 1)\",\n    \"1-2\": \"Page number.\",\n    \"2-0\": \"pageSize\",\n    \"2-1\": \"Integer (Default = 50)\",\n    \"2-2\": \"Number of rows in one page.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nRequest without parameters will return first fifty scenarios ordered by name.\n\n###Request example without parameters \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /voice/ivr/1/scenarios HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Response example without parameters\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"id\\\": \\\"E83E787CF2613450157ADA3476171E3F\\\",\\n    \\\"name\\\": \\\"scenario\\\",\\n    \\\"description\\\": \\\"This simple scenario is used as an example how to implement two actions (say and hangup).\\\",\\n    \\\"createTime\\\": \\\"2017-10-03T12:36:01.667+0000\\\",\\n    \\\"updateTime\\\": null,\\n    \\\"script\\\": [\\n      {\\n        \\\"say\\\": \\\"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\\\"\\n      },\\n      \\\"hangup\\\"\\n    ]\\n  }\\n]\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Request with parameters example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /voice/ivr/1/scenarios?page=1&pageSize=30&name=Scenario HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Response format\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[\\n  {\\n    \\\"id\\\": \\\"E83E787CF2613450157ADA3476171E3F\\\",\\n    \\\"name\\\": \\\"scenario\\\",\\n    \\\"description\\\": \\\"This simple scenario is used as an example how to implement two actions (say and hangup).\\\",\\n    \\\"createTime\\\": \\\"2017-10-03T12:36:01.667+0000\\\",\\n    \\\"updateTime\\\": null,\\n    \\\"script\\\": [\\n      {\\n        \\\"say\\\": \\\"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\\\"\\n      },\\n      \\\"hangup\\\"\\n    ]\\n  }\\n]\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Update the scenario\"\n}\n[/block]\nUse this method to update an existing scenario\n```\nPUT https://api.infobip.com/voice/ivr/1/scenarios/{Id}\n```\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PUT /voice/ivr/1/scenarios/E83E787CF2613450157ADA3476171E3F HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"description\\\" :\\\"This scenario is used as an example how to implement all actions. \\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"repeat\\\": [\\n        {\\n          \\\"say\\\": \\\"Dear Customer, we will show you all action in one example. If you want perform dial action press one. Press two to play a message from url. Three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your choice, press asterisk.\\\"\\n        },\\n        {\\n          \\\"collectInto\\\": \\\"myVariable\\\",\\n          \\\"options\\\": {\\n            \\\"maxInputLength\\\": 1\\n          }\\n        },\\n        {\\n          \\\"switch\\\": \\\"myVariable\\\",\\n          \\\"case\\\": {\\n            \\\"1\\\": [\\n              {\\n                \\\"dial\\\": \\\"41793026731\\\"\\n              }\\n            ],\\n            \\\"2\\\": [\\n              {\\n                \\\"playFromUrl\\\": \\\"http://www.example.com/voice/advanced\\\"\\n              }\\n            ],\\n            \\\"3\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"POST\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/json\\\"\\n                  },\\n                  \\\"body\\\": {\\n                    \\\"payload\\\": \\\"${to} finished the IVR.\\\"\\n                  }\\n                }\\n              }\\n\\n            ],\\n            \\\"4\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"GET\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"5\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"PUT\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/xml\\\",\\n                    \\\"accept\\\": \\\"application/xml\\\"\\n                  },\\n                  \\\"body\\\": \\\"<request><payload>${to} finished the IVR.</payload></request>\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"__default\\\": [\\n              {\\n                \\\"say\\\": \\\"Dear Customer, you pressed a wrong number. Please, try again.\\\"\\n              }\\n            ]\\n          }\\n        }\\n      ],\\n      \\\"until\\\": \\\"${myVariable} != *\\\"\\n    },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n###Response format\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"F95CD76DB9318FC72CAC92533038AC89\\\",\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"description\\\": \\\"This scenario is used as an example how to implement all actions. \\\",\\n  \\\"createTime\\\": \\\"2017-09-14T08:50:49.717+0000\\\",\\n  \\\"updateTime\\\": \\\"2017-09-14T10:24:01.110+0000\\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"repeat\\\": [\\n        {\\n          \\\"say\\\": \\\"Dear Customer, we will show you all actions in one example. If you want perform dial action press one. If you press number two we will play message from a url. Number three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your's choice, press asterisk.\\\"\\n        },\\n        {\\n          \\\"collectInto\\\": \\\"myVariable\\\",\\n          \\\"options\\\": {\\n            \\\"maxInputLength\\\": 1\\n          }\\n        },\\n        {\\n          \\\"switch\\\": \\\"myVariable\\\",\\n          \\\"case\\\": {\\n            \\\"1\\\": [\\n              {\\n                \\\"dial\\\": \\\"41793026731\\\"\\n              }\\n            ],\\n            \\\"2\\\": [\\n              {\\n                \\\"playFromUrl\\\": \\\"http://www.example.com/voice/advanced\\\"\\n              }\\n            ],\\n            \\\"3\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"POST\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/json\\\"\\n                  },\\n                  \\\"body\\\": {\\n                    \\\"payload\\\": \\\"${to} finished the IVR.\\\"\\n                  }\\n                }\\n              }\\n\\n            ],\\n            \\\"4\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"GET\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"5\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"PUT\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/xml\\\",\\n                    \\\"accept\\\": \\\"application/xml\\\"\\n                  },\\n                  \\\"body\\\": \\\"<request><payload>${to} finished the IVR.</payload></request>\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"__default\\\": [\\n              {\\n                \\\"say\\\": \\\"Dear Customer, you pressed a wrong number. Please, try again.\\\"\\n              }\\n            ]\\n          }\\n        }\\n      ],\\n      \\\"until\\\": \\\"${myVariable} != *\\\"\\n    },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Get the scenario\"\n}\n[/block]\nUse this method to get the scenario using its Id in the API endpoint url.\n```\nGET https://api.infobip.com/voice/ivr/1/scenarios/{Id}\n```\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /voice/ivr/1/scenarios/E83E787CF2613450157ADA3476171E3F HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n###Response format\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"E83E787CF2613450157ADA3476171E3F\\\",\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"description\\\": \\\"This scenario is used as an example how to implement all actions. \\\",\\n  \\\"createTime\\\": \\\"2017-10-03T12:36:01.667+0000\\\",\\n  \\\"updateTime\\\": \\\"2017-10-03T12:43:39.767+0000\\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"repeat\\\": [\\n        {\\n          \\\"say\\\": \\\"Dear Customer, we will show you all action in one example. If you want perform dial action press one. Press two to play a message from url. Three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your choice, press asterisk.\\\"\\n        },\\n        {\\n          \\\"collectInto\\\": \\\"myVariable\\\",\\n          \\\"options\\\": {\\n            \\\"maxInputLength\\\": 1\\n          }\\n        },\\n        {\\n          \\\"switch\\\": \\\"myVariable\\\",\\n          \\\"case\\\": {\\n            \\\"1\\\": [\\n              {\\n                \\\"dial\\\": \\\"41793026731\\\"\\n              }\\n            ],\\n            \\\"2\\\": [\\n              {\\n                \\\"playFromUrl\\\": \\\"http://www.example.com/voice/advanced\\\"\\n              }\\n            ],\\n            \\\"3\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"POST\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/json\\\"\\n                  },\\n                  \\\"body\\\": {\\n                    \\\"payload\\\": \\\"${to} finished the IVR.\\\"\\n                  }\\n                }\\n              }\\n\\n            ],\\n            \\\"4\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"GET\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"5\\\": [\\n              {\\n                \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n                \\\"options\\\": {\\n                  \\\"method\\\": \\\"PUT\\\",\\n                  \\\"headers\\\": {\\n                    \\\"content-type\\\": \\\"application/xml\\\",\\n                    \\\"accept\\\": \\\"application/xml\\\"\\n                  },\\n                  \\\"body\\\": \\\"<request><payload>${to} finished the IVR.</payload></request>\\\",\\n                  \\\"collectResponse\\\": true\\n                }\\n              }\\n            ],\\n            \\\"__default\\\": [\\n              {\\n                \\\"say\\\": \\\"Dear Customer, you pressed a wrong number. Please, try again.\\\"\\n              }\\n            ]\\n          }\\n        }\\n      ],\\n      \\\"until\\\": \\\"${myVariable} != *\\\"\\n    },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Variables\"\n}\n[/block]\nDuring the scenario execution, some actions may write to or read from variables. All variables are strings and defined globally in the entire scope of the scenario. The system currently provides the following read-only variables that are populated for each call:\n\n    from - the caller ID, source address (E164)\n    to - the callee ID, destination address (E164)\n    startTime - the start time of the call (YYYY-MM-DD hh:mm:ss)\n    answerTime - the time the user answered the call (YYYY-MM-DD hh:mm:ss)\n[block:api-header]\n{\n  \"title\": \"Actions\"\n}\n[/block]\nLet's take a look at the available scenario actions:\n\n* [Say](#say)\n* [Collect](#collect)\n* [Dial](#dial)\n* [Play](#play)\n* [Record](#record)\n* [Call API](#call-api)\n* [Switch - Case](#switch-case)\n* [Repeat - Until](#repeat-until)\n* [While do](#while-do)\n* [Hang up](#hang-up)\n\t\nAlso, [IVR use cases](#ivr-use-cases) contain simple examples you can use for your own scenarios. \n[block:api-header]\n{\n  \"title\": \"Say\"\n}\n[/block]\nA Say action performs the playback of TTS synthesized audio based on its parameters. Message text can be up to 1400 characters long.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"1-0\": \"options > language\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Must be defined for correct pronunciation. In the [Languages](#languages) section, you can find the list of languages that we support.\",\n    \"2-0\": \"options > speechRate\",\n    \"2-1\": \"Double\",\n    \"2-2\": \"Must be within [0.5 - 2.0] range, default value is 1.\",\n    \"0-0\": \"say\",\n    \"0-1\": \"String\",\n    \"0-2\": \"message text\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"say\\\": \\\"Dear Customer, we will show you all actions in one example. If you want to perform dial action press one. If you press number two we will play message from a url. Number three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your's choice, press asterisk.\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Collect\"\n}\n[/block]\nA Collect action performs DTMF input reading and saving from the user's phone.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Descript\",\n    \"1-0\": \"options > maxInputLength\",\n    \"1-1\": \"Integer\",\n    \"1-2\": \"the maximum number of DTMF tones to wait for, 0 for unlimited.\",\n    \"0-0\": \"collectInto\",\n    \"0-1\": \"String\",\n    \"0-2\": \"the name of the variable to set\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nThe variable name cannot be one of the reserved ones, except for `dtmf`. A Collect is internally parameterized with two parameters: `responseTimeout` and `digitTimeout`. The `responseTimeout` is the time the IVR platform waits for the user to press the first key. After the first key is pressed, the platform waits for any additional keys for the `digitTimeout`. These variables are 5 and 2 seconds, respectively.\nThe # key cannot be collected, as it is reserved for user input termination (i.e. the IVR platform automatically stops reading user input after receiving #, without storing it). \n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"collectInto\\\": \\\"myVariable\\\",\\n  \\\"options\\\": {\\n    \\\"maxInputLength\\\": 1\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Dial\"\n}\n[/block]\nA Dial action performs a call redirection, joining the user's call with another destination. This action is final, meaning that it cannot be followed by an action (it has to be the last action within its branch, not even followed by a Hangup).\n\n|Property |Type|Default|Note|\n|-|-|-|-|\n|dial|String|(required)|must be a valid E164 MSISDN; the parameter can be constructed using variables|\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"dial\\\": \\\"41793026731\\\"\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Play\"\n}\n[/block]\nA Play action performs playback of audio provided by the client’s URL.\n\n|Property |Type|Default|Note|\n|-|-|-|-|\n|playFromUrlString|(required)||file URL|\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"playFromUrl\\\": \\\"http://www.example.com/voice/sound.mp3\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Record\"\n}\n[/block]\nA Record action performs recording of a portion of the call.\n\n|Property |Type|Default|Note|\n|-|-|-|-|\n|record|Number||the duration to record for in seconds; `null` for unlimited|\n|escapeDigits|String||DTMF codes which should stop recording when input by the user|\n|beep|Boolean|`false`|flag indicating a beep sound should be played at the start of the recording|\n|maxSilence|Number||The amount of silence to wait for before stopping the recording|\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"record\\\": 10,\\n  \\\"options\\\": {\\n  \\t\\\"escapeDigits\\\": \\\"123*\\\",\\n    \\t\\\"beep\\\": true,\\n      \\\"maxSilence\\\": 3\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Call API\"\n}\n[/block]\nA Call API Action performs an HTTP request to a client's endpoint, and (if told to) processes the response data.\n\nIf `collectResponse` is set, the system will attempt to parse the response from the server. The parsing algorithm is quite naive: based on the `Accept` header (or `Content-Type` header, if `Accept` header is missing), it will attempt to parse the response into a simple one-level object, and save all its fields as variables. Any response property with a reserved name is ignored.\n\nThe response payload is limited by size to 32kB. If exceeded, the scenario is aborted.  Any I/O exception during the action will be raised, interrupting scenario execution. Currently, this is not applied for non-200 HTTP status codes received (such responses are ignored). \n\n\n|Property|Type|Default|Note|\n|-|-|-|-|\n|request|String|(required)|the URL to target|\n|options > method|String|(required)|GET, POST, PUT, DELETE|\n|options > headers|Object|(required, for content-type)||\n|options > body|String or Object|(required for body-enclosing methods)|the request body to send|\n|options > collectResponse|boolean|false|if set, will cause the system to process the response|\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n  \\\"options\\\": {\\n    \\\"method\\\": \\\"POST\\\",\\n    \\\"headers\\\": {\\n      \\\"content-type\\\": \\\"application/json\\\"\\n    },\\n    \\\"body\\\": {\\n      \\\"payload\\\": \\\"${to} finished the IVR.\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n  \\\"options\\\": {\\n    \\\"method\\\": \\\"GET\\\",\\n    \\\"headers\\\": {\\n      \\\"accept\\\": \\\"application/xml\\\",\\n      \\\"authorization\\\": \\\"Basic dXNlcjpwYXNz\\\"\\n    },\\n    \\\"collectResponse\\\": true\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n  \\\"options\\\": {\\n    \\\"method\\\": \\\"PUT\\\",\\n    \\\"headers\\\": {\\n      \\\"content-type\\\": \\\"application/xml\\\",\\n      \\\"accept\\\": \\\"application/xml\\\"\\n    },\\n    \\\"body\\\": \\\"<request><payload>${to} finished the IVR.</payload></request>\\\",\\n    \\\"collectResponse\\\": true\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Switch - Case\"\n}\n[/block]\nA Switch - Case action takes a saved variable (obtained via either a Collect or a Call API action) and performs flow control based on it. It works similarly to the switch case block, using case-sensitive comparison.\n\n|Property|Type|Default|Note|\n|-|-|-|-|\n|switch|String|(required)|name of the variable whose value to inspect|\n|case|Object|(required)|object whose keys are possible variable values, and values are arrays of actions|\n|__default|Array||array of actions to execute if none of the conditions above are met|\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"switch\\\": \\\"myVariable\\\",\\n  \\\"case\\\": {\\n    \\\"1\\\": [\\n      {\\n        \\\"dial\\\": \\\"41793026731\\\"\\n      }\\n    ],\\n    \\\"2\\\": [\\n      {\\n        \\\"playFromUrl\\\": \\\"http://www.example.com/voice/advanced\\\"\\n      }\\n    ],\\n    \\\"3\\\": [\\n      {\\n        \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n        \\\"options\\\": {\\n          \\\"method\\\": \\\"POST\\\",\\n          \\\"headers\\\": {\\n            \\\"content-type\\\": \\\"application/json\\\"\\n          },\\n          \\\"body\\\": {\\n            \\\"payload\\\": \\\"${to} finished the IVR.\\\"\\n          }\\n        }\\n      }\\n    ],\\n    \\\"4\\\": [\\n      {\\n        \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n        \\\"options\\\": {\\n          \\\"method\\\": \\\"GET\\\",\\n          \\\"collectResponse\\\": true\\n        }\\n      }\\n    ],\\n    \\\"5\\\": [\\n      {\\n        \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n        \\\"options\\\": {\\n          \\\"method\\\": \\\"PUT\\\",\\n          \\\"headers\\\": {\\n            \\\"content-type\\\": \\\"application/xml\\\",\\n            \\\"accept\\\": \\\"application/xml\\\"\\n          },\\n          \\\"body\\\": \\\"<request><payload>${to} finished the IVR.</payload></request>\\\",\\n          \\\"collectResponse\\\": true\\n        }\\n      }\\n    ],\\n    \\\"__default\\\": [\\n      {\\n        \\\"say\\\": \\\"Dear Customer, you pressed wrong number. Please, try again.\\\"\\n      },\\n      {\\n        \\\"collectInto\\\": \\\"myVariable\\\",\\n        \\\"options\\\": {\\n          \\\"maxInputLength\\\": 1\\n        }\\n      }\\n    ]\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Repeat - Until\"\n}\n[/block]\nA Repeat - Until loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given boolean condition in the until field. \nComparison is done using equal (`==`) or not equal (`! =`) operators. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"repeat\\\": [\\n    { \\\"say\\\": \\\"For exit you must press one.\\\" },\\n    { \\\"collectInto\\\": \\\"myVariable\\\" }\\n  ],\\n  \\\"until\\\": \\\"${myVariable} == 1\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"While - Do\"\n}\n[/block]\nLoops can execute a do field block of code as long as a specified condition is true in the while field. As with Repeat - Until, comparison is done using equal (`==`) or not equal (`! =`) operators.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"while\\\": \\\"${myVariable} != 1\\\",\\n    \\\"do\\\": [\\n        { \\\"say\\\": \\\"For exit you must press one.\\\" },\\n        { \\\"collectInto\\\": \\\"myVariable\\\" }\\n    ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Hang up\"\n}\n[/block]\nA Hangup action is a pseudo-action marking the end of the IVR flow execution, leading to the call actually being hung up. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"hangup\\\"\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"IVR use cases\"\n}\n[/block]\nVarious IVR scenarios could be created by combining available actions. Here are just a few samples that you might check out before creating your own.\n\n[Scheduling an appointment](#scheduling-an-appointment)\n[Checking order/delivery status](#checking-orderdelivery-status)\n[Cart abandonment](#cart-abandonment)\n[block:api-header]\n{\n  \"title\": \"Scheduling an appointment\"\n}\n[/block]\nA simple use case to call a customer to schedule an appointment via IVR. The IVR workflow can offer the customer a range of appointment options. Here’s how this process would work.\n\n\nThe client  sets up a Scenario and uses the received ScenarioId to [Launch Outbound IVR API](/docs/launch-outbound-ivr). Our platform will initiate a call to each destination phone number specified. Once the call is answered, the IVR flow will start playing an audio message inviting the customer to pick one of the available appointment times using DTMF keys.\n\nHere’s how the steps look. Code samples and a flow diagram are below:\n\n1. Call customer phone number\n2. Once the customer picks up the phone, the IVR message is played:\n   *Dear client, we would like to schedule an appointment for you on October 14th. Available times \n    are 10:00 am, 11 am, and 2:00 pm. Please press 1 for 10 am, 2  for 11 am, or 3 for a 2 pm \n    appointment. If none of these work for you, we will send a new message suggesting different time \n    slots. *\n3. Collect action gathers the DTMF code entered by end user\n4. User input is analyzed and, based on the DTMF, one of the following responses is played::\n    4a For DTMF 1, 2 or 3: *Thank you. Your appointment is scheduled.*\n    4b For any other DTMF or no DTMF: *Thank you  We will suggest another time slot once it’s         available. *\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f18eddf-Scheduling.jpg\",\n        \"Scheduling.jpg\",\n        1350,\n        1180,\n        \"#f3ebf3\"\n      ]\n    }\n  ]\n}\n[/block]\n##Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"say\\\": \\\"Dear client, we would like to schedule an appointment on 14.10. Available time is 10:00 am, 11 am and 2:00 pm. Please press 1 for 10 am, 2 for 11 or 3 for a 2 pm meeting. If non of the above suits you, we will send new message suggesting different time frame.\\\"\\n    },\\n    {\\n      \\\"collectInto\\\": \\\"scheduleTime\\\"\\n    },\\n    {\\n      \\\"switch\\\": \\\"scheduleTime\\\",\\n      \\\"case\\\": {\\n        \\\"1\\\": [\\n          {\\n            \\\"say\\\": \\\"Thank you. Your appointment is scheduled for 10 am.\\\"\\n          }\\n        ],\\n        \\\"2\\\":[\\n          {\\n            \\\"say\\\": \\\"Thank you. Your appointment is scheduled for 11 am.\\\"\\n          }\\n        ],\\n        \\\"3\\\":[\\n          {\\n            \\\"say\\\": \\\"Thank you. Your appointment is scheduled for 2 pm.\\\"\\n          }\\n        ],\\n        \\\"__default\\\": [\\n          {\\n            \\\"say\\\": \\\"Thank you  We will suggest another time slot once it’s available.\\\"\\n          },\\n          \\\"hangup\\\"\\n        ]\\n      }\\n    },\\n    { \\\"say\\\": \\\"Thank you. Your appointment is scheduled.\\\" },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Checking order/delivery status\"\n}\n[/block]\nA package delivery company would like to automate customers checking the delivery status of orders and offer customers 24/7 updates on deliveries. The delivery company would obtain a DID (voice number from Infobip) and create an [Inbound IVR workflow](/docs/inbound-ivr-setup) to respond to customer queries. An IVR workflow can update customers around the clock and on weekends and holidays. A well-designed IVR workflow will reduce the workload on live agents for these simple requests.\n\nIn this scenario a customer calls a number and enters a tracking number through DTMF codes which can be checked against the company’s backend systems. The response back is handled by the Text To Speech (TTS) Say action. Here is how the process looks like step by step.\n\n1. Customer dials a DID number \n2. IVR answers the call and plays a message:  *Welcome to Acme Co Delivery. To track your package, please enter your 5 digit tracking number.*\n3. Using Collect actions IVR gathers a DTMF code entered by the customer.\n4. In order the check the status of the order, IVR flow calls client’s systems using Call API action and the 5 digit code that was entered by the customer. \n5. IVR performs Say action based on the backend system’s response from step 4. e.g.:\n  *Your package is at your local post office and is scheduled to be delivered tomorrow.*\n6. To provide a possibility to talk to a real agent, additional action offering to transfer the call is added. IVR plays an audio: *If you have any questions or need to reschedule the delivery, press 1 to speak with an agent.*\n7. The response is gathered once more using the Collect action\n8. If the customer didn’t press 1, the call is ended. If the customer entered 1, the IVR workflow dials the predefined client's number and the call will last until ended by an agent or customer.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/dcb1ebe-Order.jpg\",\n        \"Order.jpg\",\n        1566,\n        1900,\n        \"#f2ebf3\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"say\\\": \\\"Welcome to Acme Co Delivery. To track your package, please enter your 5 digit your tracking number.\\\"\\n    },\\n    {\\n      \\\"collectInto\\\": \\\"code\\\",\\n      \\\"options\\\": {\\n        \\\"maxInputLength\\\": 5\\n      }\\n    },\\n    {\\n      \\\"request\\\": \\\"https://requestb.in/12345\\\",\\n      \\\"options\\\": {\\n        \\\"method\\\": \\\"POST\\\",\\n        \\\"headers\\\": {\\n          \\\"content-type\\\": \\\"application/json\\\"\\n        },\\n        \\\"body\\\": {\\n          \\\"code\\\": \\\"${code}\\\"\\n        },\\n        \\\"collectResponse\\\":true\\n      }\\n    },\\n    {\\n      \\\"say\\\": \\\"responseMessage\\\"\\n    },\\n    {\\\"say\\\": \\\"If you have any questions or need to reschedule the delivery, press 1 to speak with an agent.\\\"},\\n    {\\n      \\\"collectInto\\\": \\\"satisfiedAnswer\\\"\\n    },\\n    {\\n      \\\"switch\\\": \\\"satisfiedAnswer\\\",\\n      \\\"case\\\": {\\n        \\\"1\\\": [\\n          {\\n            \\\"dial\\\": \\\"41793026731\\\"\\n          }\\n        ]\\n      }\\n    },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Cart abandonment\"\n}\n[/block]\nClient has an online store and everyday notices customers clicking and checking out products, even adding them to their shopping carts. But one thing is missing and it is the most important one - checkout and conclusion of the buying process. In order to remind customers and ask them why they did not finish the process, client could send an IVR survey that should give some context on what is going on when users interact with your page. Maybe there is something that needs to be changed in the online buying process or at least to know that some customers are not serious buyers.\n\nLet us break down this process in steps. \n\n1. Customer logs in to the web shop and stores a couple of products inside his shopping cart\n2. After some time he leaves the web shop without completing the buying process\n3. This is noticed by the client's back end system and this will trigger an IVR scenario ID towards that customer/destination\n4. Based on the scenario the customer can be asked the following question: \n*Dear customer we see that you have some goods in your cart. Would you like us to notify you     \n    once the product in your basket becomes discounted? Press 1 for yes, press 2 for no, press 5 to \n    talk with an agent and get more information.*\n5. Customer response will be collected and call API action will enable client to receive it\n6. Based on the response codes (DTMFs) the customer pressed, client will do according actions on his side like updating the CRM, calling the customer with more info etc. \n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/22daf13-Card.jpg\",\n        \"Card.jpg\",\n        1566,\n        1180,\n        \"#f2ebf2\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"name\\\": \\\"scenario\\\",\\n  \\\"script\\\": [\\n    {\\n      \\\"say\\\": \\\"Dear customer we see that you have some goods in your cart. Would you like us to notify you once the product in your basket becomes discounted? Press 1 for yes, press 2 for no, press 5 to talk with an agent and get more information.\\\"\\n    },\\n    {\\n      \\\"collectInto\\\": \\\"DTMFCode\\\"\\n    },\\n    {\\n      \\\"switch\\\": \\\"DTMFCode\\\",\\n      \\\"case\\\": {\\n        \\\"5\\\": [\\n          {\\n            \\\"dial\\\": \\\"41793026731\\\"\\n          }\\n        ]\\n      }\\n    },\\n    {\\n      \\\"say\\\": \\\"Thank you.\\\"\\n    },\\n    \\\"hangup\\\"\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Languanges\"\n}\n[/block]\nList of languages available for Say action: \n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"English\",\n    \"h-0\": \"Language\",\n    \"h-1\": \"Language shortcut\",\n    \"0-1\": \"en\",\n    \"5-0\": \"Spanish\",\n    \"5-1\": \"es\",\n    \"6-0\": \"Catalan\",\n    \"6-1\": \"ca\",\n    \"7-0\": \"Chinese-Simplified\",\n    \"8-0\": \"Chinese-Traditional\",\n    \"7-1\": \"zh-cn\",\n    \"8-1\": \"zh-tw\",\n    \"9-0\": \"Danish\",\n    \"10-0\": \"Dutch\",\n    \"9-1\": \"da\",\n    \"10-1\": \"nl\",\n    \"11-0\": \"French\",\n    \"12-0\": \"German\",\n    \"11-1\": \"fr\",\n    \"12-1\": \"de\",\n    \"13-0\": \"Italian\",\n    \"13-1\": \"it\",\n    \"14-0\": \"Japanese\",\n    \"15-0\": \"Korean\",\n    \"14-1\": \"ja\",\n    \"15-1\": \"ko\",\n    \"16-0\": \"Norwegian\",\n    \"16-1\": \"no\",\n    \"17-0\": \"Polish\",\n    \"18-0\": \"Portuguese\",\n    \"17-1\": \"pl\",\n    \"18-1\": \"pt-pt\",\n    \"19-0\": \"Portuguese - Brazilian\",\n    \"20-0\": \"Russian\",\n    \"19-1\": \"pt-br\",\n    \"20-1\": \"ru\",\n    \"21-0\": \"Swedish\",\n    \"21-1\": \"sv\",\n    \"22-0\": \"Finnish\",\n    \"23-0\": \"Turkish\",\n    \"22-1\": \"fi\",\n    \"23-1\": \"tr\",\n    \"24-0\": \"Welsh\",\n    \"24-1\": \"wls\",\n    \"1-0\": \"English (British)\",\n    \"1-1\": \"en-gb\",\n    \"2-0\": \"English (Australian)\",\n    \"2-1\": \"en-au\",\n    \"3-0\": \"English (Indian)\",\n    \"3-1\": \"en-in\",\n    \"4-0\": \"English (Welsh)\",\n    \"4-1\": \"en-gb-wls\"\n  },\n  \"cols\": 2,\n  \"rows\": 25\n}\n[/block]","excerpt":"The easiest way to build a high-quality IVR in the cloud.","slug":"create-ivr","type":"basic","title":"Create IVR"}

Create IVR

The easiest way to build a high-quality IVR in the cloud.

Below are examples and instructions for how to use inbound or outbound IVR with your customers. Create a scenario and link it with an inbound or outbound flow by following these steps: 1. [Create scenario](#create-scenario) using [available actions](#actions). 2. Once you have done the first step, you will have a scenarioID. You may [read](#read-scenario) and [update your scenario](#update-the-scenario) or [get the list of all scenarios](#get-the-scenario) created by you. 3. Use a scenarioID for the [Setup of inbound IVR](/docs/inbound-ivr-setup) or [Launch of an outbound IVR](/docs/launch-outbound-ivr). Browse our list of simple or more complex [IVR scenarios](#ivr-use-cases) before starting to build your own. [block:api-header] { "title": "IVR scenario" } [/block] Scenario is the major element of the IVR. Create it carefully and remember that simple scenarios are better for you and your customers. Available methods: * [Create scenario](#create-scenario) * [Read scenario by scenario name](#read-scenario) * [Update scenario](#update-the-scenario) * [Get scenario by ID](#get-the-scenario) [block:api-header] { "title": "Create scenario" } [/block] Create scenario API is a simple REST API with a well-structured body. In the response, you will get the ScenarioID to be used for the IVR flow on inbound or outbound calls. Use this method to create a new scenario: ``` POST https://api.infobip.com/voice/ivr/1/scenarios ``` [block:parameters] { "data": { "0-0": "name (required)", "h-0": "Parameter", "h-1": "Type", "h-2": "Describe", "0-1": "String", "0-2": "Scenario name.", "1-0": "description", "1-1": "String", "1-2": "Scenario description.", "2-0": "script (required)", "2-1": "Array", "2-2": "List scenario's action." }, "cols": 3, "rows": 3 } [/block] ###Request example [block:code] { "codes": [ { "code": "POST /voice/ivr/1/scenarios HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"name\": \"scenario\",\n \"description\": \"This simple scenario is used as an example how to implement two actions (say and hangup).\",\n \"script\": [\n { \"say\": \"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\" },\n \"hangup\"\n ]\n}", "language": "json", "name": "JSON" } ] } [/block] ###Response format [block:code] { "codes": [ { "code": "{\n \"id\": \"E83E787CF2613450157ADA3476171E3F\",\n \"name\": \"scenario\",\n \"description\": \"This simple scenario is used as an example how to implement two actions (say and hangup).\",\n \"createTime\": \"2017-10-03T12:36:01.667+0000\",\n \"updateTime\": null,\n \"script\": [\n {\n \"say\": \"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\"\n },\n \"hangup\"\n ],\n}", "language": "json", "name": "200 OK - JSON" } ] } [/block] [block:api-header] { "title": "Read scenario" } [/block] Use this method to read the specific scenario by using the (scenario) name parameter or read all scenarios you have created. Use this method to read scenarios: ``` GET https://api.infobip.com/voice/ivr/1/scenarios ``` [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Describe", "0-0": "name", "0-1": "String (Default = \"\")", "h-3": "Describe", "0-2": "Scenario name for filtering", "1-0": "page", "1-1": "Integer (Default = 1)", "1-2": "Page number.", "2-0": "pageSize", "2-1": "Integer (Default = 50)", "2-2": "Number of rows in one page." }, "cols": 3, "rows": 3 } [/block] Request without parameters will return first fifty scenarios ordered by name. ###Request example without parameters [block:code] { "codes": [ { "code": "GET /voice/ivr/1/scenarios HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] ###Response example without parameters [block:code] { "codes": [ { "code": "[\n {\n \"id\": \"E83E787CF2613450157ADA3476171E3F\",\n \"name\": \"scenario\",\n \"description\": \"This simple scenario is used as an example how to implement two actions (say and hangup).\",\n \"createTime\": \"2017-10-03T12:36:01.667+0000\",\n \"updateTime\": null,\n \"script\": [\n {\n \"say\": \"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\"\n },\n \"hangup\"\n ]\n }\n]", "language": "json" } ] } [/block] ###Request with parameters example [block:code] { "codes": [ { "code": "GET /voice/ivr/1/scenarios?page=1&pageSize=30&name=Scenario HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] ###Response format [block:code] { "codes": [ { "code": "[\n {\n \"id\": \"E83E787CF2613450157ADA3476171E3F\",\n \"name\": \"scenario\",\n \"description\": \"This simple scenario is used as an example how to implement two actions (say and hangup).\",\n \"createTime\": \"2017-10-03T12:36:01.667+0000\",\n \"updateTime\": null,\n \"script\": [\n {\n \"say\": \"Dear Customer, we will show you how to use create, read, update, delete scenarios methods.\"\n },\n \"hangup\"\n ]\n }\n]", "language": "json", "name": "200 OK - JSON" } ] } [/block] [block:api-header] { "title": "Update the scenario" } [/block] Use this method to update an existing scenario ``` PUT https://api.infobip.com/voice/ivr/1/scenarios/{Id} ``` ###Request example [block:code] { "codes": [ { "code": "PUT /voice/ivr/1/scenarios/E83E787CF2613450157ADA3476171E3F HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"name\": \"scenario\",\n \"description\" :\"This scenario is used as an example how to implement all actions. \",\n \"script\": [\n {\n \"repeat\": [\n {\n \"say\": \"Dear Customer, we will show you all action in one example. If you want perform dial action press one. Press two to play a message from url. Three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your choice, press asterisk.\"\n },\n {\n \"collectInto\": \"myVariable\",\n \"options\": {\n \"maxInputLength\": 1\n }\n },\n {\n \"switch\": \"myVariable\",\n \"case\": {\n \"1\": [\n {\n \"dial\": \"41793026731\"\n }\n ],\n \"2\": [\n {\n \"playFromUrl\": \"http://www.example.com/voice/advanced\"\n }\n ],\n \"3\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"payload\": \"${to} finished the IVR.\"\n }\n }\n }\n\n ],\n \"4\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"GET\",\n \"collectResponse\": true\n }\n }\n ],\n \"5\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"PUT\",\n \"headers\": {\n \"content-type\": \"application/xml\",\n \"accept\": \"application/xml\"\n },\n \"body\": \"<request><payload>${to} finished the IVR.</payload></request>\",\n \"collectResponse\": true\n }\n }\n ],\n \"__default\": [\n {\n \"say\": \"Dear Customer, you pressed a wrong number. Please, try again.\"\n }\n ]\n }\n }\n ],\n \"until\": \"${myVariable} != *\"\n },\n \"hangup\"\n ]\n}", "language": "json", "name": "JSON" } ] } [/block] ###Response format [block:code] { "codes": [ { "code": "{\n \"id\": \"F95CD76DB9318FC72CAC92533038AC89\",\n \"name\": \"scenario\",\n \"description\": \"This scenario is used as an example how to implement all actions. \",\n \"createTime\": \"2017-09-14T08:50:49.717+0000\",\n \"updateTime\": \"2017-09-14T10:24:01.110+0000\",\n \"script\": [\n {\n \"repeat\": [\n {\n \"say\": \"Dear Customer, we will show you all actions in one example. If you want perform dial action press one. If you press number two we will play message from a url. Number three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your's choice, press asterisk.\"\n },\n {\n \"collectInto\": \"myVariable\",\n \"options\": {\n \"maxInputLength\": 1\n }\n },\n {\n \"switch\": \"myVariable\",\n \"case\": {\n \"1\": [\n {\n \"dial\": \"41793026731\"\n }\n ],\n \"2\": [\n {\n \"playFromUrl\": \"http://www.example.com/voice/advanced\"\n }\n ],\n \"3\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"payload\": \"${to} finished the IVR.\"\n }\n }\n }\n\n ],\n \"4\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"GET\",\n \"collectResponse\": true\n }\n }\n ],\n \"5\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"PUT\",\n \"headers\": {\n \"content-type\": \"application/xml\",\n \"accept\": \"application/xml\"\n },\n \"body\": \"<request><payload>${to} finished the IVR.</payload></request>\",\n \"collectResponse\": true\n }\n }\n ],\n \"__default\": [\n {\n \"say\": \"Dear Customer, you pressed a wrong number. Please, try again.\"\n }\n ]\n }\n }\n ],\n \"until\": \"${myVariable} != *\"\n },\n \"hangup\"\n ]\n}", "language": "json", "name": "200 OK - JSON" } ] } [/block] [block:api-header] { "title": "Get the scenario" } [/block] Use this method to get the scenario using its Id in the API endpoint url. ``` GET https://api.infobip.com/voice/ivr/1/scenarios/{Id} ``` ###Request example [block:code] { "codes": [ { "code": "GET /voice/ivr/1/scenarios/E83E787CF2613450157ADA3476171E3F HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json", "name": "JSON" } ] } [/block] ###Response format [block:code] { "codes": [ { "code": "{\n \"id\": \"E83E787CF2613450157ADA3476171E3F\",\n \"name\": \"scenario\",\n \"description\": \"This scenario is used as an example how to implement all actions. \",\n \"createTime\": \"2017-10-03T12:36:01.667+0000\",\n \"updateTime\": \"2017-10-03T12:43:39.767+0000\",\n \"script\": [\n {\n \"repeat\": [\n {\n \"say\": \"Dear Customer, we will show you all action in one example. If you want perform dial action press one. Press two to play a message from url. Three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your choice, press asterisk.\"\n },\n {\n \"collectInto\": \"myVariable\",\n \"options\": {\n \"maxInputLength\": 1\n }\n },\n {\n \"switch\": \"myVariable\",\n \"case\": {\n \"1\": [\n {\n \"dial\": \"41793026731\"\n }\n ],\n \"2\": [\n {\n \"playFromUrl\": \"http://www.example.com/voice/advanced\"\n }\n ],\n \"3\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"payload\": \"${to} finished the IVR.\"\n }\n }\n }\n\n ],\n \"4\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"GET\",\n \"collectResponse\": true\n }\n }\n ],\n \"5\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"PUT\",\n \"headers\": {\n \"content-type\": \"application/xml\",\n \"accept\": \"application/xml\"\n },\n \"body\": \"<request><payload>${to} finished the IVR.</payload></request>\",\n \"collectResponse\": true\n }\n }\n ],\n \"__default\": [\n {\n \"say\": \"Dear Customer, you pressed a wrong number. Please, try again.\"\n }\n ]\n }\n }\n ],\n \"until\": \"${myVariable} != *\"\n },\n \"hangup\"\n ]\n}", "language": "json", "name": "200 OK - JSON" } ] } [/block] [block:api-header] { "title": "Variables" } [/block] During the scenario execution, some actions may write to or read from variables. All variables are strings and defined globally in the entire scope of the scenario. The system currently provides the following read-only variables that are populated for each call: from - the caller ID, source address (E164) to - the callee ID, destination address (E164) startTime - the start time of the call (YYYY-MM-DD hh:mm:ss) answerTime - the time the user answered the call (YYYY-MM-DD hh:mm:ss) [block:api-header] { "title": "Actions" } [/block] Let's take a look at the available scenario actions: * [Say](#say) * [Collect](#collect) * [Dial](#dial) * [Play](#play) * [Record](#record) * [Call API](#call-api) * [Switch - Case](#switch-case) * [Repeat - Until](#repeat-until) * [While do](#while-do) * [Hang up](#hang-up) Also, [IVR use cases](#ivr-use-cases) contain simple examples you can use for your own scenarios. [block:api-header] { "title": "Say" } [/block] A Say action performs the playback of TTS synthesized audio based on its parameters. Message text can be up to 1400 characters long. [block:parameters] { "data": { "h-0": "Property", "h-1": "Type", "h-2": "Description", "1-0": "options > language", "1-1": "String", "1-2": "Must be defined for correct pronunciation. In the [Languages](#languages) section, you can find the list of languages that we support.", "2-0": "options > speechRate", "2-1": "Double", "2-2": "Must be within [0.5 - 2.0] range, default value is 1.", "0-0": "say", "0-1": "String", "0-2": "message text" }, "cols": 3, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "{\n \"say\": \"Dear Customer, we will show you all actions in one example. If you want to perform dial action press one. If you press number two we will play message from a url. Number three in this case is reserved for call web api's POST method. If you want call web api's GET method press four. For web api's PUT method you will press five. Exit is your's choice, press asterisk.\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Collect" } [/block] A Collect action performs DTMF input reading and saving from the user's phone. [block:parameters] { "data": { "h-0": "Property", "h-1": "Type", "h-2": "Descript", "1-0": "options > maxInputLength", "1-1": "Integer", "1-2": "the maximum number of DTMF tones to wait for, 0 for unlimited.", "0-0": "collectInto", "0-1": "String", "0-2": "the name of the variable to set" }, "cols": 3, "rows": 2 } [/block] The variable name cannot be one of the reserved ones, except for `dtmf`. A Collect is internally parameterized with two parameters: `responseTimeout` and `digitTimeout`. The `responseTimeout` is the time the IVR platform waits for the user to press the first key. After the first key is pressed, the platform waits for any additional keys for the `digitTimeout`. These variables are 5 and 2 seconds, respectively. The # key cannot be collected, as it is reserved for user input termination (i.e. the IVR platform automatically stops reading user input after receiving #, without storing it). [block:code] { "codes": [ { "code": "{\n \"collectInto\": \"myVariable\",\n \"options\": {\n \"maxInputLength\": 1\n }\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "title": "Dial" } [/block] A Dial action performs a call redirection, joining the user's call with another destination. This action is final, meaning that it cannot be followed by an action (it has to be the last action within its branch, not even followed by a Hangup). |Property |Type|Default|Note| |-|-|-|-| |dial|String|(required)|must be a valid E164 MSISDN; the parameter can be constructed using variables| [block:code] { "codes": [ { "code": "{\n \"dial\": \"41793026731\"\n}\n", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "title": "Play" } [/block] A Play action performs playback of audio provided by the client’s URL. |Property |Type|Default|Note| |-|-|-|-| |playFromUrlString|(required)||file URL| [block:code] { "codes": [ { "code": "{\n \"playFromUrl\": \"http://www.example.com/voice/sound.mp3\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Record" } [/block] A Record action performs recording of a portion of the call. |Property |Type|Default|Note| |-|-|-|-| |record|Number||the duration to record for in seconds; `null` for unlimited| |escapeDigits|String||DTMF codes which should stop recording when input by the user| |beep|Boolean|`false`|flag indicating a beep sound should be played at the start of the recording| |maxSilence|Number||The amount of silence to wait for before stopping the recording| [block:code] { "codes": [ { "code": "{\n \"record\": 10,\n \"options\": {\n \t\"escapeDigits\": \"123*\",\n \t\"beep\": true,\n \"maxSilence\": 3\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Call API" } [/block] A Call API Action performs an HTTP request to a client's endpoint, and (if told to) processes the response data. If `collectResponse` is set, the system will attempt to parse the response from the server. The parsing algorithm is quite naive: based on the `Accept` header (or `Content-Type` header, if `Accept` header is missing), it will attempt to parse the response into a simple one-level object, and save all its fields as variables. Any response property with a reserved name is ignored. The response payload is limited by size to 32kB. If exceeded, the scenario is aborted. Any I/O exception during the action will be raised, interrupting scenario execution. Currently, this is not applied for non-200 HTTP status codes received (such responses are ignored). |Property|Type|Default|Note| |-|-|-|-| |request|String|(required)|the URL to target| |options > method|String|(required)|GET, POST, PUT, DELETE| |options > headers|Object|(required, for content-type)|| |options > body|String or Object|(required for body-enclosing methods)|the request body to send| |options > collectResponse|boolean|false|if set, will cause the system to process the response| [block:code] { "codes": [ { "code": "{\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"payload\": \"${to} finished the IVR.\"\n }\n }\n}", "language": "json" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"GET\",\n \"headers\": {\n \"accept\": \"application/xml\",\n \"authorization\": \"Basic dXNlcjpwYXNz\"\n },\n \"collectResponse\": true\n }\n}", "language": "json" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"PUT\",\n \"headers\": {\n \"content-type\": \"application/xml\",\n \"accept\": \"application/xml\"\n },\n \"body\": \"<request><payload>${to} finished the IVR.</payload></request>\",\n \"collectResponse\": true\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Switch - Case" } [/block] A Switch - Case action takes a saved variable (obtained via either a Collect or a Call API action) and performs flow control based on it. It works similarly to the switch case block, using case-sensitive comparison. |Property|Type|Default|Note| |-|-|-|-| |switch|String|(required)|name of the variable whose value to inspect| |case|Object|(required)|object whose keys are possible variable values, and values are arrays of actions| |__default|Array||array of actions to execute if none of the conditions above are met| [block:code] { "codes": [ { "code": "{\n \"switch\": \"myVariable\",\n \"case\": {\n \"1\": [\n {\n \"dial\": \"41793026731\"\n }\n ],\n \"2\": [\n {\n \"playFromUrl\": \"http://www.example.com/voice/advanced\"\n }\n ],\n \"3\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"payload\": \"${to} finished the IVR.\"\n }\n }\n }\n ],\n \"4\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"GET\",\n \"collectResponse\": true\n }\n }\n ],\n \"5\": [\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"PUT\",\n \"headers\": {\n \"content-type\": \"application/xml\",\n \"accept\": \"application/xml\"\n },\n \"body\": \"<request><payload>${to} finished the IVR.</payload></request>\",\n \"collectResponse\": true\n }\n }\n ],\n \"__default\": [\n {\n \"say\": \"Dear Customer, you pressed wrong number. Please, try again.\"\n },\n {\n \"collectInto\": \"myVariable\",\n \"options\": {\n \"maxInputLength\": 1\n }\n }\n ]\n }\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "title": "Repeat - Until" } [/block] A Repeat - Until loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given boolean condition in the until field. Comparison is done using equal (`==`) or not equal (`! =`) operators. [block:code] { "codes": [ { "code": "{\n \"repeat\": [\n { \"say\": \"For exit you must press one.\" },\n { \"collectInto\": \"myVariable\" }\n ],\n \"until\": \"${myVariable} == 1\"\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "While - Do" } [/block] Loops can execute a do field block of code as long as a specified condition is true in the while field. As with Repeat - Until, comparison is done using equal (`==`) or not equal (`! =`) operators. [block:code] { "codes": [ { "code": "{\n \"while\": \"${myVariable} != 1\",\n \"do\": [\n { \"say\": \"For exit you must press one.\" },\n { \"collectInto\": \"myVariable\" }\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Hang up" } [/block] A Hangup action is a pseudo-action marking the end of the IVR flow execution, leading to the call actually being hung up. [block:code] { "codes": [ { "code": "\"hangup\"", "language": "json" } ] } [/block] [block:api-header] { "title": "IVR use cases" } [/block] Various IVR scenarios could be created by combining available actions. Here are just a few samples that you might check out before creating your own. [Scheduling an appointment](#scheduling-an-appointment) [Checking order/delivery status](#checking-orderdelivery-status) [Cart abandonment](#cart-abandonment) [block:api-header] { "title": "Scheduling an appointment" } [/block] A simple use case to call a customer to schedule an appointment via IVR. The IVR workflow can offer the customer a range of appointment options. Here’s how this process would work. The client sets up a Scenario and uses the received ScenarioId to [Launch Outbound IVR API](/docs/launch-outbound-ivr). Our platform will initiate a call to each destination phone number specified. Once the call is answered, the IVR flow will start playing an audio message inviting the customer to pick one of the available appointment times using DTMF keys. Here’s how the steps look. Code samples and a flow diagram are below: 1. Call customer phone number 2. Once the customer picks up the phone, the IVR message is played: *Dear client, we would like to schedule an appointment for you on October 14th. Available times are 10:00 am, 11 am, and 2:00 pm. Please press 1 for 10 am, 2 for 11 am, or 3 for a 2 pm appointment. If none of these work for you, we will send a new message suggesting different time slots. * 3. Collect action gathers the DTMF code entered by end user 4. User input is analyzed and, based on the DTMF, one of the following responses is played:: 4a For DTMF 1, 2 or 3: *Thank you. Your appointment is scheduled.* 4b For any other DTMF or no DTMF: *Thank you We will suggest another time slot once it’s available. * [block:image] { "images": [ { "image": [ "https://files.readme.io/f18eddf-Scheduling.jpg", "Scheduling.jpg", 1350, 1180, "#f3ebf3" ] } ] } [/block] ##Example [block:code] { "codes": [ { "code": "{\n \"name\": \"scenario\",\n \"script\": [\n {\n \"say\": \"Dear client, we would like to schedule an appointment on 14.10. Available time is 10:00 am, 11 am and 2:00 pm. Please press 1 for 10 am, 2 for 11 or 3 for a 2 pm meeting. If non of the above suits you, we will send new message suggesting different time frame.\"\n },\n {\n \"collectInto\": \"scheduleTime\"\n },\n {\n \"switch\": \"scheduleTime\",\n \"case\": {\n \"1\": [\n {\n \"say\": \"Thank you. Your appointment is scheduled for 10 am.\"\n }\n ],\n \"2\":[\n {\n \"say\": \"Thank you. Your appointment is scheduled for 11 am.\"\n }\n ],\n \"3\":[\n {\n \"say\": \"Thank you. Your appointment is scheduled for 2 pm.\"\n }\n ],\n \"__default\": [\n {\n \"say\": \"Thank you We will suggest another time slot once it’s available.\"\n },\n \"hangup\"\n ]\n }\n },\n { \"say\": \"Thank you. Your appointment is scheduled.\" },\n \"hangup\"\n ]\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "title": "Checking order/delivery status" } [/block] A package delivery company would like to automate customers checking the delivery status of orders and offer customers 24/7 updates on deliveries. The delivery company would obtain a DID (voice number from Infobip) and create an [Inbound IVR workflow](/docs/inbound-ivr-setup) to respond to customer queries. An IVR workflow can update customers around the clock and on weekends and holidays. A well-designed IVR workflow will reduce the workload on live agents for these simple requests. In this scenario a customer calls a number and enters a tracking number through DTMF codes which can be checked against the company’s backend systems. The response back is handled by the Text To Speech (TTS) Say action. Here is how the process looks like step by step. 1. Customer dials a DID number 2. IVR answers the call and plays a message: *Welcome to Acme Co Delivery. To track your package, please enter your 5 digit tracking number.* 3. Using Collect actions IVR gathers a DTMF code entered by the customer. 4. In order the check the status of the order, IVR flow calls client’s systems using Call API action and the 5 digit code that was entered by the customer. 5. IVR performs Say action based on the backend system’s response from step 4. e.g.: *Your package is at your local post office and is scheduled to be delivered tomorrow.* 6. To provide a possibility to talk to a real agent, additional action offering to transfer the call is added. IVR plays an audio: *If you have any questions or need to reschedule the delivery, press 1 to speak with an agent.* 7. The response is gathered once more using the Collect action 8. If the customer didn’t press 1, the call is ended. If the customer entered 1, the IVR workflow dials the predefined client's number and the call will last until ended by an agent or customer. [block:image] { "images": [ { "image": [ "https://files.readme.io/dcb1ebe-Order.jpg", "Order.jpg", 1566, 1900, "#f2ebf3" ] } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"name\": \"scenario\",\n \"script\": [\n {\n \"say\": \"Welcome to Acme Co Delivery. To track your package, please enter your 5 digit your tracking number.\"\n },\n {\n \"collectInto\": \"code\",\n \"options\": {\n \"maxInputLength\": 5\n }\n },\n {\n \"request\": \"https://requestb.in/12345\",\n \"options\": {\n \"method\": \"POST\",\n \"headers\": {\n \"content-type\": \"application/json\"\n },\n \"body\": {\n \"code\": \"${code}\"\n },\n \"collectResponse\":true\n }\n },\n {\n \"say\": \"responseMessage\"\n },\n {\"say\": \"If you have any questions or need to reschedule the delivery, press 1 to speak with an agent.\"},\n {\n \"collectInto\": \"satisfiedAnswer\"\n },\n {\n \"switch\": \"satisfiedAnswer\",\n \"case\": {\n \"1\": [\n {\n \"dial\": \"41793026731\"\n }\n ]\n }\n },\n \"hangup\"\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Cart abandonment" } [/block] Client has an online store and everyday notices customers clicking and checking out products, even adding them to their shopping carts. But one thing is missing and it is the most important one - checkout and conclusion of the buying process. In order to remind customers and ask them why they did not finish the process, client could send an IVR survey that should give some context on what is going on when users interact with your page. Maybe there is something that needs to be changed in the online buying process or at least to know that some customers are not serious buyers. Let us break down this process in steps. 1. Customer logs in to the web shop and stores a couple of products inside his shopping cart 2. After some time he leaves the web shop without completing the buying process 3. This is noticed by the client's back end system and this will trigger an IVR scenario ID towards that customer/destination 4. Based on the scenario the customer can be asked the following question: *Dear customer we see that you have some goods in your cart. Would you like us to notify you once the product in your basket becomes discounted? Press 1 for yes, press 2 for no, press 5 to talk with an agent and get more information.* 5. Customer response will be collected and call API action will enable client to receive it 6. Based on the response codes (DTMFs) the customer pressed, client will do according actions on his side like updating the CRM, calling the customer with more info etc. [block:image] { "images": [ { "image": [ "https://files.readme.io/22daf13-Card.jpg", "Card.jpg", 1566, 1180, "#f2ebf2" ] } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"name\": \"scenario\",\n \"script\": [\n {\n \"say\": \"Dear customer we see that you have some goods in your cart. Would you like us to notify you once the product in your basket becomes discounted? Press 1 for yes, press 2 for no, press 5 to talk with an agent and get more information.\"\n },\n {\n \"collectInto\": \"DTMFCode\"\n },\n {\n \"switch\": \"DTMFCode\",\n \"case\": {\n \"5\": [\n {\n \"dial\": \"41793026731\"\n }\n ]\n }\n },\n {\n \"say\": \"Thank you.\"\n },\n \"hangup\"\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "title": "Languanges" } [/block] List of languages available for Say action: [block:parameters] { "data": { "0-0": "English", "h-0": "Language", "h-1": "Language shortcut", "0-1": "en", "5-0": "Spanish", "5-1": "es", "6-0": "Catalan", "6-1": "ca", "7-0": "Chinese-Simplified", "8-0": "Chinese-Traditional", "7-1": "zh-cn", "8-1": "zh-tw", "9-0": "Danish", "10-0": "Dutch", "9-1": "da", "10-1": "nl", "11-0": "French", "12-0": "German", "11-1": "fr", "12-1": "de", "13-0": "Italian", "13-1": "it", "14-0": "Japanese", "15-0": "Korean", "14-1": "ja", "15-1": "ko", "16-0": "Norwegian", "16-1": "no", "17-0": "Polish", "18-0": "Portuguese", "17-1": "pl", "18-1": "pt-pt", "19-0": "Portuguese - Brazilian", "20-0": "Russian", "19-1": "pt-br", "20-1": "ru", "21-0": "Swedish", "21-1": "sv", "22-0": "Finnish", "23-0": "Turkish", "22-1": "fi", "23-1": "tr", "24-0": "Welsh", "24-1": "wls", "1-0": "English (British)", "1-1": "en-gb", "2-0": "English (Australian)", "2-1": "en-au", "3-0": "English (Indian)", "3-1": "en-in", "4-0": "English (Welsh)", "4-1": "en-gb-wls" }, "cols": 2, "rows": 25 } [/block]