How to Trigger a Shippit Booking From a Warehouse Dispatch Email
When your warehouse forwards a "dispatch ready" email to a Spojit Mailhook address, this workflow reads the order number out of the message with an Agent-mode node, creates and books the order in Shippit, pulls back the tracking number and label, then alerts the team in Slack.
What This Integration Does
Warehouses rarely send clean, structured data. A picker finishes an order and replies to a thread, or a warehouse management system fires off a plain-text "Order #1042 is packed and ready to ship" message. Re-keying that order number into your carrier portal by hand is slow and error prone. This tutorial turns that loose email into a fully booked Shippit consignment with zero manual steps: the order number is extracted by an Agent-mode Connector node, the Shippit order is created and handed to the carrier, and the team gets a tracking link in Slack the moment the booking succeeds.
The workflow runs on a Mailhook trigger, so it fires within seconds of an email arriving at a unique Spojit address you point your warehouse at. The trigger output ({{ input }}) carries the subject and body text. An Agent-mode Connector step reads that text and returns a structured order number, a Direct-mode Shippit create-order call produces a tracking number, book-order commits the carrier booking, and a Slack send-message posts the result. Each inbound email is deduplicated, so a forwarded or replayed message will not double-book. Because the trigger is asynchronous there is no reply to the sender; use a Send Email node if you want to acknowledge receipt.
Prerequisites
- A Shippit connection (API key) added under Connections, with permission to create and book orders.
- A Slack connection (OAuth) added under Connections, and the channel ID or name where dispatch alerts should land.
- A Shopify connection if you want to enrich the booking with live order details (delivery address, parcels). This is optional but recommended so you do not hand-build the address.
- A known, stable email address (or forwarding rule) at your warehouse that can send to a Spojit-generated Mailhook address.
- Your Shippit default parcel and courier settings configured in Shippit, so a minimal
create-orderpayload still books cleanly.
Step 1: Add the Mailhook trigger and generate an address
Create a new workflow in the Workflow Designer. On the Trigger node set Trigger Type to Mailhook. Optionally set an Address prefix (1 to 24 characters, for example dispatch) so the generated address is easy to recognise, then click Generate email address. Spojit produces a unique address of the form dispatch-<random16>@mailhook.spojit.com. Copy it and configure your warehouse system or a forwarding rule to send dispatch-ready notifications to it.
To keep noise out, add an optional From allowlist (only your warehouse domain) and a Subject regex such as dispatch|ready to ship|packed. The trigger fires on any matching mail, whether the address is in To, Cc, or Bcc. The trigger output is available downstream as {{ input }} with fields including {{ input.subject }}, {{ input.text }}, {{ input.from }}, and {{ input.replyTo }}.
Step 2: Extract the order number with an Agent-mode Connector node
Add a Connector node, choose any reasoning-capable connector tool, and switch it to Agent mode so the agent can read the unstructured email and return clean data. Set the Prompt to point at the email body and define a Response Schema so the output is reliable JSON rather than prose.
Prompt:
Read this warehouse dispatch email and return the order number only.
Subject: {{ input.subject }}
Body: {{ input.text }}
If no order number is present, return an empty string for orderNumber.
Response Schema:
{
"type": "object",
"properties": {
"orderNumber": { "type": "string" },
"confident": { "type": "boolean" }
},
"required": ["orderNumber", "confident"]
}
Set the node's Output Variable to extract so later steps can read {{ extract.orderNumber }} and {{ extract.confident }}. Agent mode costs AI credits; the schema keeps the response compact.
Step 3: Stop early when no order number is found
Add a Condition node that checks the extraction succeeded before you touch the carrier. Set the condition to test that {{ extract.orderNumber }} is not empty and {{ extract.confident }} is true. Send the false branch to a Send Email node that notifies your dispatch desk that a message could not be parsed, using {{ input.replyTo }} as a templated recipient so the original sender is looped in. The true branch continues to the Shippit steps. This guards against quote requests, replies, and off-topic mail that slipped past the subject filter.
Step 4: Create the Shippit order in Direct mode
On the true branch add a Connector node for Shippit in Direct mode and pick the create-order tool. This tool takes a single order object containing courier_type, delivery_address, parcels, user_attributes, and items. If you fetched the order from Shopify first (see Tips), map those fields in; otherwise build a minimal payload that leans on your Shippit account defaults:
{
"courier_type": "standard",
"delivery_address": {
"name": "{{ shopifyOrder.shipping_address.name }}",
"address_line_1": "{{ shopifyOrder.shipping_address.address1 }}",
"suburb": "{{ shopifyOrder.shipping_address.city }}",
"state": "{{ shopifyOrder.shipping_address.province_code }}",
"postcode": "{{ shopifyOrder.shipping_address.zip }}"
},
"parcels": [{ "qty": 1, "weight": 1.0 }],
"user_attributes": {
"email": "{{ shopifyOrder.email }}",
"first_name": "{{ shopifyOrder.customer.first_name }}",
"last_name": "{{ shopifyOrder.customer.last_name }}"
}
}
Set the Output Variable to shippitOrder. The Shippit response returns a tracking number (commonly prefixed with PP) under {{ shippitOrder.data }}, which you reference as the order's tracking_number in the next steps.
Step 5: Book the carrier and fetch the label
Add a second Shippit Connector node in Direct mode with the book-order tool. Its only input is tracking_number; map it to the tracking number returned in {{ shippitOrder.data.tracking_number }}. This commits the booking with the carrier. Then add a third Shippit Direct-mode node using get-label with the same tracking_number to retrieve the label URL, and store its output as label. If your warehouse prints labels itself you can skip get-label and simply share the tracking number.
Step 6: Alert the team in Slack
Add a Connector node for Slack in Direct mode and select send-message. Set the channel to your dispatch channel and templatize the text so it carries the order number, the Shippit tracking number, and the label link:
Order {{ extract.orderNumber }} is booked with the carrier.
Tracking: {{ shippitOrder.data.tracking_number }}
Label: {{ label.data.url }}
If you prefer richer formatting you can use the connection's lookup tools (for example lookup-user-by-email) to @-mention an owner, but a plain channel post is enough to close the loop. Optionally chain a Send Email node to acknowledge the warehouse sender at {{ input.replyTo }}.
Tips
- To avoid hand-building the delivery address, insert a Shopify Connector node in Direct mode with
get-orderright after extraction, keyed on{{ extract.orderNumber }}, and feed its shipping address and customer fields into the Shippitcreate-orderpayload. - Use
get-quotesfirst if you want to confirm price and service level before committing; the cheapest or fastest quote can setcourier_typeon thecreate-orderpayload. - Keep the Agent-mode prompt narrow (order number only) so it stays cheap and deterministic; broaden the Response Schema only when you actually need extra fields like a carrier preference.
- Mailhook addresses can be rotated with Regenerate address if one leaks; the old address stops working instantly, so update your warehouse forwarding rule at the same time.
Common Pitfalls
- Empty or wrong order numbers. Free-text emails sometimes contain several numbers (invoice, PO, order). Keep the prompt specific and rely on the Step 3 Condition so a low-confidence extraction never reaches
create-order. - Booking before creating.
book-orderneeds thetracking_numberthatcreate-orderreturns. Wire the steps in order and confirm{{ shippitOrder.data.tracking_number }}resolves beforebook-orderruns. - Send Email allowlist. If you acknowledge the warehouse with a Send Email node, external recipients must be on the org allowlist under Settings > General > Email recipients, or the send will fail.
- Replayed mail. Mailhook deduplicates per message, but a genuinely re-sent dispatch email is a new message. The Step 3 Condition plus a quick Shippit
get-ordercheck on the tracking number can prevent a duplicate booking.
Testing
Before pointing production traffic at the address, send a single test email from an allowlisted account to the generated Mailhook address with a realistic subject and an order number you control. Watch the run in the execution history: confirm the Agent-mode node returns the right orderNumber, that the Condition takes the true branch, that create-order returns a PP tracking number, and that book-order succeeds. Use a low-value or sandbox Shippit order for the first few runs so a mistaken booking is harmless. Once the Slack alert posts the correct tracking number and label link, switch your warehouse forwarding rule on.