Example — HubSpot deal provisioning
This guide walks through a production-style workflow that:
- Receives a HubSpot deal closed won webhook
- Finds or creates the Patrol customer and environment (idempotent on re-run)
- Updates the HubSpot deal with the new environment details
Create a new workflow under Workflows in Patrol and follow the node configuration below.
Flow overview
Section titled “Flow overview”flowchart TD A[Deal closed won<br/>HubSpot trigger] --> B[Find or create customer] B --> C[Find or create environment] C --> D[Update deal<br/>HubSpot output]
Each step passes context forward. Downstream nodes reference paths like customer.id, environment.name, and trigger.dealId.
Prerequisites
Section titled “Prerequisites”Before building this workflow, set up:
- A connected HubSpot integration with:
crm.objects.deals.readandcrm.objects.companies.readcrm.objects.deals.write(required for the Update deal step)
- A HubSpot automation workflow that POSTs to Patrol’s webhook URL when a deal reaches Closed Won (include
dealId/hs_object_idandportalIdin the body) - At least one service template in Patrol’s catalogue
- A HubSpot deal property to write provisioning notes into (this example uses the internal name
description; use a custom property if your portal does not exposedescriptionon deals)
Node 1 — Deal closed won
Section titled “Node 1 — Deal closed won”| Setting | Value |
|---|---|
| Node type | Deal closed won (hubspot:deal_closed_won) |
| Integration | Your HubSpot integration |
No field mapping is required on the trigger. Patrol merges the webhook body with CRM data into trigger.* paths (for example trigger.dealId, trigger.deal.dealname, trigger.deal.product, trigger.company.name).
Node 2 — Find or create customer
Section titled “Node 2 — Find or create customer”Matches an existing customer by HubSpot company ID, or creates one on first run.
| Field | Mapping | Notes |
|---|---|---|
| Name | trigger.company.name | Falls back to deal name if company name is empty |
| HubSpot company ID (external ref) | trigger.companyId | Used to find the same customer on re-run |
Optional mappings from deal properties:
| Field | Example mapping |
|---|---|
| Support tier | trigger.deal.support_tier |
| Cloud provider | trigger.deal.cloud_provider |
| Cloud region | trigger.deal.cloud_region |
Outputs used downstream: customer.id, customer.name
Node 3 — Find or create environment
Section titled “Node 3 — Find or create environment”Creates the environment on first run; finds the existing record when the same deal triggers again.
| Field | Mapping | Notes |
|---|---|---|
| HubSpot deal ID (external ref) | trigger.dealId | Primary lookup key — auto-filled if omitted |
| Name (create) | (leave blank) | Defaults to {deal name} Environment, e.g. Acme Expansion Environment |
| Service template ID (create) | trigger.deal.product | Map from a HubSpot deal property holding your catalogue template UUID |
| Type (create) | Production | Literal value (no dots) |
You can also set an explicit name template, e.g. New ${trigger.deal.dealname} env, instead of the default.
Outputs used downstream: environment.id, environment.name
Node 4 — Update deal
Section titled “Node 4 — Update deal”Writes provisioning results back to HubSpot.
| Field | Mapping |
|---|---|
| Deal ID | trigger.dealId |
Add a property row for each HubSpot field to update:
| HubSpot property (internal name) | Value |
|---|---|
description | Environment created in Patrol called ${environment.name}. View it here: https://app.usepatrol.dev/environments/${environment.id} |
The property name column must be the HubSpot CRM internal name (e.g. description), not Patrol context notation like deal.description or trigger.deal.description.
After a successful run, HubSpot shows text similar to:
Environment created in Patrol called Acme Expansion Environment. View it here: https://app.usepatrol.dev/environments/0ed70a2c-a8cb-462f-8a19-cac26a87d612
Testing
Section titled “Testing”Use the workflow Debug tab before going live:
- Click Listen for trigger and send a HubSpot webhook test (or close a test deal)
- Step next node through each action
- Expand each step in the execution trace — confirm Field mapping and Resolved values match expectations
- Re-run the same trigger to confirm Find or create environment finds the existing record instead of failing
See Workflows — Test mode for full debug instructions.
Monitoring
Section titled “Monitoring”- Executions tab on the workflow — per-run status, duration, and step details
- Integrations → Event Log — inbound webhooks and outbound HubSpot API calls
Related
Section titled “Related”- Workflows — editor, field mapping, and templating reference
- HubSpot integration — connection and webhook setup