Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Quick Overview

This workflow analyzes open Salesforce opportunities and their recent activities, uses Google Gemini to predict deal escalation risk, automatically updates high-risk opportunities in Salesforce, and sends Slack alerts to help sales teams proactively manage at-risk deals.

How it works

  1. Starts manually and retrieves open Salesforce opportunities along with related Task activities from the previous 30 days.
  2. Merges opportunity and activity data to build a complete deal context, including opportunity value, probability, opportunity type, activity history, and completion status.
  3. Processes opportunities in batches, skipping deals with a 100% probability and fully completed engagement, while adding short delays to reduce API load.
  4. Sends each opportunity context to Google Gemini to classify the escalation risk, identify key risk factors, and generate a concise AI summary in JSON format.
  5. Validates and normalizes the AI response, ensuring risk levels are consistent even if the returned data is incomplete or malformed.
  6. For opportunities classified as High Risk, updates the Salesforce Opportunity with the AI-generated risk assessment and sends a formatted Slack notification to the designated recipient.

Setup

  1. Connect Salesforce OAuth2 credentials with permissions to read Opportunities and Tasks and update Opportunity records.
  2. Add Google Gemini API credentials and ensure the selected Gemini model is available in your account.
  3. Connect Slack OAuth2 credentials and configure the target user or channel for risk notifications.
  4. Review the Salesforce SOQL queries and update Opportunity field mappings to match your Salesforce implementation.

Requirements

Customization

  • Risk Analysis: Customize the Gemini prompt to adjust risk evaluation criteria and recommendations.
  • Opportunity Filters: Modify Salesforce queries to include different opportunity stages or date ranges.
  • Slack Alerts: Customize notification formatting or send alerts to different users or channels.
  • Salesforce Updates: Store AI insights in custom fields instead of the Opportunity description.
  • Processing Logic: Adjust batch size and wait intervals to optimize performance for larger datasets.

Additional Info

Who's It For

  • Sales operations teams
  • Revenue operations teams
  • Sales managers
  • Customer success teams
  • Enterprise sales organizations

Add-ons & Enhancements

  • Email notifications for high-risk opportunities
  • Google Sheets or database logging
  • Power BI or Tableau dashboards
  • Scheduled daily or hourly monitoring
  • Medium-risk early warning alerts
  • CRM analytics and reporting

Use Case Examples

  • Detect enterprise deals likely to escalate before they become critical.
  • Monitor overall sales pipeline health using AI.
  • Notify sales managers about opportunities requiring immediate attention.
  • Improve collaboration between sales and customer success teams.
  • Reduce revenue risk by identifying deal slippage early.

Troubleshooting Guide

Issue Possible Cause Solution
No opportunities retrieved Salesforce credentials or permissions are incorrect Verify Salesforce OAuth connection and API permissions
AI response cannot be parsed Gemini response is not valid JSON Update the prompt to enforce structured JSON output
Slack notifications fail Slack credentials or recipient configuration is incorrect Reconnect Slack OAuth credentials and verify recipient settings
Workflow execution is slow Large opportunity volume Reduce batch size or optimize Salesforce queries
Salesforce records are not updated Incorrect Opportunity ID mapping or field permissions Verify field mappings and update permissions
All opportunities are classified as Unknown AI response validation failed Review the validation logic and Gemini prompt

Need Help?

If you need help customizing this workflow, integrating it with your CRM ecosystem, or extending it with AI-powered sales intelligence, predictive analytics, and automated reporting, our WeblineIndia team is ready to assist. Explore our Process Automation Solutions or connect with our n8n workflow development experts to build, customize, and scale your business automation with confidence.

About

AI-powered n8n Salesforce deal risk monitoring workflow that analyzes opportunities and recent activities with Google Gemini, predicts escalation risk, updates Salesforce, and sends Slack alerts. Automate pipeline health monitoring, sales risk analysis, CRM enrichment, and revenue forecasting.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors