A comprehensive Intercom customer support metrics extraction and reporting system that automatically collects key performance indicators from your Intercom workspace and delivers actionable insights via Slack notifications.
IntercomMetrics helps customer support teams monitor and improve their performance by:
- Extracting comprehensive metrics from Intercom API (conversations, response times, SLA performance)
- Analyzing conversation states (open, closed, snoozed) with detailed breakdowns
- Tracking response time trends with 24-hour and 14-day analysis windows
- Generating escalation alerts for critical issues and performance thresholds
- Delivering formatted reports to Slack channels with actionable insights
- Supporting automated workflows via GitHub Actions for scheduled reporting
- Conversation Analysis: Track open, closed, and snoozed conversations with priority breakdowns
- Response Time Monitoring: Analyze first response times and average response times
- Team Performance: Monitor individual admin performance and workload distribution
- SLA Tracking: Analyze SLA compliance and breach notifications
- Spam Filtering: Built-in spam detection to keep metrics accurate
- Pagination Support: Handle large datasets efficiently
- Escalation Analysis: Automated detection of concerning trends and threshold breaches
- Critical Alerts: Real-time notifications for urgent issues requiring immediate attention
- Performance Warnings: Early indicators of potential problems
- Team Health Monitoring: Identify workload imbalances and inactive team members
- Formatted Reports: Clean, readable metrics summaries with emojis and structure
- Multi-Channel Support: Send reports to different channels based on alert severity
- Chart Generation: Visual trends and performance charts (optional)
- Actionable Insights: Highlight conversations needing immediate attention
-
Fork this repository to your GitHub account
-
Set up repository secrets in your GitHub repository settings:
Settings → Secrets and variables → Actions → New repository secret -
Add required secrets:
INTERCOM_ACCESS_TOKEN=your_intercom_token_here SLACK_BOT_TOKEN=xoxb-your-slack-bot-token SLACK_CHANNEL=#your-channel SLACK_ALERTS_CHANNEL=#alerts-channel -
Run the workflow:
- Go to Actions tab → "Intercom Metrics Extraction"
- Click "Run workflow"
- Optionally enable "Also generate and send Slack report"
-
Clone the repository:
git clone https://github.com/muldercw/IntercomMetrics.git cd IntercomMetrics -
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
cp .env.example .env # Create this file with your settings -
Run metrics extraction:
python intercom_metrics.py
-
Send Slack report (optional):
python slack_reporter.py
For users who prefer running on their own infrastructure, you can deploy a self-hosted GitHub Actions runner using Docker:
🐳 Use our Dockerized Runner: muldercw/DOCERKIZED_RUNNER
This provides a complete Docker-based GitHub Actions runner that can be deployed with just:
git clone https://github.com/muldercw/DOCKERIZED_RUNNER.git
cd DOCKERIZED_RUNNER
cp .env.template .env # Configure with your GitHub repository
docker compose up --buildBenefits of self-hosted runners:
- Enhanced Security: Keep sensitive data within your infrastructure
- Cost Control: No GitHub Actions minute usage for private repositories
- Resource Control: Dedicated compute resources for your workflows
- Network Access: Access to internal services and databases
Create a .env file in the project root with the following variables:
# Intercom API Configuration
INTERCOM_ACCESS_TOKEN=your_intercom_access_token
# Basic Configuration
REPORT_TIMEZONE=UTC
EXCLUDE_SPAM_CONVERSATIONS=true
PAGINATE_CONVERSATIONS=true
CONVERSATION_PAGE_SIZE=50
CONVERSATION_MAX_PAGES=2# Slack Configuration (choose one method)
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token # Recommended
# OR
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
# Slack Channels
SLACK_CHANNEL=#intercom-metrics # Main reports
SLACK_ALERTS_CHANNEL=#alerts-support # Critical alerts- Log in to your Intercom workspace
- Go to Settings → Integrations → Developer Hub
- Create a new app or select existing app
- Generate an Access Token with the following permissions:
Read conversationsRead contactsRead companiesRead adminsRead articles(optional)
-
Create a Slack App:
- Go to Slack API
- Click "Create New App" → "From scratch"
- Name your app and select your workspace
-
Configure Bot Permissions:
- Go to "OAuth & Permissions" → "Bot Token Scopes"
- Add these scopes:
chat:write- Send messagesfiles:write- Upload chartschannels:read- Access channel information
-
Install App to Workspace:
- Click "Install App to Workspace"
- Copy the "Bot User OAuth Token" (starts with
xoxb-)
-
Invite Bot to Channels:
/invite @YourBotName
- Create Incoming Webhook:
- Go to your Slack workspace → Apps → Incoming Webhooks
- Click "Add to Slack" and select channel
- Copy the webhook URL
Note: Webhooks have limited functionality compared to bot tokens.
| Variable | Default | Description |
|---|---|---|
EXCLUDE_SPAM_CONVERSATIONS |
true |
Filter out conversations identified as spam |
PAGINATE_CONVERSATIONS |
true |
Fetch all conversations using pagination |
CONVERSATION_PAGE_SIZE |
50 |
Number of conversations per API page |
CONVERSATION_MAX_PAGES |
2 |
Maximum pages to fetch (prevents excessive API usage) |
REPORT_TIMEZONE |
UTC |
Timezone for timestamps in reports |
The included workflow (.github/workflows/intercom_metrics.yml) can be:
-
Triggered manually via the Actions tab
-
Scheduled using cron syntax:
on: schedule: - cron: '0 9 * * 1-5' # 9 AM weekdays
-
Triggered by events:
on: issues: types: [opened, closed]
Set up automated reports using cron:
# Run daily at 9 AM
0 9 * * * cd /path/to/IntercomMetrics && python slack_reporter.py
# Run metrics extraction every 6 hours
0 */6 * * * cd /path/to/IntercomMetrics && python intercom_metrics.pyExtract specific metrics programmatically:
from intercom_metrics import IntercomMetricsClient
client = IntercomMetricsClient(access_token="your_token")
# Get current open conversations
open_convos = client.get_current_open_conversations(limit=20)
# Analyze response times
response_metrics = client.get_detailed_response_metrics_24h(conversation_ids)
# Generate escalation analysis
from slack_reporter import EscalationAnalyzer
analyzer = EscalationAnalyzer()
alerts = analyzer.generate_escalation_report(metrics_data)📊 Intercom Metrics Report - 2024-01-15 09:00
📈 Overview:
• Admins: 5
• Companies: 1,247
• Contacts: 8,932
• Conversations: 156
💬 Conversation Status:
• Open: 23
• Closed: 12,446
• Assigned: 18
• Unassigned: 5
🔄 Open Conversations Details (23 total):
• Assignment: 18 assigned, 5 unassigned
• Response status: 12 awaiting agent, 8 awaiting customer, 3 unknown
• Wait times: <1h(8), 1-4h(6), 4-24h(7), >24h(2)
⚠️ Currently (5 conversations need attention):
1. 🔴 Billing Issue - Account Suspended
Customer: John D. | Wait: 3.2h | 🚨 Unassigned | Status: ⏳ Need to respond
💬 "My account was suspended but I paid my bill yesterday..."
2. 🟡 Integration Problem
Customer: Sarah M. | Wait: 1.5h | 👤 Alice | Status: ⏳ Need to respond
🚨 CRITICAL INTERCOM ALERTS 🚨
• 🚨 CRITICAL: 25 open conversations (threshold: 20)
• 🚨 CRITICAL: Average first response time (24h) is 26.3h (threshold: 24h)
• ⚠️ WARNING: 8 unassigned conversations need attention
Customize alert thresholds by modifying the EscalationAnalyzer configuration:
escalation_config = {
'response_time_thresholds': {
'first_response_critical_hours': 24,
'first_response_warning_hours': 12,
'avg_response_critical_hours': 48,
'avg_response_warning_hours': 24
},
'volume_thresholds': {
'backlog_critical_count': 20,
'backlog_warning_count': 10,
'daily_increase_warning_pct': 50
}
}Extend the system with custom metrics:
def custom_satisfaction_analysis(client):
# Your custom analysis logic
conversations = client.get_conversations_paginated()
# Process satisfaction scores, custom tags, etc.
return custom_metrics
# Integrate into reporting workflow
metrics_data['custom_analysis'] = custom_satisfaction_analysis(client)- Verify your
.envfile exists and contains the token - For GitHub Actions, check that the secret is properly configured
- Ensure the token has the required permissions
- Invite your bot to the target channel:
/invite @YourBotName - Verify the channel name is correct (include # prefix)
- Check that the bot has
chat:writepermission
- Ensure
intercom_metrics.pyran successfully first - Check for any error messages in the script output
- Verify API connectivity and token validity
- Reduce
CONVERSATION_PAGE_SIZE(default: 50) - Increase delays between API calls
- Consider running less frequently
Large Workspaces: For workspaces with thousands of conversations:
- Set
CONVERSATION_MAX_PAGES=1for faster execution - Use
EXCLUDE_SPAM_CONVERSATIONS=trueto reduce noise - Run reports less frequently (daily instead of hourly)
API Usage: Monitor your Intercom API usage:
- Check API rate limits in Intercom developer settings
- Adjust pagination settings based on your API allowance
- Consider upgrading your Intercom plan for higher limits
Enable verbose logging:
export DEBUG=true
python intercom_metrics.pyWe welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following our coding standards
- Test thoroughly with your own Intercom workspace
- Submit a pull request with a clear description
git clone your-fork-url
cd IntercomMetrics
pip install -r requirements.txt
cp .env.example .env # Configure for testing- 📊 Additional chart types and visualizations
- 🔔 New escalation rules and alert types
- 📱 Integration with other communication platforms
- 🎯 Custom metrics and KPI calculations
- 🛠️ Performance improvements and optimizations
- 📚 Documentation improvements and examples
This project is provided as-is for educational and development purposes.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Self-Hosted Runner: DOCERKIZED_RUNNER Repository
- Built for teams using Intercom for customer support
- Designed to work seamlessly with GitHub Actions workflows
- Compatible with self-hosted runners for enhanced security and control