# Send closed won HubSpot deals into your Segment analytics

> When a deal is marked Closed Won, the revenue and the account behind it flow straight into your customer data platform, so product analytics knows who actually paid.

- Workflow type: agent
- Services: Twilio Segment, HubSpot, Slack
- Categories: Sales, Product
- Published: 2026-08-10

## What it does

- Watches your CRM for deals that move into Closed Won, and quietly ignores every other stage change
- Pulls the full deal record so the amount, close date, pipeline and deal owner all travel with the event
- Looks up the main contact on the deal and sends their details, their company account and a Deal Closed Won event into your analytics source
- Handles messy records gracefully: if the deal has no contact or no email address, it still records the company and the deal value instead of failing
- Posts a short note in your revenue channel confirming which deal was synced and exactly what was sent

## What you'll need

- A HubSpot account where your team marks deals as Closed Won
- A Segment workspace, plus the name of the source you want the revenue data written into
- Your Segment workspace region (US or EU), so the data lands in the right place
- A Slack workspace and the channel where your revenue updates should appear

## Prompt

When a deal changes stage in HubSpot, close the loop between revenue and product analytics by pushing the win into Segment. Trigger this on a HubSpot webhook subscribed to deal stage changes. The subscription fires on every stage change, so the workflow itself has to filter: read the new stage from the webhook payload, and if it is anything other than Closed Won, stop immediately and do nothing. Do not post to Slack and do not send any tracking calls for deals that landed in some other stage.

When the new stage is Closed Won, use HubSpot "Get Deal" to fetch the full deal by its id, requesting the properties I care about (deal name, amount, currency, close date, pipeline, deal stage and deal owner) along with its associations to contacts and companies. Then take the primary associated contact and use HubSpot "Get Contact" to fetch it, so I have the contact's email address, name and company.

Send three calls into the Segment source I choose during setup. First, Segment "Identify User" for that contact, keyed on a stable identifier such as their email or HubSpot contact id, with traits including email, name, company and plan. Second, Segment "Group User" associating that user with their company account, keyed on the company domain or HubSpot company id, with group traits including the company name, domain and the value of the deal that just closed. Third, Segment "Track Event" with the event name "Deal Closed Won", carrying amount, currency, pipeline and deal owner as event properties, plus the HubSpot deal id and close date so the event can be traced back to the CRM record.

Three implementation details matter here. Segment tracking calls authenticate with a Source WRITE KEY, which is a different credential from the Segment Public API token, so setup must ask me which Source to write into and resolve that Source's write key rather than assuming the API token is enough. Derive a stable messageId for each call from the HubSpot deal id combined with the stage, so duplicate webhook deliveries do not double count revenue. Segment de-duplicates on messageId within a 24 hour window. Finally, Segment rejects data sent to the wrong region, so the US or EU host must match my workspace region.

Use judgement on incomplete records rather than failing the whole run. If the deal has no associated contact, or the contact has no email address, skip the identify and track calls that depend on a user identity and send only the group call keyed on the company domain, so the closed revenue is still captured against the account. If the deal is missing an amount or a currency, send what you do have and note the gap in the Slack message instead of erroring out.

Finish by using Slack "Send a Message" to post a short note in my revenue channel confirming which deal was synced (deal name, amount and owner) and which calls were sent, including a clear note when the contact was missing and only the group call went through. Keep it to a couple of lines, readable at a glance.

## How to customize

- Change which stage counts as a win, for example if you use a custom pipeline with its own closed stage name
- Adjust the traits that travel with each sync, such as plan, industry, company size or contract length
- Pick a different Slack channel, or switch the confirmation note off once you trust the sync
- Rename the event from Deal Closed Won to match the naming convention already used in your tracking plan

## FAQ

### Will this double count revenue if HubSpot sends the same update twice?

No. Each sync is stamped with a unique fingerprint built from the deal and its stage, and Segment recognises repeats and drops them. So if the same deal update arrives more than once, your revenue numbers stay correct.

### What happens if a deal has no contact attached?

The workflow still runs. Instead of skipping the deal entirely, it records the company and the deal value on its own, so the revenue is not lost just because someone forgot to link a contact.

### Does this work if we use a custom sales pipeline?

Yes. The workflow reads the pipeline from the deal itself and passes it through, and you can tell it which stage name counts as a win if yours is not called Closed Won.

### Do I need my developers to set this up?

No. You connect HubSpot, Segment and Slack, then choose the source you want the data written into and the channel for updates. Everything else is handled for you.

### Will other stage changes trigger it, like moving a deal to negotiation?

No. The workflow checks the new stage first and stops immediately unless the deal has genuinely landed in Closed Won, so your channel and your analytics stay quiet the rest of the time.

### Where does the revenue data actually end up?

Wherever your Segment source already sends data, including your warehouse and any connected tools. That is the point: once closed revenue is in the customer data platform, you can join it to product usage.

Use this prompt in General Input: https://www.generalinput.com/prompts/send-closed-won-hubspot-deals-into-your-segment-analytics