🀝 Send daily CRM summary reports to Mattermost from HubSpot

⚑ 21 views · 🀝 CRM & Sales Operations

Description

Daily Report Generator with Mattermost and HubSpot

This workflow automatically compiles key metrics from HubSpot (and optional internal data sources) into a concise daily summary and posts it to a designated Mattermost channel. It helps sales and marketing teams stay informed without manually pulling reports or navigating multiple dashboards.

Pre-conditions/Requirements

Prerequisites

Required Credentials

Specific Setup Requirements

ComponentRequirementExample/Notes
MattermostCreate an Incoming Webhook or generate a PATSystem Console β†’ Integrations
HubSpotCreate a Private App β†’ Scopes: crm.objects.deals.readSettings β†’ Integrations β†’ Private Apps
SchedulerExternal cron job or n8n’s internal trigger*curl https://n8n.yourdomain.com/webhook/daily_report

*The provided template uses a Webhook node so you can trigger it via any scheduler (e.g., crontab, Zapier, GitHub Actions). Replace with the Cron node if preferred.

How it works

This workflow automatically compiles key metrics from HubSpot (and optional internal data sources) into a concise daily summary and posts it to a designated Mattermost channel. It helps sales and marketing teams stay informed without manually pulling reports or navigating multiple dashboards.

Key Steps:

Set up steps

Setup Time: 15-20 minutes

  1. Import Template: In n8n, go to β€œWorkflows β†’ Import from File” and select the JSON template.
  2. Add Credentials:
    a. HubSpot β†’ New credential β†’ Paste Private App token
    b. Mattermost β†’ New credential β†’ Paste PAT or Webhook URL
  3. Configure Webhook URL: Copy the production URL of the Webhook node and add it to your external scheduler (e.g., crontab, Zapier).
  4. Adjust Query Parameters (HubSpot node): Modify filters (e.g., deal stage, create date) as needed.
  5. Edit Message Template (Code node): Update markdown formatting, include/exclude sections.
  6. Test Run: Manually execute the workflow. Verify the JSON response and Mattermost post.
  7. Activate: Toggle workflow to β€œActive”. Confirm your scheduler triggers it at the desired time.

Node Descriptions

Core Workflow Nodes:

Data Flow:

  1. Webhook β†’ HubSpot
  2. Webhook β†’ HTTP Request
  3. HubSpot + HTTP Request β†’ Merge β†’ Set β†’ Code β†’ If β†’ Mattermost β†’ Respond to Webhook

Customization Examples

Change Report Time Range

// HubSpot Node β†’ Additional Fields
{
  "filterGroups": [{
    "filters": [{
      "propertyName": "createdate",
      "operator": "BETWEEN",
      "highValue": Date.now(),
      "value": Date.now() - 24 * 60 * 60 * 1000 // last 24h
    }]
  }]
}

Format Mattermost Message with Emojis

// Code Node (return statement)
return [{
  json: {
    text: `:bar_chart: **Daily CRM Report**\n\nβ€’ New Deals: ${newDeals}\nβ€’ New Contacts: ${newContacts}\nβ€’ Win Rate: ${winRate}%`
  }
}];

Data Output Format

The workflow outputs structured JSON data:

{
  "status": "success",
  "date": "2024-05-23",
  "hubspot": {
    "new_deals": 12,
    "new_contacts": 34,
    "win_rate": 27.1
  },
  "internal": {
    "tickets_opened": 8,
    "tickets_closed": 6
  },
  "mattermostPostId": "abc123xyz"
}

Troubleshooting

Common Issues

  1. 401 Unauthorized (HubSpot) – Verify Private App token and scopes. Regenerate if necessary.
  2. Message Not Posting – Ensure the Mattermost token has post:write or the webhook URL is valid.

Performance Tips

Pro Tips:


This is a community workflow template provided β€œas-is.” It is not officially supported by n8n GmbH. Always review and test in a development environment before deploying to production.

πŸ”— Nodes Used

HTTP Request, Webhook, Mattermost, HubSpot

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup