DHL + Gmail: instant tracking replies to customers
Your inbox is full of “Where is my order?” emails, and your team keeps answering the same question with the same copy-pasted tracking link. It’s not hard work. It’s just relentless.
Support leads feel it first, but ecommerce operators and marketing managers end up dragged into it too. This DHL tracking automation sends an instant, clear shipment update from Gmail or your website form so customers stop chasing you.
Below you’ll see exactly what the workflow does, what you need to run it, and how the pieces fit together so you can cut repeat tickets without sounding like a robot.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: DHL + Gmail: instant tracking replies to customers
flowchart LR
subgraph sg0["Gmail Email Flow"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/webhook.dark.svg' width='40' height='40' /></div><br/>Webhook Form Trigger"]
n1@{ icon: "mdi:play-circle", form: "rounded", label: "Gmail Email Trigger", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge Triggers"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Extract Tracking Number"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get DHL Tracking Status"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Format Response Message"]
n6@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Check Source", pos: "b", h: 48 }
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/webhook.dark.svg' width='40' height='40' /></div><br/>Webhook Response"]
n8@{ icon: "mdi:message-outline", form: "rounded", label: "Send Gmail Response", pos: "b", h: 48 }
n6 --> n7
n6 --> n8
n2 --> n3
n1 --> n2
n0 --> n2
n3 --> n4
n5 --> n6
n4 --> n5
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n1 trigger
class n6 decision
class n0,n4,n7 api
class n3,n5 code
classDef customIcon fill:none,stroke:none
class n0,n2,n3,n4,n5,n7 customIcon
The Problem: “Where’s my order?” support eats your day
Tracking questions look harmless until you add them up. One customer emails. Another submits your website form. A third replies again because they didn’t understand the carrier scan. Now you’re hunting for the tracking number, opening DHL, copying the latest status, and rewriting it in plain English so it doesn’t sound cold. Meanwhile, the real support work waits, and customers who had actual problems get slower replies. The worst part is the inconsistency: two agents can answer the same question in two different ways, which creates more follow-up.
It adds up fast. Here’s where it breaks down in real teams.
- You spend about 5 minutes per request just locating the tracking number and matching it to the right customer.
- Manual replies drift in tone and detail, which means customers ask again instead of feeling reassured.
- Website form submissions often get handled later, so you’re “fast” by human standards but slow by customer expectations.
- When DHL returns no result (wrong ID, typo, not scanned yet), agents waste time troubleshooting the same edge case repeatedly.
The Solution: Auto-reply with DHL status from web forms and Gmail
This workflow watches two places customers already use: your website tracking/contact form and your Gmail inbox. When a new request comes in, n8n combines both channels into one flow, then pulls the tracking number out of whatever the customer wrote (a clean field from the form, or a messy email body). Next, it calls the DHL tracking API and retrieves the latest shipment status. Finally, it formats that raw tracking response into a customer-friendly update and sends it back to the right place: a JSON response for your website, or a Gmail reply for email requests. If DHL can’t find the shipment yet, the workflow still responds with a helpful message instead of staying silent.
The workflow starts with a webhook submission or a new Gmail message. It then parses the tracking ID, fetches the newest DHL scan, and returns a clear status update through the same channel the customer used. No tab-hopping. No copy-paste.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you get 15 tracking questions a day across your website form and Gmail. If each one takes about 5 minutes to find the tracking number, check DHL, and reply, that’s roughly 75 minutes daily. With this workflow, the customer submits the form or emails you, n8n pulls the tracking ID and calls DHL automatically, then sends back the status within about a minute. You still handle exceptions, but you’re no longer spending an hour a day on the same repetitive update.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- DHL Developer Portal for tracking API access.
- Gmail to watch emails and send replies.
- DHL API key (get it from the DHL Developer Portal).
Skill level: Beginner. You’ll connect credentials, paste an API key, and set one webhook URL in your form.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A customer asks for tracking info. The workflow triggers from a website webhook (your form submission) or from a Gmail inbox watcher when a new email arrives that matches your filter.
The two channels become one stream. A merge step unifies the data so the rest of the workflow doesn’t care where the request came from. That’s important because it keeps your logic consistent and easier to maintain.
The tracking number gets pulled out. A parsing step extracts the DHL tracking ID, plus the customer’s name and email address when available. This is the part that turns messy real-world text into something the DHL API can actually use.
DHL status is fetched and returned in the right format. n8n calls the DHL tracking API, formats a friendly response, then branches: your website gets a JSON response, and email requests get a Gmail reply sent back to the customer.
You can easily modify the reply wording to match your brand voice based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Webhook Trigger
Set up the form-based intake path so customers can request DHL tracking updates via an HTTP POST.
- Add the Incoming Form Webhook node and set Path to
dhl-tracking-inquiry. - Set HTTP Method to
POST. - Set Response Mode to
responseNodeso the response can be handled by Return Webhook Payload.
trackingNumber, email, and name to match the parsing logic.Step 2: Configure the Email Trigger
Enable Gmail monitoring for incoming tracking inquiries sent via email.
- Add the Gmail Inbox Watcher node.
- Credential Required: Connect your
gmailOAuth2credentials. - Keep Read Status set to
unreadand Poll Times set toeveryMinutefor near real-time monitoring.
Step 3: Combine Inputs and Parse Tracking Data
Merge the webhook and Gmail entries into a single stream and extract tracking details in a consistent format.
- Add Combine Entry Streams and set Mode to
combine. - Connect Incoming Form Webhook to input 1 of Combine Entry Streams, and Gmail Inbox Watcher to input 2.
- Add Parse Tracking ID and paste the provided JavaScript in JS Code to extract
trackingNumber,customerEmail, andcustomerName.
Step 4: Connect DHL API and Build the Response
Call the DHL API and format a response message for the requester.
- Add Retrieve DHL Status and set URL to
https://api-eu.dhl.com/track/shipments. - Credential Required: Connect your
httpHeaderAuthcredentials in Retrieve DHL Status. - Set Query Parameters to include Name
trackingNumberand Value={{ $json.trackingNumber }}. - Set Header Parameters to include Name
DHL-API-Keyand replace[CONFIGURE_YOUR_API_KEY]with your DHL key. - Add Compose Status Reply and paste the provided JavaScript in JS Code to generate a formatted status message and tracking payload.
Step 5: Configure Conditional Routing for Webhook vs. Email
Direct responses to either the webhook response or Gmail reply based on the original request source.
- Add Source Branch Check and set the boolean condition to Left Value
={{ $json.isWebhook }}with Operationtrue. - Connect Compose Status Reply to Source Branch Check.
- Connect the true output of Source Branch Check to Return Webhook Payload.
- Connect the false output of Source Branch Check to Dispatch Gmail Reply.
Step 6: Configure Output Responses
Send data back to the requester via webhook response or email reply.
- In Return Webhook Payload, set Respond With to
jsonand Response Body to={{ JSON.stringify($json.trackingDetails) }}. - Add Dispatch Gmail Reply and set Send To to
={{ $json.customerEmail }}. - Set Subject to
={{ $json.subject }}and Message to={{ $json.message }}. - Credential Required: Connect your
gmailOAuth2credentials in Dispatch Gmail Reply. - Optionally set Reply To to
[YOUR_EMAIL]to control response routing.
Step 7: Test and Activate Your Workflow
Validate both input paths and confirm the correct response behavior before going live.
- Use Execute Workflow to test Incoming Form Webhook with a sample JSON payload containing
trackingNumber,email, andname. - Send an unread Gmail message containing a valid DHL tracking number to trigger Gmail Inbox Watcher.
- Confirm that Retrieve DHL Status returns a shipment and Compose Status Reply produces a message with status details.
- Verify that webhook requests receive a JSON response from Return Webhook Payload, and email requests receive a message via Dispatch Gmail Reply.
- Turn the workflow Active after successful testing.
Common Gotchas
- Gmail OAuth credentials can expire or need specific permissions. If things break, check the n8n Credentials screen and your Google account security alerts first.
- DHL API requests can fail if your API key isn’t sent as a header or if your developer app isn’t activated. Check the “Retrieve DHL Status” HTTP Request node headers before changing anything else.
- Webhook replies can look “wrong” if your website form expects a specific JSON shape. Confirm what your form script expects, then adjust the “Return Webhook Payload” response fields in n8n.
Frequently Asked Questions
About 30 minutes if you already have Gmail and a DHL API key ready.
No. You’ll mostly connect accounts and paste your DHL API key into the HTTP Request node.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in DHL API access (usually free for basic tracking) and any optional AI usage if you extend the workflow.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll add one branch per carrier. Duplicate the “Retrieve DHL Status” HTTP Request logic for UPS/FedEx, then update the “Compose Status Reply” step to format each carrier’s response. Many teams also add a Switch step right after “Parse Tracking ID” to detect the carrier based on tracking number patterns or a form dropdown.
Usually it’s expired or revoked OAuth access. Reconnect your Gmail credential in n8n, then confirm the Gmail Trigger and the Gmail reply node are both using the same (updated) credential. Also check that your trigger filter isn’t too strict, because it can look like “nothing is working” when it’s simply not matching any incoming emails.
A lot more than a human inbox can.
Often, yes. This flow benefits from n8n’s branching, merging, and text parsing, because you’re handling two inbound channels and returning two different response types. Self-hosting also matters if you get bursts of tracking requests during promotions, since you’re not paying per tiny step the way many teams do in Zapier. That said, Zapier or Make can be quicker for a very simple “email comes in, send template reply” setup with no API call. If you want help picking the right approach, Talk to an automation expert and we’ll sanity-check it with you.
Once this is live, customers get answers fast and your team stops burning time on the same tracking lookup loop. Set it up once, then get back to work that actually needs a human.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.