Automated DHL shipment tracking bot for web forms and email inquiries
This n8n template automates responses to customer inquiries about DHL shipment status, handling requests from both web forms and emails.
Use cases
- Automate Customer Support: Provide 24/7 instant answers to the common "Where is my order?" question without human intervention.
- Reduce Support Tickets: Decrease the volume of repetitive tracking inquiries by providing customers with immediate, self-service information.
- Enhance Customer Experience: Offer a consistent and rapid response across multiple channels (your website and email), allowing customers to use their preferred method of contact.
Good to know
- DHL API Key is required: You'll need to register on the DHL Developer Portal to get your API key.
- This workflow requires Gmail credentials (OAuth2) to monitor incoming emails and send replies.
- The webhook URL must be configured in your website's contact or tracking form to receive submissions.
How it works
- The workflow is initiated by one of two triggers: a Webhook (from a website form) or a Gmail Trigger (when a new email arrives).
- A Merge node combines the data from both triggers into a single, unified flow.
- 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.
- The HTTP Request node sends the extracted tracking number to the DHL API to fetch the latest shipment status.
- 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.
- An If node checks the original source of the inquiry to determine whether it came from the webhook or email.
- If the request came from the webhook, a Respond to Webhook node sends the tracking data back as a JSON response.
- If the request came from an email, the Gmail node sends the formatted message as an email reply to the customer.
How to use
-
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).
- 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.
-
Set up the DHL API:
- Open the "Get DHL Tracking Status" (HTTP Request) node and navigate to the "Headers" tab.
- Replace
YOUR_DHL_API_KEYwith your actual DHL API key.{ "DHL-API-Key": "YOUR_DHL_API_KEY" }
-
Configure the Gmail Send Node:
- Connect the same Gmail credentials to the "Send Gmail Response" node.
- Customize options like the
replyToaddress as needed.
-
Activate the workflow.
Requirements
- A DHL Developer Portal account to obtain an API key.
- A Gmail account configured with OAuth2 in n8n.
Customising this workflow
- Add More Carriers: Duplicate the HTTP Request node and response formatting logic to support other shipping carriers like FedEx or UPS.
- Log Inquiries: Add a node to save inquiry details (tracking number, customer email, status) to a Google Sheet or database for analytics.
- Advanced Error Handling: Implement more robust error handling, such as sending a Slack notification to your support team if the DHL API is down or returns an unexpected error.
Automated Shipment Tracking Bot for Web Forms and Email Inquiries
This n8n workflow automates the process of retrieving shipment tracking information based on user requests, whether submitted via a webhook (e.g., a web form) or through email inquiries. It intelligently processes tracking numbers, fetches real-time updates from a hypothetical external API, and responds to the user with the tracking status.
What it does
This workflow streamlines the shipment tracking process through the following steps:
- Listens for Inquiries: It can be triggered by two sources:
- Webhook: A POST request to a defined webhook URL (e.g., from a web form submission).
- Gmail Trigger: New emails arriving in a specified Gmail inbox.
- Extracts Tracking Number:
- For webhook requests, it assumes the tracking number is provided in the request body.
- For Gmail inquiries, it uses a Code node to parse the email body and extract a tracking number.
- Determines Source: An If node checks whether the request originated from the Webhook or Gmail to apply appropriate processing.
- Fetches Tracking Data: It makes an HTTP Request to an external API (e.g., a DHL tracking API, though the specific URL is not defined in the JSON) using the extracted tracking number.
- Responds to User:
- If the request came from the Webhook, it uses the "Respond to Webhook" node to send the tracking information back to the requester.
- If the request came from Gmail, it uses the Gmail node to send an email reply containing the tracking status.
- Merges Paths: A Merge node combines the workflow paths after fetching the tracking data, ensuring a unified flow for responding.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance.
- Gmail Account: Configured as a credential in n8n for the "Gmail Trigger" and "Gmail" nodes.
- External Tracking API: Access to a shipment tracking API (e.g., DHL, FedEx, UPS) that can return tracking details based on a tracking number. You will need to configure the
HTTP Requestnode with the correct API endpoint and any required authentication. - Basic JavaScript Knowledge (Optional but Recommended): To customize the "Code" node for robust email parsing if your email inquiry format varies.
Setup/Usage
- Import the Workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- Set up your Gmail Account credentials in n8n.
- Assign the Gmail credentials to both the "Gmail Trigger" node (ID: 824) and the "Gmail" node (ID: 356).
- Configure Webhook:
- Activate the "Webhook" node (ID: 47). n8n will provide a unique URL. Use this URL in your web form or application to send tracking requests.
- Configure HTTP Request:
- Edit the "HTTP Request" node (ID: 19).
- Set the
URLto your chosen shipment tracking API endpoint. - Configure the
Method(e.g., GET, POST) andHeadersorBodyparameters to send the tracking number. The tracking number can be accessed using an expression like{{ $json.trackingNumber }}if it's passed from previous nodes. - Add any necessary authentication (e.g., API Key, OAuth) for your tracking API.
- Customize Code Node (for Email Inquiries):
- The "Code" node (ID: 834) is currently empty. You will need to add JavaScript code here to parse the incoming email body (
{{ $json.text }}or{{ $json.html }}) and extract the tracking number. For example:const emailBody = $input.item.json.text; // or .html // Implement logic to extract tracking number from emailBody // Example: Using a regular expression const match = emailBody.match(/tracking number: (\w+)/i); if (match && match[1]) { return { json: { trackingNumber: match[1] } }; } return { json: { trackingNumber: null } }; // Handle no tracking number found
- The "Code" node (ID: 834) is currently empty. You will need to add JavaScript code here to parse the incoming email body (
- Activate the Workflow: Once all configurations are complete, activate the workflow.
Now, your n8n workflow is ready to automatically process shipment tracking requests from both web forms and email inquiries.
Related Templates
Auto-reply & create Linear tickets from Gmail with GPT-5, gotoHuman & human review
This workflow automatically classifies every new email from your linked mailbox, drafts a personalized reply, and creates Linear tickets for bugs or feature requests. It uses a human-in-the-loop with gotoHuman and continuously improves itself by learning from approved examples. How it works The workflow triggers on every new email from your linked mailbox. Self-learning Email Classifier: an AI model categorizes the email into defined categories (e.g., Bug Report, Feature Request, Sales Opportunity, etc.). It fetches previously approved classification examples from gotoHuman to refine decisions. Self-learning Email Writer: the AI drafts a reply to the email. It learns over time by using previously approved replies from gotoHuman, with per-classification context to tailor tone and style (e.g., different style for sales vs. bug reports). Human Review in gotoHuman: review the classification and the drafted reply. Drafts can be edited or retried. Approved values are used to train the self-learning agents. Send approved Reply: the approved response is sent as a reply to the email thread. Create ticket: if the classification is Bug or Feature Request, a ticket is created by another AI agent in Linear. Human Review in gotoHuman: How to set up Most importantly, install the gotoHuman node before importing this template! (Just add the node to a blank canvas before importing) Set up credentials for gotoHuman, OpenAI, your email provider (e.g. Gmail), and Linear. In gotoHuman, select and create the pre-built review template "Support email agent" or import the ID: 6fzuCJlFYJtlu9mGYcVT. Select this template in the gotoHuman node. In the "gotoHuman: Fetch approved examples" http nodes you need to add your formId. It is the ID of the review template that you just created/imported in gotoHuman. Requirements gotoHuman (human supervision, memory for self-learning) OpenAI (classification, drafting) Gmail or your preferred email provider (for email trigger+replies) Linear (ticketing) How to customize Expand or refine the categories used by the classifier. Update the prompt to reflect your own taxonomy. Filter fetched training data from gotoHuman by reviewer so the writer adapts to their personalized tone and preferences. Add more context to the AI email writer (calendar events, FAQs, product docs) to improve reply quality.
Dynamic Hubspot lead routing with GPT-4 and Airtable sales team distribution
AI Agent for Dynamic Lead Distribution (HubSpot + Airtable) π§ AI-Powered Lead Routing and Sales Team Distribution This intelligent n8n workflow automates end-to-end lead qualification and allocation by integrating HubSpot, Airtable, OpenAI, Gmail, and Slack. The system ensures that every new lead is instantly analyzed, scored, and routed to the best-fit sales representative β all powered by AI logic, sir. --- π‘ Key Advantages β‘ Real-Time Lead Routing Automatically assigns new leads from HubSpot to the most relevant sales rep based on region, capacity, and expertise. π§ AI Qualification Engine An OpenAI-powered Agent evaluates the leadβs industry, region, and needs to generate a persona summary and routing rationale. π Centralized Tracking in Airtable Every lead is logged and updated in Airtable with AI insights, rep details, and allocation status for full transparency. π¬ Instant Notifications Slack and Gmail integrations alert the assigned rep immediately with full lead details and AI-generated notes. π Seamless CRM Sync Updates the original HubSpot record with lead persona, routing info, and timeline notes for audit-ready history, sir. --- βοΈ How It Works HubSpot Trigger β Captures a new lead as soon as itβs created in HubSpot. Fetch Contact Data β Retrieves all relevant fields like name, company, and industry. Clean & Format Data β A Code node standardizes and structures the data for consistency. Airtable Record Creation β Logs the lead data into the βLeadsβ table for centralized tracking. AI Agent Qualification β The AI analyzes the lead using the TeamDatabase (Airtable) to find the ideal rep. Record Update β Updates the same Airtable record with the assigned team and AI persona summary. Slack Notification β Sends a real-time message tagging the rep with lead info. Gmail Notification β Sends a personalized handoff email with context and follow-up actions. HubSpot Sync β Updates the original contact in HubSpot with the assignment details and AI rationale, sir. --- π οΈ Setup Steps Trigger Node: HubSpot β Detect new leads. HubSpot Node: Retrieve complete lead details. Code Node: Clean and normalize data. Airtable Node: Log lead info in the βLeadsβ table. AI Agent Node: Process lead and match with sales team. Slack Node: Notify the designated representative. Gmail Node: Email the rep with details. HubSpot Node: Update CRM with AI summary and allocation status, sir. --- π Credentials Required HubSpot OAuth2 API β To fetch and update leads. Airtable Personal Access Token β To store and update lead data. OpenAI API β To power the AI qualification and matching logic. Slack OAuth2 β For sending team notifications. Gmail OAuth2 β For automatic email alerts to assigned reps, sir. --- π€ Ideal For Sales Operations and RevOps teams managing multiple regions B2B SaaS and enterprise teams handling large lead volumes Marketing teams requiring AI-driven, bias-free lead assignment Organizations optimizing CRM efficiency with automation, sir --- π¬ Bonus Tip You can easily extend this workflow by adding lead scoring logic, language translation for follow-ups, or Salesforce integration. The entire system is modular β perfect for scaling across global sales teams, sir.
Create, update, and get a person from Copper
This workflow allows you to create, update, and get a person from Copper. Copper node: This node will create a new person in Copper. Copper1 node: This node will update the information of the person that we created using the previous node. Copper2 node: This node will retrieve the information of the person that we created earlier.