Adding phone numbers to the campaign
The following Calls API methods are used for adding phone numbers with parameters to the campaign:
GET {host_name}/api/calls/campaign/{token}/addPhonePOST {host_name}/api/calls/campaign/{token}/addPhones
GET /addPhone
GET /addPhone is a simplified method for adding a single number to the campaign. You can pass the following call job settings as request URL parameters:
phone— the number to be called, required parameter.gmtZone— the subscriber’s time zone, optional parameter.
gmtZonemust conform to one of the following formats:
Zfor UTC time.+h,+hh,±hhmm, or±hhmmsswith a number of optional elements:
- a
:separator between hours, minutes, and seconds, e.g.+hh:mm:ss;- either a
UTC, aGMT, or aUTprefix, e.g.GMT-hh:mm.- One of the time zone IDs as specified by IANA TZDB.
You can pass additional arbitrary parameters in the request URL. All parameters are available from the script via $dialer.getPayload.
The request below will create a call job with the following payload:
79110000000as the phone number.- Moscow Time as time zone.
Alexas the subscriber’s name.
curl 'https://app.jaicp.com/api/calls/campaign/8231.7056.1b131df1/addPhone?phone=79110000000&gmtZone=+03:00&name=Alex'The response to this request will be a string containing the created call job ID.
POST /addPhones
POST /addPhones allows passing an unlimited number of phones per request and supports additional settings for configuring the call policy for each number.
Using this method is also preferable when additional parameters are either too long or too numerous.
The following request is equivalent to the one above:
curl --request POST 'https://app.jaicp.com/api/calls/campaign/8231.7056.1b131df1/addPhones' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"phone": 79110000000,
"gmtZone": "+03:00",
"payload": {
"name": "Alex"
}
}
]'The response to this request will be an array of all created call job IDs.
Defining call policy
You can configure custom call parameters when you add phones to a campaign via the Calls API. To do so, pass the required CallJobParameters in the request body when you invoke the POST /addPhones method.
If no parameters are passed, the number is added to the queue and calls are made as usual. When a number with a custom policy is added, however, it gets higher priority than other numbers according to the calling policy.