Contacts Report
This request can be used to retrieve the preferred report on contact activity statistics based on a selected time period which can be a day, week, month or year.
Contacts report includes statistics for each of the following activities: new contacts created, new groups created, contacts served and completed optouts.
HTTP Request
URL | Method | Description |
---|---|---|
https://app.tellody.com/CampaignCloud/Report/ContactChart | POST | Get contacts report |
POST Parameters
All involved parameters in the request are time related.
Name | Description |
---|---|
"from" | This key is set to a date in milliseconds to define the start of the reporting period. Both "from"/"to" keys should be carefully set to mark the correct start/end date of the selected type of window (e.g. week). For example, if a week period is selected, then "from" value points to the first day of the week that is also dictated by "dow" key which is also included in the request (e.g. dow=0 corresponds to Sunday). The user can select any given Sunday in the calendar but the "to" value should be set to the last day of the same week (e.g. Saturday) since a week period is set for "Window" key. |
"to" | This key is set to a date in milliseconds to define the end of the reporting period. See more details in the description of "from" key. |
"unit" | This key can take any of the following string values: hour,day,week,month. |
"window" | This key can take any of the following string values: day,week,month,year. |
"dow" | This key defines the start day of the calendar week to match the localization of the user. For example, if the user is located in Europe, the "dow" should be set to zero indicating that the first day of the week is Sunday. For the US, "dow" should be set to 1 since the first day of the week is Monday. |
Sample Request
Based on the values used in the below request, a daily report is requested and statistics are to be accumulated and presented per hour within the day. The exact day is specified using the appropriate values into "from"/"to" parameters representing the start and end of the selected window (e.g. day) in milliseconds.
So, in the below request, the start date is on 21st July 2015 00h:00m:00s and corresponds to the integer value: 1437426000000 in milliseconds. Similarly, the end of the day is on 21st July 2015 23h:59m:59s.999dec and corresponds to the value: 1439067599999.
#Retrieving the XSRF Token needed for Session
pingResponse = my_session.get("https://app.tellody.com/CampaignCloud/RememberMeController/ping")
#Import the X-XSRF-Token returned from RememberMeController/ping into the request headers
xsrfToken = pingResponse.headers.get("X-XSRF-TOKEN")
#HTTP request header
header = {"Content-Type" : "application/json", "X-XSRF-TOKEN" : xsrfToken}
data = {"from":1437426000000,"to":1437512399999,"unit":"hour","window":"day","dow":0}
response = my_session.post("https://app.tellody.com/CampaignCloud/Report/ContactChart", header, data).json()
print(json.dumps(response,ensure_ascii=False))
Sample Response
Each row represents the contact activities per chosen unit (e.g. per hour). So, since in the above request unit=hour and window=day, in its response below there are 24 rows and values (1 per hour of the day) per activity type. As a result, the first row for each type of activity corresponds to 12AM, the second is for 1AM and so on.
The below sample response indicates the following activities:
Activity Type | Count | Hour |
---|---|---|
Added contacts | 1 | 2PM |
Added contacts | 3 | 3PM |
Optout | 1 | 3PM |
Served Contacts | 1 | 12PM |
{
"contactsAdded":[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
3,
..... (All zeroes)
],
"groupsAdded":[
0,
.....
],
"contactsBlocked":[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
..... (All zeroes)
],
"contactsServed":[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
..... (All zeroes)
]
}
Errors
In case of an error, information may be derived by the HTTP Status in the result of each request (e.g. HTTP 400 – Bad Request).