API URL Endpoint: https://api.geniq.io/rest/v1/voice
PARAMETER | FORMAT | REQUIRED | DESCRIPTION | DEFAULT |
recipient | integer | Yes | Recipient’s mobile number including country code without “+” prefix | |
reference | string | Optional | A unique reference ID for keeping track of requests and responses | |
originator | string | Yes | The originator address for the outgoing Voice message. If the given originator address is not whitelisted, a random address will display on the recipient’s phone | |
menus | array | Yes | The list of menus available. The menu allows the recipient to give respond to the caller by pressing the number pad on the phone. – Menu ID: Must be unique – Message – Options: – dtmf – action: Must either ‘return‘ or ‘menus‘ – if ‘return‘, then ‘returnValue‘ must be provided – if ‘menus‘, then ‘targetMenu‘ must be provided – returnValue: Value to be returned – targetMenu: Targeted Menu | |
barge | boolean | Optional | Allow the user to press a DTMF digit before the prompt has finished playing. If a valid input is pressed, the message will stop playing and accept the input. If barge is disabled, the user must listen to the entire prompt before input is accepted. | false |
maxDuration | integer | Optional | The max duration of the call in seconds (max 14400 seconds). If the call is still connected at that time, it will be automatically disconnected. | 60 |
locale | string | Optional | The voice and language you want to use for the text-to-speech message. Supported languages and voices are detailed here. | en-US |
Sample request using CURL:
$ curl -X POST https://api.geniq.io/rest/v1/voice \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"recipient": "6591234567",
"originator": "6531596518",
"reference": "123",
"maxDuration": 30,
"barge": false,
"locale": "en-US",
"menus": [
{
"menuId": "main", // Menu ID, must be unique
"message": "Press 1 for Product 1 or for Product 2.",
"options": [
{
"dtmf": "1",
"action": "return", // End the call
"returnValue": "P1" // Return "P1". Must be a single word
},
{
"dtmf": "2",
"action": "return", // End the call
"returnValue": "P2" // Return "P2". Must be a single word
}
]
}
]
}' \
Sample request using CURL:
$ curl -X POST https://api.geniq.io/rest/v1/voice \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"recipient": "6591234567",
"originator": "6531596518",
"reference": "123",
"maxDuration": 30,
"barge": false,
"locale": "en-US",
"menus": [
{
"menuId": "main", // Menu ID, must be unique
"message": "Press 1 for Product 1 or 2 to continue.",
"options": [
{
"dtmf": "1",
"action": "return", // End the call
"returnValue": "P1" // Return "P1". Must be a single word
},
{
"dtmf": "2",
"action": "menus", // Continue to the targetMenu
"targetMenu": "sub1" // Targeted menu id
}
]
},
{
"menuId": "sub1", // Menu ID, must be unique
"message": "Press 1 for Product 2A or 2 for Product 2B.",
"options": [
{
"dtmf": "1",
"action": "return", // End the call
"returnValue": "P2A" // Return "P2A". Must be a single word
},
{
"dtmf": "2",
"action": "return", // End the call
"returnValue": "P2B" // Return "P2B". Must be a single word
}
]
}
]
}' \
Parameters returned in the API response:
PARAMETER | FORMAT | DESCRIPTION |
reference | string | If reference parameter is submitted during the API request, the same value will be returned |
responseMessage | string | Response message returned from the API call |
responseCode | integer | Response code returned from the API call. Refer to section “Response Codes” for list of possible values |
messageIds | array | A list of unique IDs for each Voice sent. |
Sample Response:
{
"reference":"12345",
"responseMessage":"Success",
"responseCode":"0",
"messageIds":["2f843a76-e9a7-4a78-995c-b6b2eeaa6a2c"]
}