Quick overview
This workflow runs every Monday to pull weekly performance data from Google Analytics 4, Google Search Console, and SegMetrics, uses OpenAI to generate an executive marketing brief and audio narration, and posts the formatted summary with an MP3 attachment to a specified Slack channel.
How it works
- Runs every Monday morning on a schedule and loads client settings (properties, API key, Slack channel, and date ranges).
- Fetches current-week and previous-week metrics from Google Analytics 4, plus channel and UTM campaign breakdowns.
- Queries the Google Search Console Search Analytics API for current vs. previous week performance, top queries, and top pages.
- Requests SegMetrics reports for revenue, leads, and ad spend for the current week and previous week.
- Validates GA4 UTM tagging completeness and calculates a UTM health score with the most common issues.
- Aggregates all sources, calculates week-over-week changes, and sends the combined dataset to OpenAI to generate a structured JSON weekly brief.
- Formats the AI brief into Slack-ready text and an audio script, converts the script to an MP3 using OpenAI text-to-speech, and uploads the file to Slack with the summary as the message comment.
Setup
- Add credentials for Google Analytics (GA4 OAuth), Google (OAuth for the Search Console API HTTP requests), OpenAI, and Slack (OAuth2 with permission to upload files).
- Update the client placeholders in the configuration step, including GA4 property ID, Search Console property (site URL or sc-domain), SegMetrics account ID and API key, client name/website, and the target Slack channel ID.
- Invite/authorize the Slack app to the target channel so it can post messages and upload the MP3 attachment.