Quick overview
Youtube Video: https://youtu.be/VoUdAl2f2KE
This workflow runs hourly to scan HubSpot deals for risk signals, uses Google Gemini to generate a diagnosis and follow-up email draft, writes the findings back to HubSpot as notes/tasks, and posts a prioritized rescue report to Slack.
How it works
- Runs every hour on a schedule trigger.
- Pulls all HubSpot deals and scores them to identify open deals at risk based on inactivity, overdue next steps, and close-date pressure while skipping deals already audited today.
- Processes at-risk deals in batches, fetching the most recent HubSpot notes and CRM emails for each deal to build a short activity timeline.
- Sends the deal context to Google Gemini through an AI agent to classify the risk, explain the situation, and draft a rep-approved follow-up email.
- Updates the HubSpot deal description with a “Deal Rescue Audit” block, then creates a HubSpot note and a prioritized follow-up task associated with the deal.
- Compiles all flagged deals into a single Slack message summarizing total pipeline at risk and the top deal recommendations, and posts it to the selected Slack channel.
Setup
- Connect HubSpot OAuth2 credentials with access to deals, notes, tasks, and (optionally) CRM emails (the workflow continues if email scope is missing).
- Add Google Gemini (PaLM) API credentials for the AI agent and keep the structured JSON output schema as-is.
- Add Slack OAuth credentials and set the target channel for the rescue report message.
- Review/adjust the risk scoring thresholds, closed-stage detection, and the 24-hour deduplication behavior that checks for the audit block in the deal description.