Automatically Mark HubSpot Deals as Lost When Zendrop Orders Are Cancelled
When an order is cancelled in Zendrop, this workflow instantly updates the corresponding HubSpot deal stage to Lost, saving sales reps from manually tracking cancellations and keeping the pipeline accurate.
- 1
Receive the Zendrop Cancellation Webhook
Add a
Webhooknode as the trigger. Set the HTTP method to POST and copy the generated webhook URL. In your Zendrop account under Settings > Webhooks, paste this URL and select theorder.cancelledevent. Every cancellation will now send order data to n8n. The payload will include fields likeorder_id,customer_email, andreference_number. - 2
Extract the Order Reference for HubSpot Lookup
Add a
Setnode to map the important fields from the Zendrop payload. Create a field calledorderRefmapped to{{ $json.body.reference_number }}andcustomerEmailmapped to{{ $json.body.customer_email }}. This keeps downstream nodes clean and readable. Make sure theKeep Only Settoggle is turned on. - 3
Search HubSpot for the Matching Deal
Add an
HTTP Requestnode to call the HubSpot Deals search API. Set the method to POST and the URL tohttps://api.hubapi.com/crm/v3/objects/deals/search. In the Headers section addAuthorizationasBearer YOUR_HUBSPOT_PRIVATE_APP_TOKEN. In the Body (JSON), use{ "filterGroups": [{ "filters": [{ "propertyName": "zendrop_order_id", "operator": "EQ", "value": "{{ $json.orderRef }}" }] }], "properties": ["dealname", "dealstage"] }. Note: create a custom HubSpot deal property namedzendrop_order_idand populate it when deals are created. - 4
Update the Deal Stage to Closed Lost
Add a
HubSpotnode. Select theDealresource and theUpdateoperation. SetDeal IDto{{ $json.results[0].id }}from the previous HTTP Request response. Add a property update fordealstageand enter your HubSpot pipeline's Closed Lost stage ID (find this in HubSpot under Settings > CRM > Deals > Pipelines). Also setclosed_lost_reasontoZendrop order cancelledso reps know the source. - 5
Add a Note to the HubSpot Deal
Add a second
HubSpotnode. Select theEngagementresource and theCreateoperation. SetTypetoNote,Deal IDsto{{ $json.id }}from the update step, andNote BodytoOrder cancelled in Zendrop on {{ $now.toISO() }}. Reference: {{ $('Set').item.json.orderRef }}. This gives sales reps full context directly inside the deal timeline without leaving HubSpot.
Frequently asked questions
What if the HubSpot search returns no matching deal?
Add an IF node between the search and update steps to check whether `{{ $json.results.length }}` is greater than 0. If no deal is found, route that branch to a Slack or email notification so a sales rep can investigate manually.
How do I find my HubSpot Closed Lost stage ID?
In HubSpot go to Settings > CRM > Deals, click on your pipeline, then hover over the Closed Lost stage. The stage ID appears in the page URL or you can retrieve all stages via the HubSpot Pipelines API at GET /crm/v3/pipelines/deals.
Does this workflow handle partial cancellations or only full order cancellations?
This recipe handles full order cancellation events from Zendrop. If Zendrop sends a separate event type for partial cancellations, add a Set node after the webhook to filter by `{{ $json.body.event_type === 'order.cancelled' }}` and adjust the deal update logic to reflect a partial loss in the deal amount rather than fully closing it as lost.