Free n8n template

AI sales follow-up sequences n8n template

What it does

This n8n template watches HubSpot for deals that reach a trigger stage, enrolls the deal's contact in a Postgres sequence table, drafts each follow-up with Claude from the deal notes, and sends it as a threaded Gmail reply from the rep. Any inbound email from the contact or their company domain stops the sequence. You need HubSpot, Postgres, Gmail, Anthropic and Slack credentials.

What this workflow does

One schedule runs two branches every 15 minutes during business hours.

Enrollment branch

  1. Find deals in trigger stage searches HubSpot for deals in your chosen stage (for example “Demo completed”) modified in the last two days.
  2. Any deals found? stops the branch when there is nothing new.
  3. Get deal contacts and Get contact details read the deal-to-contact associations and the contacts’ emails in two batch calls.
  4. Enroll new contacts inserts one enrollment per deal in Postgres. The SQL skips suppressed contacts, deals already enrolled, and contacts that already have an active sequence.

Sending branch

  1. Read recent inbound email lists the last two days of inbox mail from the rep’s Gmail.
  2. Stop replied, get due steps stops any sequence where the contact, or anyone at their company domain, wrote in. Replies that say “unsubscribe” go on the suppression list. It then returns the steps that are due.
  3. Find last thread with contact finds the most recent email the rep sent to that contact.
  4. Draft follow-up with Claude writes the step from the deal notes using a strict JSON schema, with rules against invented pricing, discounts or claims.
  5. Validate draft checks length, blocked phrases and dollar amounts, handles refusal and max_tokens stop reasons, and appends the signature, postal address and opt-out line.
  6. Send threaded follow-up replies in the existing Gmail thread, and Advance sequence step schedules the next step or marks the sequence complete.
  7. Anything that fails goes to Alert: follow-up needs attention in Slack.

Before you import

  • A current n8n version, cloud or self-hosted.
  • A HubSpot private app token with read access to deals and contacts.
  • A Postgres database you can create tables in.
  • The rep’s Gmail account connected through Gmail OAuth2.
  • An Anthropic API key and a Slack app with permission to post.

Setup

  1. Import the JSON file into n8n and open the yellow note. Run its SQL to create follow_up_enrollments and follow_up_suppression.
  2. Attach credentials to each node: HubSpot Service Key on the three HubSpot HTTP nodes, Postgres, Gmail OAuth2 on both Gmail nodes and the thread search, Anthropic on the Claude node, Slack on the alert node.
  3. Replace REPLACE_WITH_TRIGGER_STAGE_ID with the internal ID of the HubSpot deal stage that should start a sequence.
  4. In Validate draft, replace REPLACE_WITH_REP_SIGNATURE and REPLACE_WITH_COMPANY_POSTAL_ADDRESS.
  5. Replace REPLACE_WITH_SLACK_CHANNEL with the channel for exceptions.
  6. Set the instance time zone so the cron schedule matches your business hours, and adjust step spacing in Advance sequence step if needed.

Test it

Create a test deal with your own address as the contact, send yourself one email from the rep mailbox, then move the deal into the trigger stage. Run the workflow manually: the enrollment row should appear with next_send_at one day out. Set next_send_at to the past in Postgres and run again; you should get a threaded reply. Reply to it, run once more, and confirm the row changes to stopped_reply.

Make it production-ready

  • Human review first. For the first few weeks, swap the send node for a Slack approval or send drafts to the rep only.
  • Error workflow. Set an n8n error workflow so failed executions page someone, not just the Slack alert.
  • Logging. Keep the enrollment table as your audit trail and report weekly on sends after a reply (the target is zero).
  • Retries and rate limits. The Claude node retries three times. HubSpot and Gmail have per-account limits, so keep the LIMIT 25 in the due-steps query.
  • More stop rules. Add stops for deal stage changes, booked meetings and logged calls before you widen the rollout.
  • Compliance. Keep the opt-out line and postal address in every step. This is general information, not legal advice.

The full build, including reply classification and deliverability rules, is in the sales follow-up sequences guide. If you want help adapting it to your CRM, talk to Lumeor.

Next steps