Messages Report
The request can be used to retrieve the preferred report on message activity based on a selected time period which can be a day, week, month or year. The retrieved statistics are the count of SMS, email and undelivered SMS messages.
HTTP Request
URL | Method | Description |
---|---|---|
https://app.tellody.com/CampaignCloud/Report/MessageChart | POST | Get messages 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 should point to the first day of the week that is also dictated by "dow" parameter 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 key "Window". |
"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 is set to any of the following string values: hour,day,week,month. |
"window" | This key is set to 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 weekly report is requested and statistics are to be accumulated and presented per day. The exact week is specified using the appropriate values into "from"/"to" parameters representing the start and end of the selected window (e.g. week) in milliseconds.
So, in the below request, the start of the week is on 12th July 2015 00h:00m:00s and corresponds to the integer value: 1436648400000 in milliseconds. Similarly, the end of the week is on 18th July 2015 23h:59m:59s.999dec and corresponds to the value 1437253199999.
#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":1436648400000,"to":1437253199999,"unit":"day","window":"week","dow":0}
response = my_session.post("https://app.tellody.com/CampaignCloud/Report/MessageChart", header, data).json()
print(json.dumps(response,ensure_ascii=False))
Sample Response
Each row in the below response represents the message activities per chosen unit (e.g. day). So, since in the above request unit=day and window=week, its response below has 7 rows and values (1 per day of the week) per activity type. As a result, the first row for each type of activity corresponds to July 12, the second to July 13 and so on.
The below sample response indicates the following message related activities:
Activity Type | Count | Day |
---|---|---|
undelivered SMS | 14 | Wednesday, July 15 |
undelivered SMS | 65 | Thursday, July 16 |
SMS Attempts | 14 | Wednesday, July 15 |
SMS Attempts | 65 | Thursday, July 16 |
{
"smsUndelivered":[
0,
0,
0,
14,
65,
0,
0
],
"sms":[
0,
0,
0,
14,
65,
0,
0
],
"emails":[
0,
0,
0,
0,
0,
0,
0
],
"unit":"day"
}
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)