I am trying to access the agents that are working in my organizations to replicate our reports in the reporting tab of intercom. We have created interesting reports with FRT, closed tickets, open tickets etc. However, instead of using the reports in intercom, I would like to get the same using the API.
Now the problem I am facing is that I can only get myself and FIN rather than access to all the other agents working in the organization. Can you please guide me in what I might be doing wrong.
HEADERS = {
"Authorization": f"Bearer {BEARER_TOKEN}",
"Accept": "application/json",
"Intercom-Version": "2.14"
}
# -------------------------------
# FETCH ALL ADMINS
# -------------------------------
url = "https://api.intercom.io/admins"
response = requests.get(url, headers=HEADERS)
response.raise_for_status() # Will raise an error if request fails
admins_data = response.json()
# -------------------------------
# PRINT ADMINS
# -------------------------------
for admin in admins_data.get("admins", []):
print(f"Name: {admin['name']}")
print(f"Email: {admin['email']}")
print(f"Job Title: {admin.get('job_title')}")
print(f"Away Mode Enabled: {admin.get('away_mode_enabled')}")
print(f"Has Inbox Seat: {admin.get('has_inbox_seat')}")
print(f"Avatar: {admin.get('avatar')}")
print("-" * 40)
My output:
Name: My name Email: my email Job Title: None Away Mode Enabled: False Has Inbox Seat: False Avatar: None ---------------------------------------- Name: Fin Email:fin email Job Title: None Away Mode Enabled: False Has Inbox Seat: False Avatar: None ---------------------------