Darmowy szablon automatyzacji

Trener fitnessu AI Strava Analiza danych i spersonalizowane spostrzeżenia treningowe

5310
25 dni temu
15
bloków

Triathlon Coach AI Workflow: Analiza danych Strava i spersonalizowane wskazówki treningowe w n8n

Ten szablon automatyzacji w n8n pozwala stworzyć wirtualnego trenera triathlonowego wykorzystującego sztuczną inteligencję. Integruje się z platformą Strava, analizuje dane aktywności i dostarcza sportowcom praktyczne wskazówki treningowe.

Szczegóły workflow

Trigger: Aktualizacje aktywności w Strava

Węzeł Strava Trigger przechwytuje dane o nowych lub zmodyfikowanych aktywnościach. Przetwarza kluczowe metryki takie jak dystans, tempo, wysokość nad poziomem morza czy tętno.

Krok 1: Wstępne przetwarzanie danych

Węzeł Code porządkuje surowe dane z Strava, przekształcając je w ustrukturyzowany format gotowy do dalszej analizy.

Krok 2: Analiza AI z Google Gemini

Węzeł Google Gemini Chat Model wykorzystuje zaawansowany model językowy do:

  • Identyfikacji kluczowych wskaźników wydolnościowych
  • Generowania spersonalizowanych wskazówek dla różnych dyscyplin (pływanie, kolarstwo, bieganie)
  • Dostarczania motywujących porad i rekomendacji

Krok 3-5: Przygotowanie i wysyłka wyników

Workflow przekształca odpowiedź AI w czytelny format (HTML), a następnie wysyła szczegółowy raport mailem lub w formie powiadomienia WhatsApp.

Przykłady zastosowań

Ta automatyzacja znajduje zastosowanie w różnych scenariuszach wspierających sportowców i trenerów:

  • Automatyczne generowanie tygodniowych podsumowań treningowych
  • Monitorowanie postępów w kluczowych metrykach wydolnościowych
  • Wykrywanie oznak przetrenowania na podstawie analizy tętna i tempa
  • Dostosowywanie planów treningowych w oparciu o aktualną formę
  • Wysyłanie motywujących wiadomości przed ważnymi zawodami
  • Identyfikacja słabych punktów wymagających poprawy
  • Automatyzacja komunikacji między trenerem a podopiecznymi

Metryki wydolnościowe

Workflow analizuje między innymi:

  • Pływanie: wskaźnik SWOLF, liczba ruchów, tempo
  • Kolarstwo: kadencja, strefy mocy, przewyższenia
  • Bieganie: rozkład tempa, długość kroku, strefy tętna

Wdrożenie

  1. Konfiguracja klucza API Strava
  2. Integracja z Google Gemini
  3. Dostosowanie szablonów wiadomości
  4. Automatyzacja wykonania workflow

Dodatkowe informacje

Workflow można dostosować do indywidualnych potrzeb poprzez modyfikację promptów AI lub rozszerzenie o dodatkowe węzły analityczne.

   Skopiuj kod szablonu   
{"meta":{"instanceId":"32d80f55a35a7b57f8e47a2ac19558d9f5bcec983a5519d9c29ba713ff4f12c7","templateCredsSetupCompleted":true},"nodes":[{"id":"d9e3e2af-1db4-4ef1-a12a-c56df545e09e","name":"Strava Trigger","type":"n8n-nodes-base.stravaTrigger","position":[-60,0],"webhookId":"c656f7eb-6176-48b1-a68f-7e169699cecb","parameters":{"event":"update","object":"activity","options":{}},"credentials":{"stravaOAuth2Api":{"id":"lI69z0e9sP9DBcrp","name":"Strava account"}},"typeVersion":1},{"id":"344106a7-f1ce-4ef0-be60-8b0dc6c92fe4","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[560,180],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash-exp"},"credentials":{"googlePalmApi":{"id":"MqxJQHgdP5sIvdos","name":"Google Gemini(PaLM) - ali@amjid"}},"typeVersion":1},{"id":"5ea7c2b8-0ddc-414e-b90c-d1269e074d16","name":"Gmail","type":"n8n-nodes-base.gmail","position":[1420,-200],"webhookId":"70ab1218-b5a1-47e7-9e9e-89c5c4f84c15","parameters":{"sendTo":"amjid@amjidali.com","message":"={{ $json.html }}","options":{"appendAttribution":false},"subject":"="},"credentials":{"gmailOAuth2":{"id":"dYWFonU1YWbQ9MHf","name":"Gmail account ali@amjidali"}},"typeVersion":2.1},{"id":"540e2273-c094-4339-a9d9-41cecbaa55d8","name":"Combine Everything","type":"n8n-nodes-base.code","position":[280,0],"parameters":{"jsCode":"// Recursive function to flatten JSON into a single stringnfunction flattenJson(obj, prefix = '') {n let str = '';n for (const key in obj) {n if (typeof obj[key] === 'object' && obj[key] !== null) {n str += flattenJson(obj[key], `${prefix}${key}.`);n } else {n str += `${prefix}${key}: ${obj[key]}\n`;n }n }n return str;n}nn// Get input datanconst data = $input.all();nn// Initialize a variable to store the final outputnlet output = '';nn// Process each itemndata.forEach(item => {n output += flattenJson(item.json);n output += '\n---\n'; // Separator between recordsn});nn// Return the merged string as outputnreturn [{ json: { data: output } }];n"},"typeVersion":2},{"id":"9db17380-36ee-4d8c-842c-f33215bb5e78","name":"Fitness Coach","type":"@n8n/n8n-nodes-langchain.agent","position":[560,0],"parameters":{"text":"=You are an Triathlon Coach specializing in guiding the athlete on running, swimming, and cycling. Your role is to analyze Strava data and provide personalized coaching to help users improve their performance. Your responses must be motivational, data-driven, and tailored to the user's fitness level, goals, and recent activity trends.nn#### Key Abilities:n1. **Analyze Activity Data**:n - Evaluate performance metrics such as distance, pace, heart rate, power, elevation, cadence, and swim strokes.n - Identify trends, strengths, and areas for improvement.nn2. **Provide Feedback**:n - Break down the user's activities and explain their performance in detail (e.g., pacing consistency, effort levels, technique).n - Highlight achievements and areas that need focus.nn3. **Create Improvement Plans**:n - Suggest actionable steps to improve fitness, endurance, speed, or technique based on the user's goals and performance data.n - Recommend specific workouts, recovery plans, or cross-training exercises tailored to the user's needs.nn4. **Set Goals and Challenges**:n - Help the user set realistic short-term and long-term goals (e.g., achieving a new personal best, improving endurance, or preparing for a triathlon).n - Suggest weekly or monthly challenges to stay motivated.nn5. **Motivational Coaching**:n - Provide positive reinforcement and encouragement.n - Help the user maintain consistency and avoid burnout.nn6. ** Data Analysis **n - Do some data formatting also when doing activities ensure to analyze the duration, time, pace etc, too many seonds will not make differnece, try to see the duration which is easy to understand, moreoover, the time of the day when i did activity and so on.nn***Capabilities as a Triathlong Coach:***n** Data Categorization and Context:**nnIdentify whether the activity is swimming, cycling, or running.n-For swimming, distinguish between pool swimming (laps, strokes) and open water swimming (long-distance, sighting).nAdapt recommendations based on activity type, terrain, weather, or other environmental factors.n**Activity-Specific Metrics:**nn -- Swim: Focus on distance, pace, SWOLF, stroke count, and stroke efficiency.n -- Bike: Analyze distance, average speed, cadence, power zones, heart rate, and elevation gain.n -- Run: Examine distance, pace, cadence, stride length, heart rate zones, and elevation changes.nPerformance Analysis and Recommendations:nn** Tailor feedback and advice based on the unique demands of each sport:n - Swimming: Emphasize technique (catch, pull, body position), pacing, and breathing drills.n - Cycling: Focus on power output, cadence optimization, endurance rides, and interval training.n - Running: Analyze pace consistency, cadence, stride efficiency, and running economy.nEnvironment-Specific Adjustments:nn - For swimming, account for differences in pool vs. open water conditions (e.g., sighting, drafting, and waves).nFor cycling, consider terrain (flat, hilly, or rolling) and wind resistance.n- For running, factor in surface type (road, trail, or track) and weather conditions.nIntegrated Triathlon Insights:n- nProvide guidance on how each discipline complements the others.nSuggest "brick workouts" (e.g., bike-to-run) for race-specific adaptations.nRecommend recovery strategies that address multi-sport training fatigue.nBehavior:nBe precise, detailed, and motivational.nTailor insights and recommendations to the specific activity type and the athlete’s experience level (beginner, intermediate, advanced).nUse clear, actionable language and explain the reasoning behind suggestions.nInputs You Will Receive:nStrava activity data in JSON or tabular format.nAthlete’s profile information, including goals, upcoming events, and experience level.nMetrics such as distance, pace, speed, cadence, heart rate zones, power, SWOLF, stroke count, and elevation.nOutput Requirements (Activity-Specific):nSwim (Pool):nnAnalyze stroke efficiency, pace consistency, SWOLF, and technique.nSuggest drills for stroke improvement (e.g., catch-up, fingertip drag).nRecommend pacing intervals (e.g., 10x100m at target pace with rest).nSwim (Open Water):nnEvaluate long-distance pacing and sighting frequency.nProvide tips on drafting, breathing bilaterally, and adapting to waves or currents.nSuggest open water-specific workouts (e.g., race-pace simulations with buoy turns).nBike:nnAnalyze power distribution across zones, cadence, and heart rate trends.nHighlight inefficiencies (e.g., low cadence on climbs or inconsistent power).nRecommend specific workouts (e.g., 3x12-minute FTP intervals with 5-minute rest).nSuggest gear and bike fit optimizations if needed.nRun:nnEvaluate pacing strategy, cadence, and heart rate zones.nIdentify inefficiencies in stride length or cadence.nRecommend workouts like tempo runs, intervals, or long runs with negative splits.nProvide race-day pacing strategies or tips for improving running economy.nCross-Discipline Integration:nnSuggest brick workouts to improve transitions (e.g., 30-minute bike + 10-minute run at race pace).nRecommend recovery sessions (e.g., easy swim or bike after a hard run).nAdvise on balancing training load across disciplines.nn#### Expectations:n- **Personalized Responses**: Always consider the user's activity history, goals, and fitness level when offering insights or advice.n- **Practical Guidance**: Provide clear, actionable recommendations.n- **Encouragement**: Keep the tone positive and motivational, celebrating progress while constructively addressing areas for improvement.nn#### Context Awareness:nYou have access to the user's Strava data, including:n- Activity type (e.g., run, swim, bike)n- Distance, pace, and timen- Heart rate and effort levelsn- Elevation gain and route detailsn- Historical performance trendsnn#### Example Prompts You Will Receive:n- "Here are my recent running activities. How can I improve my pace?"n- "This is my swimming data from this week. What should I focus on to improve my technique?"n- "Analyze my cycling activity and tell me how I can climb better next time."nnn#### Goal:nHelp the user achieve their athletic potential by providing precise, actionable feedback and a customized plan to enhance their performance and enjoyment of their activities.nnHere is the Activity Data : n{{ $json.data }}","agent":"conversationalAgent","options":{},"promptType":"define"},"typeVersion":1.7},{"id":"7eaec341-33e0-492f-b87d-7a6dcf3d288e","name":"Structure Output","type":"n8n-nodes-base.code","position":[1020,-140],"parameters":{"jsCode":"// Input JSON from the previous nodenconst input = $json.output;nn// Split the input into sections based on double newlinesnconst sections = input.split('\n\n');nn// Initialize the result arraynconst result = [];nn// Process each sectionnsections.forEach((section) => {n const trimmedSection = section.trim();nn // Handle headings marked with ** (bold)n if (/^\*\*(.*?)\*\*$/.test(trimmedSection)) {n result.push({ type: 'heading', content: trimmedSection.replace(/\*\*(.*?)\*\*/, '$1') });n }n // Handle bullet lists marked with *n else if (trimmedSection.startsWith('*')) {n const listItems = trimmedSection.split('\n').map((item) => item.trim().replace(/^\*\s/, ''));n result.push({ type: 'list', items: listItems });n }n // Handle numbered listsn else if (/^\d+\.\s/.test(trimmedSection)) {n const numberedItems = trimmedSection.split('\n').map((item) => item.trim().replace(/^\d+\.\s/, ''));n result.push({ type: 'numbered-list', items: numberedItems });n }n // Handle paragraphsn else {n result.push({ type: 'paragraph', content: trimmedSection });n }n});nn// Return the result arraynreturn result.map(item => ({ json: item }));n"},"typeVersion":2},{"id":"c70da1ca-72c2-4a95-acaf-4efc23ae3f6e","name":"Conver to HTML","type":"n8n-nodes-base.code","position":[1060,60],"parameters":{"jsCode":"// Get input data from n8nnconst inputData = $input.all(); // Fetch all input data itemsnn// Function to convert JSON data into a single HTML stringnfunction convertToHTML(data) {n let html = '';nn data.forEach((item) => {n switch (item.json.type) {n case 'paragraph':n html += `

${item.json.content}

`;n break;n case 'heading':n html += `

${item.json.content}

`;n break;n case 'list':n html += '
    ';n item.json.items.forEach((listItem) => {n html += `
  • ${listItem}
  • `;n });n html += '
';n break;n case 'numbered-list':n html += '
    ';n item.json.items.forEach((listItem) => {n html += `
  1. ${listItem}
  2. `;n });n html += '
';n break;n default:n break;n }n });nn return html;n}nn// Convert inputData to a single HTML stringnconst singleHTML = convertToHTML(inputData);nn// Return as a single itemnreturn [{ json: { html: singleHTML } }];n"},"typeVersion":2},{"id":"b646220c-a0c9-4af7-a2a8-09cec619ecbf","name":"Send Email","type":"n8n-nodes-base.emailSend","position":[1420,0],"parameters":{"html":"={{ $json.html }}","options":{"appendAttribution":false},"subject":"=New Activity on Strava","toEmail":"email@gmail.com","fromEmail":"Fitness Coach "},"credentials":{"smtp":{"id":"WpZf64vFcOT99dO6","name":"SMTP OCI Amjid"}},"typeVersion":2.1},{"id":"06d6262d-dd72-4e57-bccb-31d87a9086c9","name":"Code","type":"n8n-nodes-base.code","position":[120,0],"parameters":{"jsCode":"// Loop over input items and add a new field called 'myNewField' to the JSON of each onenfor (const item of $input.all()) {n item.json.myNewField = 1;n}nnreturn $input.all();"},"typeVersion":2},{"id":"14ce1a3c-573b-4b17-a9f1-eab5964ac9c8","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[460,-300],"parameters":{"color":7,"width":444,"height":649,"content":"### Customer Experience Agent (AI)nThe AI Triathlon Coach is an intelligent, data-driven virtual assistant designed to help triathletes optimize their training and performance across swimming, cycling, and running. Using advanced algorithms, it analyzes activity data from platforms like Strava and provides actionable insights tailored to the athlete’s goals, experience level, and specific disciplines.nThis is connected to Gemini 2.0 Flashnn"},"typeVersion":1},{"id":"cccfdcfa-c981-4c8d-8177-d9597b50556c","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[940,-300],"parameters":{"color":5,"width":329,"height":655,"content":"### Convert to HTMLnNow the data will be structured and covnerted to HTML"},"typeVersion":1},{"id":"4618dd06-8754-4ba2-9d86-77d7a4bdbad2","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[-80,-320],"parameters":{"color":6,"width":503,"height":651,"content":"### Get Strava TriggernIf you are using Strava, you can create API Key by logging in to : https://developers.strava.com/nnOnce data is capture you can then structure it, i am commbining all the activity data and sending to next node"},"typeVersion":1},{"id":"2f9626de-789f-4c28-b1bd-189dc1203d46","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-580,-320],"parameters":{"color":4,"width":475.27306699862953,"height":636.1483291619771,"content":"## Developed by Amjid AlinnThank you for using this workflow template. It has taken me countless hours of hard work, research, and dedication to develop, and I sincerely hope it adds value to your work.nnIf you find this template helpful, I kindly ask you to consider supporting my efforts. Your support will help me continue improving and creating more valuable resources.nnYou can contribute via PayPal here:nnhttp://paypal.me/pmptrainingnnFor Full Course about ERPNext or Automation using AI follow below linknnhttp://lms.syncbricks.comnnAdditionally, when sharing this template, I would greatly appreciate it if you include my original information to ensure proper credit is given.nnThank you for your generosity and support!nEmail : amjid@amjidali.comnhttps://linkedin.com/in/amjidalinhttps://syncbricks.comnhttps://youtube.com/@syncbricks"},"typeVersion":1},{"id":"7b6fb4ba-a20b-40b0-9a40-33f18fb6d28b","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[1300,-300],"parameters":{"color":4,"width":609,"height":655,"content":"### Send Personalized ResponsenActivity is analized you can either get the response by Whatsapp , emal, a blog or anything"},"typeVersion":1},{"id":"30197511-1f5b-4d54-af6e-376a3c596b75","name":"WhatsApp Business Cloud","type":"n8n-nodes-base.whatsApp","position":[1420,200],"parameters":{"operation":"send","requestOptions":{},"additionalFields":{}},"credentials":{"whatsAppApi":{"id":"pDzUNbXM7NG3GZto","name":"WhatsApp account"}},"typeVersion":1}],"pinData":{},"connections":{"Code":{"main":[[{"node":"Combine Everything","type":"main","index":0}]]},"Send Email":{"main":[[]]},"Fitness Coach":{"main":[[{"node":"Structure Output","type":"main","index":0}]]},"Conver to HTML":{"main":[[{"node":"Send Email","type":"main","index":0}]]},"Strava Trigger":{"main":[[{"node":"Code","type":"main","index":0}]]},"Structure Output":{"main":[[{"node":"Conver to HTML","type":"main","index":0}]]},"Combine Everything":{"main":[[{"node":"Fitness Coach","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Fitness Coach","type":"ai_languageModel","index":0}]]}}}
  • SMTP
  • email
  • human
  • form
  • wait
  • hitl
  • approval
  • cpde
  • Javascript
  • JS
  • Python
  • Script
  • Custom Code
  • Function
  • LangChain
  • Chat
  • Conversational
  • Plan and Execute
  • ReAct
  • Tools
Planeta AI 2025 
magic-wandmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram