See llms.txt for all machine-readable content.

Back to Templates

Send weekly Salesforce sales behavior coaching reports with Groq and Gmail

Created by

Created by: WeblineIndia || weblineindia
WeblineIndia

Last update

Last update 6 hours ago

Categories

Share


Quick overview

This scheduled workflow pulls last week’s Salesforce opportunities, tasks, and events for a specific rep, computes activity and pipeline health metrics, uses Groq (LLM) to generate coaching insights, creates a QuickChart performance chart URL, and emails a weekly behavioral report via Gmail.

How it works

  1. Runs weekly on a schedule.
  2. Retrieves a target Salesforce user and queries that user’s opportunities with activity in the last week.
  3. Builds an Opportunity ID list, then pulls related Salesforce Tasks and Events and merges them into a single activity stream alongside the opportunities.
  4. Calculates per-opportunity engagement metrics (touches, calls, emails, follow-ups, meetings) and the days since last activity based on activity subjects and dates.
  5. Aggregates the opportunity metrics into per-rep totals including revenue, won/lost deals, and a stale-deal count based on activity gaps.
  6. Generates a QuickChart URL visualizing weekly activity versus outcomes and sends the rep metrics to Groq to produce structured coaching insights.
  7. Combines the chart and AI insights and sends an HTML weekly coaching email through Gmail.

Setup

  1. Connect Salesforce OAuth2 credentials and set the Salesforce User ID used by the workflow to identify the rep.
  2. Verify or adjust the Salesforce opportunity query filters (for example LAST_WEEK and OwnerId) to match your reporting needs.
  3. Connect Groq API credentials for the LLM and keep the structured output schema as-is (or update it if you change the email fields).
  4. Connect Gmail OAuth2 credentials and set the email recipients and sender settings in the Gmail node.
  5. Ensure your Salesforce Task/Event subjects follow predictable keywords (call, email, follow-up, demo/meeting) or update the classifier logic to match your activity naming conventions.

Additional info

How To Customize Nodes

  • Activity Keywords: Edit the classifyActivity function in the Compute Opportunity Activity Metrics node to include your company’s specific Salesforce naming conventions (e.g., adding "Intro Zoom" to the "meeting" category).
  • Chart Aesthetics: In the Generate Performance Chart URL node, you can modify the backgroundColor values or change the type from "bar" to "radar" or "line" for a different visual style.
  • Alternative AI Models: If you reach rate limits on Groq, you can switch the LLM Model node to use llama3-70b-8192 or mixtral-8x7b-32768.

Add‑ons

  • Manager CC: Add a "CC" address to the Send Weekly Coaching Email node so a manager can stay informed of the rep’s self-improvement goals.
  • Slack Summaries: Add a Slack node after the AI analysis to post a "Win of the Week" summary to a team channel.
  • Opportunity Filtering: Modify the SOQL query in the Fetch Opportunities node to only analyze "High Value" deals (e.g., Amount > 10000).

Use Case Examples

  • Stale Deal Recovery: Identifying which deals haven't been touched in 7+ days and creating an immediate follow-up plan.
  • Prospecting Quality Check: Analyzing the ratio of outreach (Emails/Calls) to Meetings to see if the rep's messaging needs adjustment.
  • Funnel Balance: Spotting "New-Lead Bias" where a rep is so focused on new outreach that they forget to close existing meetings.
  • Closing Friction Analysis: Identifying cases where a rep has many meetings but low "Won" rates, signaling a need for objection-handling training.
  • Weekly Goal Setting: Using the "Next Week Action Plan" generated by AI to set measurable targets for the team stand-up.

Troubleshooting Guide

Issue Possible Cause Solution
No opportunities found Incorrect Salesforce User ID Ensure the Get user node is successfully retrieving your recent Salesforce items.
Chart image is broken Invalid Chart Configuration Check the Generate Performance Chart URL node for any syntax errors in the JSON config sent to QuickChart.
AI node returns error Groq API Rate Limit Increase the delay between runs or switch to a different Groq model in the LLM Model node.
Email fails to send Gmail OAuth expired Re-authenticate your Gmail credentials in the n8n settings.

Need Help?

Analyzing sales behavior is a complex task that requires clean data and precise AI prompting. If you need help refining your Salesforce SOQL queries, adjusting the behavioral metrics or integrating this report into a larger sales dashboard, our n8n workflow development experts are ready to assist.

Contact WeblineIndia to help you build, customize or scale your sales automation and AI coaching tools today!