Re-engage closed lost HubSpot deals with Reply.io sequences
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.
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).
Additional information
What does this prompt do?
- Watches your HubSpot deals and reacts the moment one moves to Closed Lost or any other stage you flag as worth revisiting.
- Reads the lost reason and recent activity, then makes a judgment call about whether the contact is a real fit for re-engagement.
- Picks the right Reply.io win-back sequence based on the contact's industry or persona and enrolls them, creating the Reply.io contact if needed.
- Writes a note back on the HubSpot deal explaining which sequence the contact was added to and why, or why you decided to skip them.
What do I need to use this?
- A HubSpot account with permission to read deals and contacts and to write notes and contact properties.
- A Reply.io account with at least one re-engagement sequence built and ready to enroll contacts in.
- A custom contact property in HubSpot to stamp when someone has been enrolled, so the same deal does not re-enroll on later edits.
How can I customize it?
- Change which deal stages count as worth revisiting. Closed Lost is the default, but you can include long-stalled or nurture stages too.
- Tune the rules for skipping. Common skips are lost reasons like not a fit, competitor won, or do not contact.
- Add more sequences and let the agent pick by industry, persona, deal size, or how recently the deal closed.
Frequently asked questions
Will the same deal get re-enrolled every time someone edits it?
What happens to contacts you decide not to re-engage?
Can I use this for stages other than Closed Lost?
What if the contact does not exist in Reply.io yet?
How does the agent decide which sequence to use?
Stop letting good lost deals go cold.
Connect HubSpot and Reply.io once, and every closed lost deal gets a fair shot at a second touch, with the judgment call written right on the record.