Skip to content

Build a Monday-Morning Matomo Briefing with n8n and AI

Build a weekly Matomo reporting workflow in n8n with the Reporting API, credential storage, response validation and an AI-written summary.

A weekly Matomo briefing can run through n8n: a schedule retrieves the previous week’s reports, a validation step checks them, and an AI step drafts a short explanation. Email or another delivery node completes the workflow.

This guide uses Matomo’s Reporting API directly. It does not rely on a native Savigny scheduling feature or assume that the Savigny MCP tools can send email.

1. Choose the reporting period

Decide on the website ID, website timezone and recipient before building nodes. Use the last completed calendar week rather than a rolling seven days unless the recipient specifically wants a rolling report. Set the workflow timezone deliberately and run it after the required Matomo reports have been archived.

Begin with manual execution. Add a Schedule Trigger only after one report matches the figures in Matomo.

2. Store authentication in a credential

Create a Matomo token belonging to a user with view access to the required website. In n8n, an HTTP Request node can use a generic Custom Auth credential to inject a request-body value. The credential’s JSON shape is:

{
  "body": {
    "token_auth": "REPLACE_WITH_YOUR_MATOMO_TOKEN"
  }
}

Enter the actual token only in the credential editor. Do not put it in a shared workflow, a prompt or a query-string URL. See n8n’s HTTP credential reference for supported authentication options.

3. Retrieve the visits summary

Configure an HTTP Request node with POST to your Matomo installation’s index.php. Select the credential above and send form URL-encoded body parameters:

module = API
method = VisitsSummary.get
idSite = YOUR_WEBSITE_ID
period = week
date = lastWeek
format = JSON

Use the website ID from Matomo; do not leave the placeholder in place. Check the Matomo API reference for parameter details and available methods. Keep a successful sample response while configuring subsequent nodes.

For channel and page context, add separate report requests using Referrers.getReferrerType and Actions.getPageUrls. Set the same website and period. Choose an explicit row limit and tell the summary writer when it sees only the leading rows.

4. Validate before summarising

Stop the workflow when Matomo returns an error, the response has an unexpected shape or a required metric is absent. A zero count can be valid; a missing count is not automatically zero. Check that you retained the reporting period alongside the data.

Never send the authentication credential to the AI node. Pass only the necessary report fields and context to an approved model provider.

5. Draft a factual briefing

Write a weekly traffic briefing using only the supplied report data.
State the website, exact dates and timezone. Summarise visits,
channels and leading pages. Separate observations from hypotheses.
Do not infer conversions or revenue. If required context is missing,
return a review-needed message instead of a finished report.

Review the first outputs before enabling an email node. Configure the recipient yourself, add failure notifications and limit retained execution data to what your team needs. n8n provides an HTTP Request guide for the underlying node.

For interactive follow-up questions, connect Matomo to ChatGPT through Savigny. For a recurring attachment without AI interpretation, Matomo’s built-in reporting may be sufficient.