Skip to content

nomoreshow/intercom_chat_stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Intercom Admin Active Time Report

Monthly away / available activity reporting using Google Apps Script and the Intercom API.

This project generates a fully automated monthly report that calculates Intercom admin active (available) time based on away mode changes. The report is exported to Google Sheets, stored in Google Drive, and emailed automatically.

Intercom does not currently provide a native report for admin active or available time based on away mode history. This script fills that gap.


Features

  • Fetches admins and activity logs from the Intercom API
  • Filters away and available status change events
  • Calculates daily active minutes per admin
  • Flags whether the 7.5-hour (450 minute) daily target is met
  • Generates a Google Spreadsheet with:
    • One sheet per admin (daily breakdown)
    • One summary sheet with totals and averages
  • Applies formatting and conditional highlighting
  • Moves the report to a Google Drive folder if it exists
  • Sends a monthly email with the report link
  • Runs automatically using a time-driven trigger

No manual exports. No recurring checks. No spreadsheet maintenance.


Active time calculation logic

Intercom records admin status changes.

This script treats the time between an available status and the next away status as active working time.

For each admin:

  1. Detect when status changes to available
  2. Measure time until status changes to away
  3. Sum the duration per calendar day

Report output

Summary sheet

Per admin:

  • Total active minutes
  • Total active time (hh:mm)
  • Number of active days
  • Average minutes per day
  • Average active time
  • Whether the 7.5-hour target is met (average)

Admin sheets

One sheet per admin containing:

  • Date
  • Active minutes
  • Active time (hh:mm)
  • 7.5-hour target met (Yes / No)

Formatting

  • Center-aligned tables
  • Frozen header rows
  • Auto-resized columns
  • Conditional formatting
    • Green when target is met
    • Red when target is not met

Requirements

  • Intercom API access with permission to read admins and activity logs
  • Google account with access to:
    • Google Apps Script
    • Google Sheets
    • Google Drive
    • Gmail (for email delivery)

Setup

1. Create the script

  1. Open https://script.google.com
  2. Create a new project
  3. Paste the script into Code.gs

2. Configuration

Edit the following values in the script:

const API_KEY = ‘Bearer YOUR_INTERCOM_API_TOKEN’; const ADMIN_IDS = [‘ADMIN_ID_1’, ‘ADMIN_ID_2’, ‘ADMIN_ID_3’]; const MIN_MINUTES = 450;

  • API_KEY must include the Bearer prefix
  • ADMIN_IDS must match the Intercom admin IDs to include in the report
  • MIN_MINUTES defines the daily target in minutes (default: 7.5 hours)

3. Authorize permissions

Run the function once manually:

generateAdminActiveTimeReport();

Approve permissions for:

  • External requests (Intercom API)
  • Google Sheets
  • Google Drive
  • Sending email

4. Google Drive folder (optional)

If a folder named:

Intercom Reports

exists in Google Drive, the generated spreadsheet will be moved there automatically.
If it does not exist, the file remains in the Drive root.


5. Scheduling

  1. Open Apps Script and go to Triggers
  2. Add a new trigger with:
    • Function: generateAdminActiveTimeReport
    • Event source: Time-driven
    • Type: Month timer
    • Choose a date and time

The script always generates a report for the previous calendar month.


Email delivery

  • The report link is emailed automatically
  • Sent to the Google account that owns the script
  • Additional recipients can be added in the email configuration section

Limitations

  • Only away mode changes are counted
  • Admins who never toggle status will show no data
  • Open available sessions at month end are not closed automatically
  • Dates are grouped using UTC by default
  • Valid Intercom API permissions are required

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

You are free to use, modify, and redistribute this project under the same license terms.


Disclaimer

This project is community-built and is not affiliated with or endorsed by Intercom.

Use this project in accordance with your organization’s policies.

About

Monthly Intercom Admin Active Time Report (Away/Available) – Google Apps Script + Drive + Email

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published