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.
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.
What does this prompt do?
- 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 do I need to use this?
- 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
How can I customize it?
- 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
FAQs
Will this double count revenue if HubSpot sends the same update twice?
What happens if a deal has no contact attached?
Does this work if we use a custom sales pipeline?
Do I need my developers to set this up?
Will other stage changes trigger it, like moving a deal to negotiation?
Where does the revenue data actually end up?
Related templates
When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.
Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
When a HubSpot deal hits Closed Won, the customer's plan, seats and renewal dates land in your DynamoDB accounts table, with a Slack note showing what changed.
Your product analytics should know which accounts actually paid.
Close the loop between the deals your sales team wins and the usage data your product team already tracks, without anyone copying numbers by hand.