POST: https://{{env}}-api.xebo.ai/v2/api/collectors/{{collect_id}}/campaigns
The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.
"Content-Type": "application/json"
type: Bearer type
token: <access token> granted from login API
Or
x-api-key: <api key copied from the platform>
Content-Type: application/json
Request Parameters
Request Body
{
"collectortoken": "E/f1a0f500",
"medium": 2,
"contacts": [{
"email": "john1@s2c.com",
"city": "Delhi"
}, {
"email": "john2@s2c.com",
"city": "Mumbai"
}]
}
Key | Type | Mandatory | Description |
collectortoken | string | yes | It is unique for every collector. Can be captured from the platform. |
medium | number | yes | 1: SMS 2: Email 3: Whatsapp |
contacts | array | yes | Array for contacts to whom you want to trigger surveys. Also, you can send custom information of the respondents along with it. ‘email’ field is mandatory for medium 2. ‘mobile’ field is mandatory for medium 1. |
curl --location 'https://az4-api.xebo.ai/v2/api/collectors/66c70e71f57bd9efe12d691d/campaigns' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzI0Mzk2ODA1LCJpYXQiOjE3MjQzMTA0MDUsImp0aSI6IjQ4ZmM1YTIxNDNmODQ5MjdhZWY5YTZmZjlmOWU5ODZjIiwidXNlcl9pZCI6IjJkNWQxMTk5LTY4ZTUtNDMyMC1hMjEyLWM2ZjQ1NWU3ZDljYyIsImN1c3RvbV9jbGFpbSI6Ikg0c0lBSVhqeG1ZQy80MVh1WkxqTmhEOWxTbkZabGtIZFczbXhJbERPMGMxZ1NhRkZRaGdBVkFhemRiOHV4dWtKSkxpTVpPSmVOMUFINjhQL1Y1NDlGNGF6YVJZL0hoYnBBZWU4VndjazN5ZFk1S0NTSlBzdUJISkhuYmIvZUc0MysxVHZ2ampiU0U5QTFGS1RUckJWVWducGRHRnVkK3kyNjN5NDFMa1c3RmNiWFo4bGVmYmZMTmFZdFEwcmdBdFBZVDIwVTI2U3RQMWVwTmtKSldr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UDBFL040WmR5QWpUWFNvZ2swcUdHd3VSSjkzWUVVWGhSa3RUNW9qc3B4NWtiRU1wWW9NbG9SYjRWVFZzR3lJVW9OS0VydjhYb016SGxhMnB2djRJdDA0YVIyWjF6UStHeUJQSFRLOHFpSEQwSUNoMkFRcHczWFc3YWRiQ2xQZGRzejFXeHRpZVF4eWN1OFVoZU8zeHFrNmNJc2tLVk1jMjJWZitWWmtBM1ZaWWR0MXNkZ2dXVHJTa2RCc21saFNnZ0lOdGcvSGhCc0k4ZDlMMjAxTVlVOFRneGVsSnpPOXRVUUh1MDdRWHFaOUd4aTRaRmFqc3U3eC9wM3psK1FqRW5mR2VCY2hHTUlmMXZQYjhoS0pTUTVmYnRhbFRHWlJrV2VLb0dkYWhvRFU5cnNYbnVHbzUrdVZHNUx6aDFERVlyWWNCZForV3BaWkVlYTJ4czNKTnJFcHpPMUl2YW1SRVF4OFl2WFIwZmVvWUs4Nmo5L2JXcWRGbHBkOThhZmUvU0k3ZmIvZmY2L1A5TjBxZ2ZENUwrS3NSTUlJUDB6dWNBd3BpT1JWMTcwZTl1QmZNNHovWVgxN0NuLzhZZFNZT1I0eHFSTmZqZ3Znc3FVVGo4aEhsRnArZi93T08wYVordVE0QUFBPT0ifQ.4h7MKol3jaNyuDU_jOwrSW4FiW-kiGTfnGBjAdbOLJc' \
--data-raw '{
"collectortoken": "J/d5730267",
"medium": 2,
"contacts": [{
"email": "john1@s2c.com",
"city": "Delhi"
}, {
"email": "john2@s2c.com",
"city": "Mumbai"
}]
} '
Javascript
var data = JSON.stringify({
"collectortoken": "J/d5730267",
"medium": 2,
"contacts": [
{
"email": "john1@s2c.com",
"city": "Delhi"
},
{
"email": "john2@s2c.com",
"city": "Mumbai"
}
]
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://az4-api.xebo.ai/v2/api/collectors/66c70e71f57bd9efe12d691d/campa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cHpPMUl2YW1SRVF4OFl2WFIwZmVvWUs4Nmo5L2JXcWRGbHBkOThhZmUvU0k3ZmIvZmY2L1A5TjBxZ2ZENUwrS3NSTUlJUDB6dWNBd3BpT1JWMTcwZTl1QmZNNHovWVgxN0NuLzhZZFNZT1I0eHFSTmZqZ3Znc3FVVGo4aEhsRnArZi93T08wYVordVE0QUFBPT0ifQ.4h7MKol3jaNyuDU_jOwrSW4FiW-kiGTfnGBjAdbOLJc");
xhr.send(data);
Responses
{
"msg": "Request data is correct",
"msgId": "632882b8927d9b1e87c2b790",
"data": {
"accepted": 2,
"rejected": 0,
"rejected_list": []
}
}
{
"error": {
"name": "Bad Request",
"message": "Collector not found"
}
}
{ "error": { "name": "Unauthorized", "message": "The authorization token was not provided." } }
{ "error": { "name": "Internal Server Error", "message": "We were not able to process your request" } }
Note: Please do not share your tokens in publicly accessible areas or to anyone. Also, this token generated is valid for 24 hours only. After its expiry, you can regenerate the access token from the same API endpoint by passing the username and password or from the refresh token API with the help of refresh token.