See llms.txt for all machine-readable content.

Back to Templates

Update HubSpot contacts from Gmail auto-replies using Claude and Slack

Quick overview

This workflow runs hourly to find Gmail auto-replies and permanent bounces, uses Anthropic Claude to detect when a HubSpot contact has left or is out of office, and posts Slack approvals before updating HubSpot with lead status changes, notes, replacement contacts, or follow-up tasks.

How it works

  1. Runs every hour and loads configuration values like lookback window, approval timeout, and the target Slack channel.
  2. Verifies the HubSpot app token and required scopes before reading any emails.
  3. Searches Gmail for recent auto-replies and bounce messages, deduplicates messages across runs, and filters to one relevant reply per contact.
  4. Looks up each sender (or bounced address) in HubSpot and skips emails not tied to an existing contact or contacts already marked with the configured “left” lead status.
  5. For auto-replies, sends the reply text to Anthropic Claude to classify it as left_company, out_of_office, or other and extract exact supporting quotes and any replacement contact details.
  6. Builds a safe update plan and routes it: posts “left company” and permanent bounce cases to Slack for approval, creates HubSpot follow-up tasks for validated out-of-office return dates, and posts informational Slack alerts for HubSpot lookup errors.
  7. If approved in Slack within the configured window, writes the planned updates to HubSpot (lead status change, CRM note, and optional new replacement contact) and then posts a Slack message summarizing what succeeded or failed.

Setup

  1. Create a HubSpot private app and generate an access token with scopes crm.objects.contacts.read, crm.objects.contacts.write, crm.objects.companies.read, and crm.objects.companies.write, then add it as a HubSpot App Token credential.
  2. Connect your Gmail account so the workflow can search messages, and ensure the Gmail query matches the mailbox/labels you want monitored.
  3. Connect Slack with OAuth, copy the target channel ID, and update the Config node’s slackChannelId (and optionally lookBackDays, leftLeadStatus, approvalWaitHours, and out-of-office settings).
  4. Add your Anthropic credentials and keep or replace the Claude model used for classification.
  5. Confirm that the HubSpot lead status internal value in leftLeadStatus (for example UNQUALIFIED) matches a valid hs_lead_status value in your HubSpot portal.

Requirements

  • HubSpot account (the free CRM works; creating the private app needs super admin rights)
  • Gmail account you send outreach from
  • Slack workspace and the ID of the channel for approvals
  • Anthropic API key for Claude
  • Hourly runs use about 720 executions a month

Customization

  • In Config, set leftLeadStatus to another lead status value used in your HubSpot account.
  • Change lookBackDays, followUpDaysAfterReturn or approvalWaitHours.
  • Set postOutOfOffice to false to add follow-up tasks without a Slack message.
  • Swap the Claude model for any chat model.

Additional info

Nothing changes in HubSpot until you press Approve in Slack, and no answer within 24 hours means no change. Plan HubSpot Changes is plain code: it only uses quotes, addresses and dates found word for word in the reply, and it never adds a shared inbox such as sales@ as a contact. Out-of-office replies get a HubSpot follow-up task for the working day after the person is back.