đź’¬ Automated DHL shipment tracking bot for web forms and email inquiries

⚡ 3,945 views · 💬 Support Chatbots

Description

This n8n template automates responses to customer inquiries about DHL shipment status, handling requests from both web forms and emails.

Use cases

Good to know

How it works

  1. The workflow is initiated by one of two triggers: a Webhook (from a website form) or a Gmail Trigger (when a new email arrives).
  2. A Merge node combines the data from both triggers into a single, unified flow.
  3. The “Extract Tracking Number” Code node intelligently parses the tracking number from either the form data or the email body. It also extracts the customer’s name and email address.
  4. The HTTP Request node sends the extracted tracking number to the DHL API to fetch the latest shipment status.
  5. The “Format Response Message” Code node takes the API response and composes a user-friendly message for the customer. It also handles cases where tracking information is not found.
  6. An If node checks the original source of the inquiry to determine whether it came from the webhook or email.
  7. If the request came from the webhook, a Respond to Webhook node sends the tracking data back as a JSON response.
  8. If the request came from an email, the Gmail node sends the formatted message as an email reply to the customer.

How to use

  1. Configure the Triggers:

    • Webhook Trigger: Copy the Test URL and set it as the action endpoint for your web form. Once you activate the workflow, use the Production URL.
      Webhook URL: https://your-n8n-instance.com/webhook/dhl-tracking-inquiry
    • Gmail Trigger: Connect your Gmail account using OAuth2 credentials and set the desired filter conditions (e.g., unread emails with a specific subject).
  2. Set up the DHL API:

    • Open the “Get DHL Tracking Status” (HTTP Request) node and navigate to the “Headers” tab.
    • Replace YOUR_DHL_API_KEY with your actual DHL API key.
      {
        "DHL-API-Key": "YOUR_DHL_API_KEY"
      }
  3. Configure the Gmail Send Node:

    • Connect the same Gmail credentials to the “Send Gmail Response” node.
    • Customize options like the replyTo address as needed.
  4. Activate the workflow.

Requirements

Customising this workflow

đź”— Nodes Used

HTTP Request, Webhook, Gmail, Gmail Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup