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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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.


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 Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free