Adding phone numbers from CRM systems
The following Calls API methods are simplified methods for adding a single phone number to the call campaign:
GET https://app.aimylogic.com/api/crmCalls/campaign/{token}/addPhone
POST https://app.aimylogic.com/api/crmCalls/campaign/{token}/addPhone
GET https://app.aimylogic.com/api/crmCalls/campaign/{token}/test/addPhone
In contrast to the main method for adding phone numbers to the campaign, POST /addPhones
, they accept parameters in the URL string rather than in the request body, and the number of supported parameters is limited.
Request parameters
You can pass the following call job settings as request URL parameters:
phone
— the phone number to be called, required parameter.gmtZone
— the customer time zone, optional parameter.
POST /addPhones
apply to the time zone format.Duplicate numbers in call campaigns
Phone numbers are considered duplicates:
- If they have the identical
phone
values and the identicalpayload
objects. - If they have the identical
phone
values and thepayload
field is not specified.
Restrictions for the duplicates are applied in the methods:
GET /api/crmCalls/campaign/{token}/addPhone
POST /api/crmCalls/campaign/{token}/addPhone
If you use the same phone number to test a call campaign, use the GET /api/crmCalls/campaign/{token}/test/addPhone
method.
Restrictions for adding duplicates
Let’s suppose you already added a number to a call campaign. Then you perform a second request to add a duplicate. The result of the second request differs in the following cases:
-
Both requests are performed without an idempotence key :
- If 24 hours have not passed since the first request, the second request returns an error.
- If 24 hours already passed, a new call job is created for this number.
-
Both requests have the same idempotence key:
- If 24 hours have not passed since the first request, the second request is executed successfully, but the call job is not created. The request will returns the ID of the same job that was previously created by the first request.
- If 24 hours already passed, a new job is created for this number, because idempotence keys expire 1 day after their first usage.
-
Requests have different idempotence keys or one of them has no key:
The request is successful, a new call job is created.
Example request
curl --request POST 'https://app.aimylogic.com/api/crmCalls/campaign/8231.7056.1b131df1/addPhone?phone=79123456789&gmtZone=+03:30&name=Alex' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Idempotence-Key: d5f41bd4'
The response to this request will be a string containing the created call job ID.