Hi everyone, nice to meet you!
I have two questions regarding analytics reports:
1 Metrics showing 0:
When I request a report with:
metric_names = ["num_messages_sent", "num_messages_received"]
start_dt = datetime(2025, 8, 10, 0, 0, 0)
end_dt = datetime(2026, 3, 1, 0, 0, 0)
account_id = [account_id]I get:
'metrics': [
{'id': 'num_messages_sent', 'type': 'number', 'value': 0},
{'id': 'num_messages_received', 'type': 'number', 'value': 0}
]However, when I manually check the contacts and conversations for this account, there are messages sent in that interval. I don’t understand why the report shows 0. Here is my code if it helps:
metric_names = ["num_messages_sent", "num_messages_received"]
start_dt = datetime(2025, 8, 10, 0, 0, 0)
end_dt = datetime(2026, 3, 1, 0, 0, 0)
account_ids=['acc_xxxxx']
start_ts = int(start_dt.timestamp())
end_ts = int(end_dt.timestamp())
body = {
"start": int(start_ts),
"end": int(end_ts),
"timezone": "UTC",
"filters": {
"account_ids": account_ids,
},
"metrics": metric_names,
}
headers = {
"Authorization": f"Bearer {FRONT_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
}
# create the analytics report
resp = requests.post(
"https://api2.frontapp.com/analytics/reports",
json=body,
headers=headers,
)
resp.raise_for_status()
report = resp.json()
report_url = report["_links"]["self"]
while True:
time.sleep(poll_interval_sec)
check = requests.get(report_url, headers=headers)
check.raise_for_status()
data = check.json()
status = data.get("status")
if status == "done":
break2 Accessing earlier dates:
When I request a report for a date earlier than August 2025, I get:
{'_error': {'status': 403, 'title': 'Forbidden', 'message': 'Your plan does not give you access to that time period.'}}Which plan would allow access to this earlier data?
Thank you very much in advance, and have a great day!
