Chaining

Chaining WordPress Actions With CRMs and Email

⏱ 16 min

This is where the pieces from Lessons 2 and 3 turn into an actual workflow, not just a single hop. WordPress fires the event, an automation platform enriches it against a CRM, and the result gets sent out as an email, three separate systems, one workflow, zero of it living inside a WordPress plugin.

What you'll learn in this lesson
A real three-step chain
WordPress webhook, HubSpot node, Send Email node, in that order.
Reshaping data between nodes
Using n8n's Edit Fields node so each node gets the field names it expects.
Where to branch on conditions
An IF node deciding whether the CRM update should even happen.
Why order matters
Enrich before you notify, not the other way around, so the email reflects the CRM's state.
Prerequisites

The signed webhook from Lesson 2, firing into an n8n Webhook trigger node. A HubSpot account with API access (or any CRM node your automation platform supports, the pattern is identical). An SMTP credential configured in n8n for the Send Email node.

Step 1: Start from the webhook payload

Reuse the Webhook trigger and signature-verification Code node from Lesson 2. For this example, assume the payload is a new WooCommerce order over a threshold, delivered via the order.created topic, carrying the customer’s email, name, and order total.

Step 2: Reshape the payload with an Edit Fields node

WordPress’s payload field names rarely match what the CRM node expects out of the box. Add an Edit Fields (Set) node right after your signature check to normalize things once, rather than repeating expressions in every later node:

Fields to normalize
1
customer_email
Pulled from body.billing.email in the WooCommerce payload.
2
customer_name
Combined from body.billing.first_name and body.billing.last_name.
3
order_total
body.total, cast to a number.
4
order_id
body.id, kept as-is for the email body later.

Step 3: Branch on whether this order qualifies

Add an IF node checking order_total >= 500 (or whatever threshold matters to your workflow). Only orders that pass continue to the CRM and email steps, this keeps the workflow from creating a HubSpot deal for every single order when only high-value ones need the extra attention.

Step 4: Enrich the CRM with a HubSpot node

Add a HubSpot node, Resource: Contact, Operation: Create/Update (also called “upsert” in some CRM nodes, it updates if the email already exists rather than erroring on a duplicate). Map customer_email to the Email field and customer_name to the name fields. Add a second HubSpot node, Resource: Deal, Operation: Create, mapping order_total to the deal amount and order_id into the deal name, so sales has a CRM record tied back to the actual WordPress order.

// Example HubSpot Deal node input, after the Edit Fields step
{
  "customer_email": "jane@example.com",
  "customer_name": "Jane Doe",
  "order_total": 640.00,
  "order_id": 4821
}

Step 5: Send the confirmation with the Send Email node

Add a Send Email node last, using an SMTP credential. Set From to your sending address, To to {{ $json.customer_email }}, Subject to something like “Thanks for your order, {{ $json.customer_name }}”, and the body referencing order_id and order_total. This node runs after the CRM steps on purpose, if the CRM update fails for some reason, you’d rather the workflow stop there (or branch to an error path) than send a customer a confirmation before the deal actually exists in your CRM.

Test it

Trigger the chain with a real test order over your threshold, then check three places: the HubSpot contact and deal both exist with the right values, and the customer’s inbox (or a test mailbox) received the email. n8n’s Executions tab shows the data at every node along the way, useful for confirming the Edit Fields step actually produced the field names later nodes expected.

A failed CRM step shouldn't silently fall through to the email step

By default, n8n stops a workflow at the first node that throws an error, which is usually what you want here. If you’ve configured the HubSpot node with “Continue on Fail” for some other reason, add an explicit IF check afterward confirming the CRM step actually succeeded before the Send Email node runs, otherwise a failed CRM write and a sent confirmation email can quietly disagree with each other.

Recap

A real multi-step workflow chains a verified WordPress webhook, an Edit Fields node to normalize the payload, an IF node to branch on business logic, a CRM node (HubSpot’s Contact and Deal resources here) to enrich the record, and a Send Email node to close the loop, all without a single line of this logic living in a WordPress plugin. Order matters: enrich before you notify, and let a failed step stop the chain rather than silently skipping ahead. The next lesson adds Slack notifications to this same pattern.

Resources & further reading

← Calling Your MCP Server From an n8n Flow Connecting to Slack for Team Notifications →