Campaigns¶
Contact center - Campaigns API documentation¶
Table of contents¶
Get access token
Get Campaigns status and Leads by status
Get Leads status by Campaign
Get Queues status
Get Campaigns activity
Add Lead to campaign
Set Lead status
Delete Lead
Set call disposition to voicemail
Endpoints¶
Get access token¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/login |
| verb | POST |
| request body |
{ "username": "yourUserName", "password": "yourPassword", "domain": "yourTenant" } |
| Response | |
| Code | Description |
| 200 |
Response body: { "user": { ... }, "access_token": "{access_token_value}", "refresh_token": "{refresh_token_value}" } |
| 400 | The information sent is invalid. |
| 500 | Error due to an internal issue. |
Get Campaigns status and Leads by Status¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/reports/campaigns/leads/status |
| verb | GET |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 |
Response body: { “campaing_id_1”: { “name”: “campaign_1”, “status”: “stopped”, “total_leads”: 44, “leads_by_status”: { “new”: 4, “success”: 10, “failed”: 5, “success”: 25 } } … “campaing_id_n”: { “name”: “campaign_n”, “status”: “stopped”, “total_leads”: 53, “leads_by_status”: { “new”: 8, “success”: 15, “failed”: 5, “success”: 25 } } } |
| 400 | The information sent is invalid. |
| 500 | Internal server error |
Get Leads status by Campaign¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/config/campaigns/{campaign_id}/leads |
| query param | page_size |
| query param | next_start_key |
| verb | GET |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 |
Response body: { [{ "created": 1665762498, "campaign_id": "210ea5d942f41744f1ef37e84a4965e0", "number": "+12131204", "status": "new", "retries": 11, "first_name": "Piper", "last_name": "Huffman", "priority": 4, "id": "210ea5d942f41744f1ef37e84a59878d" }, { "created": 1665762674, "campaign_id": "210ea5d942f41744f1ef37e84a4965e0", "number": "+12131214", "status": "new", "retries": 11, "first_name": "Yash", "last_name": "Ellwood", "priority": 4, "id": "210ea5d942f41744f1ef37e84a5a1f95" } ], |
| 400 | The information sent is invalid. |
| 500 | Internal server error |
Get Queues Status¶
| Request | |
| endpoint | https://{portalURL}:9443/callcenter/queues/status |
| verb | GET |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 |
Response body: [{ "id": "9ba7842e-f51c-4156-9bee-1f4aa7466b1e", "name": "QueueName", "extension": "5586", "max_time_caller_in_queue": 120, "strategy": "single", "agents": [ { "id": "8d0af2bafb82d021dc1fb5b09996d7d6", "name": "Agent1 Name", "extension": "5865", "extension_is_valid": true, "delay": 0, "timeout": 15, "logged_in": false, "status": "idle", "registered": false, "tags": [{ "id": "6057e10976cba5c054d4a00e8aad9bc8", "name": "Batch-W??B1", "color": "#b306f1" }] }], "calls": {}, "total_agents": 1, "logged_in_agents": 0, "logged_out_agents": 1, "idle_agents": 0, "misconfigured_agents": 0, "agents_registered": 0, "agents_on_call": 0 }] |
| 400 | The information sent is invalid. |
| 500 | Internal server error |
Get Campaigns activity¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/reports/campaigns/leads/history?starDate=1652977920&endDate=1652978220220&pageSize=1000 |
| verb | GET |
| query param | startDate: lower time limit in Unix timestamp |
| query param | endDate: upper time limit in Unix timestamp |
| query param | pageSize: max quantity of records to get |
| query param | startKey: pagination index |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 |
Response body: [{ "datetime": "2022-10-19 23:31:58 +0000 UTC", "timestamp": 1666222318, "campaign_name": "load_test_camp_1", "lead_name": "Raven Shields", "lead_number": "+12195011918", "agent_name": "Jim Jones71", "agent_extension": "1071", "lead_history": [ { "agent": { "delay": 0, "device_endpoints": [], "email": "jones8@jones.com", "endpoint": "009ec0f42923cceb8ce819aee367a215", "ext": "1008", "first_name": "Jim", "last_answered": 1666221871.9237537, "last_attempt": 1666221871.916515, "last_hangup": 0, "last_name": "Jones8", "status": "idle", "timeout": 20, "total_talk_time": 0, "type": "user" }, "event": "campaign dial", "ext": "1008", "last_attempt": 1666222318.0263362, "type": "dial agent", "uuid": "d7bf2f395cf9adddece9dd8df49712f13d39-clicktocall" }] |
| 400 | The information sent is invalid. |
| 500 | Internal server error |
Add Lead to campaign¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/config/campaigns/{campaign_id}/lead |
| verb | PUT |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Request body |
{ “number”: string, “retries”: int, “first_name”: string, “last_name”: string, “type”: string, “priority”: int, “ticket_id”: string, “note”: string, “cool_off”: int } |
| Response | |
| Code | Description |
| 200 | Lead added to campaign successfully. |
| 400 | The information sent is invalid. |
| 500 | Internal server error |
Set lead status¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/config/campaigns/leads/{leadID}/status/{status} |
| verb | POST |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 | Lead status set successfully. |
| 400 | The information sent is invalid. |
| 500 | Error due to an internal issue. |
Delete lead¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/config/campaigns/leads/{leadID} |
| verb | DELETE |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 | Lead deleted successfully. |
| 400 | The information sent is invalid. |
| 500 | Error due to an internal issue. |
Set call disposition to Voicemail¶
| Request | |
| endpoint | https://{portalURL}:9443/api/v2/config/campaigns/call/{cdrID}/disposition/voicemail |
| verb | PUT |
| header | X-Account-ID: {account_id} |
| header | Authorization: “Bearer {access_token_value}” |
| Response | |
| Code | Description |
| 200 | Call disposition set successfully. |
| 400 | The information sent is invalid. |
| 500 | Error due to an internal issue. |