π¬ Automate stale deal follow-ups in Salesforce with GPT-5.1, email, Slack & tasks
β‘ 289 views Β· π¬ Lead Nurturing & AI Sales Agents
Description
How it works
- Runs every morning at 8:00 using the Schedule Trigger.
- Sets a
stale_daysvalue and queries Salesforce for Opportunities whereStage_Unchanged_Days__cequals that value and the stage is not Closed Won / Closed Lost. - For each βstaleβ Opportunity, loads full deal details and sends them to an OpenAI model.
- The model uses the
query_soqltool to pull recent Notes, the primary Contact, and the Opportunity Owner, then returns a single JSON object with:- a personalized follow-up email for the client,
- a short SMS template,
- a concise Slack summary for the sales team,
- and a ready-to-use Task payload for Salesforce.
- n8n parses that JSON, sends the email via SMTP, posts the Slack message to your chosen channel, and creates a Salesforce Task assigned to the Opportunity Owner so every stalled deal has a clear next step.
Setup steps
Estimated setup time: ~30β45 minutes if your Salesforce, OpenAI, SMTP and Slack credentials are ready.
-
Create
Stage_Unchanged_Days__con Opportunity (Salesforce)- Field Type: Formula (Number, 0 decimal places)
- Formula:
IF( ISBLANK(LastStageChangeDate), TODAY() - DATEVALUE(CreatedDate), TODAY() - DATEVALUE(LastStageChangeDate) ) - This field tracks how many days the Opportunity has been in the current stage.
-
Connect credentials in n8n
- Salesforce OAuth2 for the Salesforce nodes and the
query_soqlHTTP Tool. - OpenAI (or compatible) credential for the βMessage a modelβ node.
- SMTP credential for the customer email node.
- Slack credential for the internal notification node.
- Salesforce OAuth2 for the Salesforce nodes and the
-
Configure your follow-up rules
- In Edit Fields (Set), set
stale_daysto the threshold that defines a stalled deal (e.g. 7, 14, 30). - In Perform a query, optionally refine the SOQL (record types, owners, minimum amount, etc.) to match your pipeline.
- Update the Send Email SMTP Customer node with your real βfromβ address and tweak the wording if needed.
- Point Send Message To Internal Team (Slack) to the right channel or user.
- In Edit Fields (Set), set
-
Test safely
- Turn off the Schedule Trigger and run the workflow manually with a few test Opportunities.
- Inspect the AI output in Message a model and Parse JSON to confirm the structure (
email,sms,slack,task.api_body). - Check that the email and Slack messages look good and that Salesforce Tasks are created, assigned to the right Owner, and linked to the correct Opportunity.
-
Go live
- Re-enable the Schedule Trigger.
- Monitor the first few days to confirm that follow-ups, Slack alerts, and Tasks all behave as expected, then let the automation quietly keep your pipeline clean and moving.
π Nodes Used
Send Email, HTTP Request, Slack, Salesforce, Schedule Trigger, OpenAI
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File