{
  "id": "c0HR8FeM4xO7Ocww",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Zendesk\u2013WooCommerce Order Matching, Ticket Enrichment & Conditional Email Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "123b86ac-2b5c-49e0-af22-82d0632c7bc0",
      "name": "Zendesk \u2013 New Ticket Trigger",
      "type": "n8n-nodes-base.zendeskTrigger",
      "position": [
        -400,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "all": [
            {
              "value": "new"
            }
          ]
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "zendeskOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "814dff7d-0ca9-42d6-bb7e-b2c515a63f61",
      "name": "Zendesk \u2013 Fetch Ticket Requester",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        -192,
        128
      ],
      "parameters": {
        "id": "={{ $json.requester.id }}",
        "resource": "user",
        "operation": "get",
        "authentication": "oAuth2"
      },
      "credentials": {
        "zendeskOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "edb1cf48-b747-4c55-b1fd-a9b185f48a77",
      "name": "WooCommerce \u2013 Fetch Recent Orders",
      "type": "n8n-nodes-base.wooCommerce",
      "position": [
        208,
        128
      ],
      "parameters": {
        "limit": 5,
        "options": {},
        "resource": "order",
        "operation": "getAll"
      },
      "credentials": {
        "wooCommerceApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "14cc1f95-44b4-46b8-9548-a643b72a48aa",
      "name": "Match Customer Email (Zendesk vs Woo)",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "49b2f9ed-3969-41cd-b27a-a1ce0f37cf5f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Zendesk \u2013 Fetch Ticket Requester').item.json.email }}",
              "rightValue": "={{ $json.billing.email }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "82f416f0-4ae2-48a3-9022-c90678ec8056",
      "name": "Generate Zendesk Tags from Order Status",
      "type": "n8n-nodes-base.code",
      "position": [
        1152,
        112
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nfor (const item of items) {\n  const status = item.json.status;\n\n  // Base tags (always add)\n  const tags = ['woocommerce', 'order_found'];\n\n  // Status-based tags\n  if (status === 'completed') {\n    tags.push('order_completed');\n  } else if (status === 'processing') {\n    tags.push('order_processing');\n  } else if (status === 'pending') {\n    tags.push('order_pending');\n  } else if (status === 'cancelled') {\n    tags.push('order_cancelled');\n  } else if (status === 'refunded') {\n    tags.push('order_refunded');\n  } else {\n    tags.push('order_unknown_status');\n  }\n\n  // Attach tags to output\n  item.json.zendesk_tags = tags;\n}\n\nreturn items;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8c129c74-b1f7-4ab7-bc77-6a4554e7481e",
      "name": "Prepare Ticket Update Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        1664,
        112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f0814385-e832-41ba-b85a-e89da0c195f8",
              "name": "ticket_id",
              "type": "number",
              "value": "={{ $('Zendesk \u2013 New Ticket Trigger').item.json.ticket_id }}"
            },
            {
              "id": "4b92d9cc-807b-46c0-abc0-a3655212829a",
              "name": "order_number",
              "type": "string",
              "value": "={{ $json.number }}"
            },
            {
              "id": "93e168d5-1705-4403-9fee-18b5bf46141e",
              "name": "order_status",
              "type": "string",
              "value": "={{ $json.status }}"
            },
            {
              "id": "39823260-96f0-4e45-8fb1-16a162adcac0",
              "name": "currency",
              "type": "string",
              "value": "={{ $json.currency }}"
            },
            {
              "id": "5a244f85-c4da-4e34-b9f8-69c7e812c04a",
              "name": "customer_email",
              "type": "string",
              "value": "={{ $json.billing.email }}"
            },
            {
              "id": "dc5052ca-babc-4ebc-93bf-06ead89bc808",
              "name": "items",
              "type": "string",
              "value": "={{ $json.line_items.map(i => `${i.name} (x${i.quantity})`).join(', ') }}"
            },
            {
              "id": "fee83396-71b3-4dce-ab0c-06b846acc735",
              "name": "zendesk_tags",
              "type": "array",
              "value": "={{ $json.zendesk_tags }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "de1536b9-aeaf-4083-a758-20c111131ae8",
      "name": "Zendesk \u2013 Update Ticket with Order Details",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        1872,
        112
      ],
      "parameters": {
        "id": "={{ $json.ticket_id }}",
        "operation": "update",
        "authentication": "oAuth2",
        "jsonParameters": true,
        "updateFieldsJson": "={\n  \"comment\": {\n    \"body\": \"\ud83d\uded2 WooCommerce Order Details\\n\\nOrder #: {{ $json.order_number }}\\nStatus: {{ $json.order_status }}\\nCurrency: {{ $json.currency }}\\nItems: {{ $json.items }}\\n\\nCustomer Email:\\n{{ $json.customer_email }}\",\n    \"public\": false\n  },\n  \"tags\": \"{{ $json.zendesk_tags }}\"\n}\n"
      },
      "credentials": {
        "zendeskOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7df57b88-3a93-4015-84c9-9ef7a6baff97",
      "name": "Check Order Status = Completed",
      "type": "n8n-nodes-base.if",
      "position": [
        2224,
        112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f4312c93-a83f-41bb-b738-a1d024df63c7",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Prepare Ticket Update Payload').item.json.order_status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8220f82d-29ea-4f1a-bfd5-89475714d488",
      "name": "Send Order Confirmation Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2496,
        96
      ],
      "parameters": {
        "sendTo": "={{ $('Prepare Ticket Update Payload').item.json.customer_email }}",
        "message": "=Hi {{ $json.billing_first_name || 'there' }},  Thanks for contacting our support team! \ud83d\udc4b We\u2019ve checked your account and successfully located your order. Here are the details:  \ud83d\uded2 Order Number: {{ $('Prepare Ticket Update Payload').item.json.order_number }} \ud83d\udce6 Order Status: {{ $('Prepare Ticket Update Payload').item.json.order_status }}\ud83d\udcb0 Currency: {{ $('Prepare Ticket Update Payload').item.json.currency }} \ud83e\uddfe Items Ordered: {{ $('Prepare Ticket Update Payload').item.json.items }} Our team is now reviewing your request regarding this order. If you need to share any additional information (photos, details, etc.), feel free to reply directly to this email.  We\u2019ll get back to you shortly with the next steps.  Best regards, Support Team",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Your order #{{ $('Prepare Ticket Update Payload').item.json.order_number }} \u2013 details confirmed",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c21cb400-7cbb-4dfe-8e02-eebc52e3ff6c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 368,
        "content": "## Receive New Support Ticket\nThis section starts the workflow whenever a new support ticket is created in Zendesk. It also fetches the customer\u2019s basic details, such as their email address, which is needed to find the related order in WooCommerce."
      },
      "typeVersion": 1
    },
    {
      "id": "8e950979-b2c4-4d1d-b704-39e1bfd593c5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 368,
        "content": "## Get Orders from WooCommerce\nThis section retrieves recent orders from WooCommerce. These orders are used to look for a match with the customer\u2019s email address so the correct order can be linked to the support ticket."
      },
      "typeVersion": 1
    },
    {
      "id": "d469fb8e-6623-4912-bb33-ca381f834d8a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 368,
        "content": "## Match Customer Email\nThis section compares the customer\u2019s email from the Zendesk ticket with the billing email on WooCommerce orders. Only orders with a matching email are allowed to continue in the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "cb4f46ee-31e9-448a-8a89-d58362abd326",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 368,
        "content": "## Identify Order Status and Create Tags\nThis section checks the order status, such as completed, processing or cancelled. Based on the status, it creates clear Zendesk tags that help support agents quickly understand the order situation."
      },
      "typeVersion": 1
    },
    {
      "id": "1211d686-247b-46d8-b650-e2bb675f0ccb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 368,
        "content": "## Add Order Details to Ticket\nThis section adds important order details to the Zendesk ticket as an internal note. It also applies order-related tags, giving support agents all necessary information in one place."
      },
      "typeVersion": 1
    },
    {
      "id": "bec921ae-1f1d-4f2e-89d6-4a2758dcb908",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 368,
        "content": "## Send Email for Completed Orders\nThis section checks whether the customer\u2019s order is marked as completed. If the condition is met, the workflow automatically sends a confirmation email with order details, assuring the customer that their order was found and their support request is being handled."
      },
      "typeVersion": 1
    },
    {
      "id": "a8746bec-6f76-49f6-9fa1-71e76b1dd6d3",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        -640
      ],
      "parameters": {
        "width": 592,
        "height": 752,
        "content": "##  How Workflow Works\nThis workflow links Zendesk support tickets with WooCommerce orders to help support teams respond quickly and accurately. When a new Zendesk ticket is created, the workflow identifies the requester\u2019s email and searches for a matching order in WooCommerce.\n\nIf an order is found, key details like order number, status, currency and items are captured. Based on the order status, relevant tags are added to the Zendesk ticket, giving agents instant context without manual lookup.\n\nThe ticket is then updated with a private internal comment containing the order details. If the order is completed, a confirmation email is automatically sent to the customer. This automation saves time, improves response speed and ensures consistent communication.\n\n## Workflow Setup Steps\n\n1. Set up a Zendesk Trigger to start the workflow when a new ticket is created.\n\n2. Fetch the ticket requester\u2019s email using the Zendesk user details node.\n\n3. Retrieve recent orders from WooCommerce.\n\n4. Match the WooCommerce billing email with the Zendesk requester email.\n\n5. Extract key order details like order number, status, currency and items.\n\n6. Add order-based tags to the Zendesk ticket.\n\n7. Update the ticket with a private internal comment containing order details.\n\n8. If the order is completed, send a confirmation email to the customer.\n\n9. Once all credentials are connected and settings are reviewed, activate the workflow."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7debc132-924f-4297-b483-f7fdfdc14fa3",
  "connections": {
    "Prepare Ticket Update Payload": {
      "main": [
        [
          {
            "node": "Zendesk \u2013 Update Ticket with Order Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Order Status = Completed": {
      "main": [
        [
          {
            "node": "Send Order Confirmation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zendesk \u2013 New Ticket Trigger": {
      "main": [
        [
          {
            "node": "Zendesk \u2013 Fetch Ticket Requester",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zendesk \u2013 Fetch Ticket Requester": {
      "main": [
        [
          {
            "node": "WooCommerce \u2013 Fetch Recent Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WooCommerce \u2013 Fetch Recent Orders": {
      "main": [
        [
          {
            "node": "Match Customer Email (Zendesk vs Woo)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match Customer Email (Zendesk vs Woo)": {
      "main": [
        [
          {
            "node": "Generate Zendesk Tags from Order Status",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Generate Zendesk Tags from Order Status": {
      "main": [
        [
          {
            "node": "Prepare Ticket Update Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zendesk \u2013 Update Ticket with Order Details": {
      "main": [
        [
          {
            "node": "Check Order Status = Completed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}