Inbound IVR setup
Let us show you how to set up an Inbound IVR.
Inbound IVR will allow your customers to dial your dedicated voice number (DID) and get into the IVR flow. You can use an inbound IVR to set up surveys, polls, or to automate your customer support processes.
Prerequisites
In order to use the Inbound IVR service you must purchase a number (DID number). Once you have your number you create a scenario, get a ScenarioID, and use it to set up an Inbound IVR action on the number. Once you complete these steps you are ready to advertise this number to your customers.
Use our Numbers API or Customer portal to purchase Voice enabled phone number.
To setup Inbound IVR use this method: Setup Inbound IVR action
Additional methods:
Setup Inbound IVR
This method allows you to set up an Inbound IVR action for a DID number.
POST https://api.infobip.com/numbers/1/numbers/{numberKey}/actions
Request parameters:
| Property name | Type | Description |
|---|---|---|
| scenarioID | string | Type of number setup (VOICE_IVR). |
Request example
POST /numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
{
"type" : "VOICE_IVR",
"scenarioId" : "scenarioId"
}
curl -X POST \
'https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions' \
-H 'Accept: application/json' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
-H 'Content-Type: application/json' \
-d '{
"type": "VOICE_IVR",
"scenarioId": "scenarioId"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"type\": \"VOICE_IVR\",\n \"scenarioId\": \"scenarioId\"\n}",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"VOICE_IVR\",\n \"scenarioId\": \"scenarioId\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("{base_url}")
payload = "{\n \"type\": \"VOICE_IVR\",\n \"scenarioId\": \"scenarioId\"\n}"
headers = {
'Authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'Accept': "application/json",
'Content-Type': "application/json"
}
conn.request("POST", "numbers,1,numbers,6FED0BC540BFADD9B05ED7D89AAC22FA,actions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.post("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions")
.header("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"VOICE_IVR\",\n \"scenarioId\": \"scenarioId\"\n}")
.asString();
var client = new RestClient("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
request.AddParameter("undefined", "{\n \"type\": \"VOICE_IVR\",\n \"scenarioId\": \"scenarioId\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
var data = JSON.stringify({
"type": "VOICE_IVR",
"scenarioId": "scenarioId"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions");
xhr.setRequestHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
Response:
{
"actionKey": "6FED0BC540BFADD9BD89AAC22FA",
"type": "VOICE_IVR",
"scenarioId": "scenarioId"
}
A successful response is represented by an HTTP status code 200 OK.
Get action
The method will return the action that was set up on a specific number (numberKey).
GET https://api.infobip.com/numbers/1/numbers/{numberKey}/actions
Request example
GET /numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
curl -X GET \
'https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions' \
-H 'Accept: application/json' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("{base_url}")
headers = {
'Authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'Accept': "application/json"
}
conn.request("GET", "numbers,1,numbers,6FED0BC540BFADD9B05ED7D89AAC22FA,actions", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions")
.header("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("Accept", "application/json")
.asString();
var client = new RestClient("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions");
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions");
xhr.setRequestHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("Accept", "application/json");
xhr.send(data);
Response
{
"actions": [
{
"actionKey": "6FED0BC540BFADD9BD89AAC22FA",
"type": "VOICE_IVR"
}
]
}
Delete an Inbound IVR action
This method will delete an Inbound IVR action (actionKey) on a number (numberKey).
DELETE https://api.infobip.com/numbers/1/numbers/{numberKey}/actions/{actionKey}
Request example
DELETE /numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
curl -X DELETE \
'https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA' \
-H 'Accept: application/json' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("{base_url}")
headers = {
'Authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'Accept': "application/json"
}
conn.request("DELETE", "numbers,1,numbers,6FED0BC540BFADD9B05ED7D89AAC22FA,actions,6FED0BC540BFADD9BD89AAC22FA", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.delete("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA")
.header("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("Accept", "application/json")
.asString();
var client = new RestClient("https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://{base_url}/numbers/1/numbers/6FED0BC540BFADD9B05ED7D89AAC22FA/actions/6FED0BC540BFADD9BD89AAC22FA");
xhr.setRequestHeader("Authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("Accept", "application/json");
xhr.send(data);
A successful response is represented by a 204 No Content HTTP status code. There is no response body.