1. Home
  2. Docs
  3. Voice
  4. Custom Callout

Custom Callout

API URL Endpoint: https://api.geniq.io/rest/v1/voice

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
recipientintegerYesRecipient’s mobile number including country code without “+” prefix
referencestringOptionalA unique reference ID for keeping track of requests and responses
originatorstringYesThe 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
menusarrayYesThe 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
bargebooleanOptionalAllow 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
maxDurationintegerOptionalThe 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
localestringOptionalThe 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: Basic dXNlcjE6cGFzczE=' \
    -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: Basic dXNlcjE6cGFzczE=' \
    -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:

    PARAMETERFORMATDESCRIPTION
    referencestringIf reference parameter is submitted during the API request, the same value will be returned
    responseMessagestringResponse message returned from the API call
    responseCodeintegerResponse code returned from the API call. Refer to section “Response Codes” for list of possible values
    messageIdsarrayA list of unique IDs for each Voice sent.

    Sample Response:

    {
        "reference":"12345",
        "responseMessage":"Success",
        "responseCode":"0",
        "messageIds":["2f843a76-e9a7-4a78-995c-b6b2eeaa6a2c"]
    }