Automate Triathlon Coaching with Strava & Google Gemini in n8n

This n8n workflow automates personalized triathlon coaching by analyzing Strava activity data using Google Gemini AI. It delivers motivational, data-driven insights tailored to swimming, cycling, and running directly via email or WhatsApp, saving hours of manual analysis for athletes and coaches.
stravaTrigger
agent
lmChatGoogleGemini
+3
Workflow Identifier: 1052
NODES in Use: Strava Trigger, Code, agent, lmChatGoogleGemini, Gmail, WhatsApp Business Cloud
Automate coaching with Strava and n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow listens for new or updated activities on Strava and sends personalized triathlon coaching feedback automatically.
It solves the problem of manual data review by quickly processing detailed running, cycling, and swimming stats.
The result is tailored advice sent by email or WhatsApp right after workouts.

The workflow captures raw Strava data, flattens it into clear text, then asks Google Gemini AI to analyze and create customized coaching.
It formats that coaching into clean HTML and sends it out.


Inputs → Processing → Output

Inputs

  • Strava API: Sends activity updates for running, cycling, swimming.
  • Google Gemini API: Provides AI coaching analysis based on flattened activity data.
  • Gmail and WhatsApp Business Cloud: Deliver coaching feedback messages timed after activity uploads.

Processing Steps

  1. Trigger on Strava activity upload or change.
  2. Run JavaScript to flatten nested JSON data into readable lines.
  3. Send simplified data to the Google Gemini Fitness Coach agent.
  4. Parse AI response and convert to structured HTML.
  5. Prepare and send email with coaching content.
  6. Optionally send WhatsApp message with same content.

Output

Personalized coaching email and WhatsApp message with training insights and advice.


Who Should Use This Workflow

This is for triathletes tracking activities that want quick, clear coaching advice.
People who use Strava regularly and want automated feedback without extra work.

Coaches with multiple athletes can also modify it for scalable, consistent advice.
Non-technical users can set it up inside n8n with some configuration.


Tools and Services

  • Strava API: Sends real-time activity updates.
  • Google Gemini API: AI analyzes activity data and writes coaching feedback.
  • Gmail API: Sends coaching emails automatically.
  • WhatsApp Business Cloud API (optional): Sends coaching messages via chat.
  • n8n Automation Platform: Runs the workflow logic and integrates APIs.

Beginner Step-by-Step: How to Use This Workflow in n8n

Download and Import

  1. Use the Download button on the page to get the workflow file.
  2. Open the n8n editor where you want to run the workflow.
  3. Use the Import from File option to upload the downloaded workflow.

Configure Credentials and Settings

  1. Enter your Strava OAuth API Key in the Strava Trigger node.
  2. Paste Google Gemini API credentials in the AI agent node.
  3. Confirm Gmail OAuth credentials for sending email.
  4. Optionally connect WhatsApp Business Cloud API if used.
  5. Update any recipient emails, WhatsApp phone numbers, or IDs to fit your use.

Test and Activate

  1. Run a test by uploading or updating an activity in Strava.
  2. Confirm the workflow triggers and emails or WhatsApp messages arrive.
  3. Activate the workflow toggle to run automatically.

This method lets you quickly put the workflow in production without building from zero.
For privacy and control, consider self-host n8n.


Code to Flatten Strava Activity JSON

This JavaScript runs inside a Code node to convert complex JSON into string lines for AI consumption.

// Recursive function to flatten JSON into a single string
function flattenJson(obj, prefix = '') {
 let str = '';
 for (const key in obj) {
  if (typeof obj[key] === 'object' && obj[key] !== null) {
   str += flattenJson(obj[key], `${prefix}${key}.`);
  } else {
   str += `${prefix}${key}: ${obj[key]}
`;
  }
 }
 return str;
}

const data = $input.all();
let output = '';
data.forEach(item => {
 output += flattenJson(item.json);
 output += '\n---\n';
});
return [{ json: { data: output } }];

This helps AI clearly read important metrics without confusion.


Customizations

  • Change coaching detail: Adjust prompt in Fitness Coach node to ask for brief or detailed advice.
  • Switch communication: Replace Gmail node with Slack or SMS nodes.
  • Add extra data points: Modify flatten code to include weather or GPS details.
  • Serve many athletes: Setup database nodes to send personalized coaching to multiple users.
  • Language settings: Update AI prompt for coaching in other languages if needed.

Troubleshooting Common Issues

  • Trigger not firing: Check Strava webhook URLs and permissions.
  • Weak AI advice: Ensure complete data is flattened and sent.
  • Email fails to send: Refresh Gmail OAuth credentials.
  • WhatsApp messages missing: Verify WhatsApp API tokens and quota.
  • Broken HTML emails: Test HTML conversion node output before sending.

Pre-Production Checklist


Deployment Guide

After testing, switch workflow to active mode in n8n.
Watch workflow logs for errors regularly.

Setup alerts for email or WhatsApp failures.
Consider self-host n8n for full workflow control.


Summary of Benefits

✓ Saves hours of manual data review weekly.
✓ Delivers personalized coaching fast.
✓ Supports multiple communication channels.
✓ Easy to configure inside n8n.
✓ Flexible for different athlete levels.


Automate coaching with Strava and n8n

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Check Strava webhook URLs are properly registered and OAuth API keys have required permissions.
Incomplete or missing important metrics in the flattened JSON sent to the Google Gemini AI agent.
Expired or incorrect Gmail OAuth credentials prevent automated email sending.
Verify WhatsApp Business Cloud API credentials, refresh tokens, and check message quota limits.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.