Sales · n8n

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.

difficulty Intermediatesetup 45 minresult Every Zendrop order cancellation automatically closes the matching HubSpot deal as Lost with a timestamped note, so your pipeline always reflects reality.
  1. 1

    Receive the Zendrop Cancellation Webhook

    Add a Webhook node 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 the order.cancelled event. Every cancellation will now send order data to n8n. The payload will include fields like order_id, customer_email, and reference_number.

  2. 2

    Extract the Order Reference for HubSpot Lookup

    Add a Set node to map the important fields from the Zendrop payload. Create a field called orderRef mapped to {{ $json.body.reference_number }} and customerEmail mapped to {{ $json.body.customer_email }}. This keeps downstream nodes clean and readable. Make sure the Keep Only Set toggle is turned on.

  3. 3

    Search HubSpot for the Matching Deal

    Add an HTTP Request node to call the HubSpot Deals search API. Set the method to POST and the URL to https://api.hubapi.com/crm/v3/objects/deals/search. In the Headers section add Authorization as Bearer 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 named zendrop_order_id and populate it when deals are created.

  4. 4

    Update the Deal Stage to Closed Lost

    Add a HubSpot node. Select the Deal resource and the Update operation. Set Deal ID to {{ $json.results[0].id }} from the previous HTTP Request response. Add a property update for dealstage and enter your HubSpot pipeline's Closed Lost stage ID (find this in HubSpot under Settings > CRM > Deals > Pipelines). Also set closed_lost_reason to Zendrop order cancelled so reps know the source.

  5. 5

    Add a Note to the HubSpot Deal

    Add a second HubSpot node. Select the Engagement resource and the Create operation. Set Type to Note, Deal IDs to {{ $json.id }} from the update step, and Note Body to Order 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.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.