Re-engage closed lost HubSpot deals with Reply.io sequences

By General Input

When a HubSpot deal moves to Closed Lost, an agent decides if the contact is worth winning back and enrolls them in the right Reply.io sequence.

Integrations

  • HubSpot
  • Reply.io

Type

Agentic Task

Categories

  • Sales
  • Marketing

Build me an agent workflow that turns closed lost HubSpot deals into smart Reply.io re-engagement enrollments. The trigger is a HubSpot webhook firing when a deal's stage property changes. I will configure HubSpot to send the webhook to General Input when the dealstage property changes on any deal.

When the webhook fires, the agent should do the following:

1. Read the deal ID from the webhook payload and use HubSpot's Get Deal to fetch the deal with its properties (dealstage, closed_lost_reason, amount, dealname, industry, notes_last_updated) and its associated contact IDs. Only proceed if the new stage matches one of the stages I designate as worth revisiting (default: Closed Lost, but I want to be able to list other stage IDs in the agent instructions). If the stage is not on the list, exit silently.

2. Identify the primary contact on the deal. Use HubSpot's Get Deal with associations=contacts to pull the contact IDs, then look up that contact's properties (email, firstname, lastname, industry, persona or jobtitle, and a custom property called re_engagement_enrolled_at) so we know who they are.

3. Idempotency check. If re_engagement_enrolled_at is already set on the contact, do not re-enroll. Skip the rest of the workflow but still write a short HubSpot note on the deal saying we declined to re-enroll because this contact was already added to a re-engagement sequence on that date.

4. Judgment call. Read the closed_lost_reason and any recent engagement notes on the deal. If the lost reason is "not a fit", "competitor won", "do not contact", or "unqualified", skip Reply.io enrollment entirely. Use HubSpot's Create Note to add a note on the deal that says we declined re-enrollment, and include the lost reason verbatim. Stop here.

5. Pick the sequence. Otherwise, use Reply.io's List Sequences to fetch active sequences and match by name to the contact's industry or persona. The agent should use its judgment based on the sequence name (e.g. an "SMB Win-Back" sequence for SMB personas, an "Enterprise Re-engagement" sequence for enterprise, an industry-named sequence when the contact's industry matches). If no sequence matches confidently, fall back to a default sequence whose name I will provide in the agent instructions.

6. Enroll. Use Reply.io's Search Contacts by Email to check whether the contact already exists in Reply.io. If they do, use Add Contact to Sequence with the contact ID. If not, use Add Contact to Sequence with the email, first name, last name, and company so Reply.io creates the contact and enrolls them in one call.

7. Stamp the contact. Use HubSpot's Update Contact on the contact ID to set re_engagement_enrolled_at to the current ISO timestamp, so future stage edits on the same deal do not re-enroll them. (I will create this custom contact property in HubSpot ahead of time.)

8. Log the decision. Use HubSpot's Create Note to write a note on the deal that explains which Reply.io sequence the contact was enrolled in, why that sequence was chosen, and a link to the contact. Keep the note short and human-readable so the deal owner can see exactly what happened.

Error handling: if Reply.io returns 409 (contact already in sequence), treat that as a soft success, still stamp the contact and write the note. If any HubSpot or Reply.io call fails after retries, write a note on the deal explaining the failure so a human can finish the enrollment manually.

Integrations: HubSpot (webhook trigger, Get Deal, Search Contacts, Update Contact, Create Note) and Reply.io (List Sequences, Search Contacts by Email, Add Contact to Sequence).

Related prompts

Explore more prompts
Turn Mailjet email clicks into ranked HubSpot follow-upsiMessage campaign console with pre-flight checks and delivery boardA searchable RFP answer library your bid team drafts fromSee which target accounts just started advertising on LinkedInAccount health board that puts product usage next to your CRMLook up a customer's full chat history mid conversationLusha prospecting workbench with credit-safe revealsWhich companies your LinkedIn ads reach, matched to your CRMLead response desk with a running clock on every new leadApprove Lusha enrichment field by field before HubSpot saves it