How to Schedule a Daily DHL Express Pickup for the Day's Shipments
Build a Spojit workflow that runs every afternoon on a cron schedule, totals the day's fulfilled Shopify orders, books a single DHL Express pickup for all of them, and confirms the pickup window in Slack.
What This Integration Does
If your warehouse ships a batch of parcels each day, booking a separate carrier pickup per order is wasteful and easy to forget. This workflow collapses the whole day into one action: every afternoon it reads the Shopify orders you fulfilled that day, adds up how many packages are going out, and books one DHL Express pickup for the entire batch. Your team gets a tidy Slack confirmation with the pickup date and time window, so nobody has to log into the carrier portal or chase a missed collection.
The run model is fully unattended. A Schedule trigger fires once a day on a Unix cron expression in your own timezone. The workflow pulls fulfilled orders from Shopify with list-orders, derives a package count, sends that count to DHL Express with create-pickup, and posts the result to Slack with send-message. Each run is independent: it leaves no state behind in Spojit, and because the pickup is booked against the day's order list, re-running it (for example after a transient failure) books another pickup, so re-run deliberately rather than on a loop.
Prerequisites
- A Shopify connection with permission to read orders. See the Shopify connector article for setup.
- A DHL Express connection (MyDHL API account number and credentials). See the DHL Express connector article.
- A Slack connection with access to the channel you want to notify, plus the channel ID. See the Slack connector article.
- Your warehouse pickup address details (postal code, city, country code) and the IANA timezone for your cron schedule, for example
Australia/Sydney. - The DHL Express product code you ship under (for example
Pfor Express Worldwide) and your DHL account number.
Step 1: Add a Schedule trigger for the afternoon run
Start a new workflow and set the Trigger node type to Schedule. Enter a 5-field Unix cron expression and an IANA timezone. To run at 3:00 PM on weekdays, use:
0 15 * * 1-5
Set the timezone to your warehouse region, for example Australia/Sydney. A single Schedule trigger can hold multiple schedules if you cover more than one cutoff. The trigger output is { scheduledAt }, which you can reference downstream as {{ scheduledAt }}.
Step 2: List the day's fulfilled Shopify orders
Add a Connector node in Direct mode, choose the Shopify connection, and pick the list-orders tool. Filter to orders that were fulfilled today so the pickup count matches what actually leaves the dock. Map the inputs to request fulfilled orders updated since the start of the current day:
{
"status": "any",
"fulfillment_status": "shipped",
"updated_at_min": "{{ scheduledAt }}",
"limit": 250
}
Adjust updated_at_min to the start of your business day if your cutoff differs from the trigger time. Save the result to a variable such as orders so later steps can read {{ orders }}. If you expect more than 250 orders, see the pagination note under Common Pitfalls.
Step 3: Total the package count
Add a Transform node to turn the order list into a single number of packages. If you ship one parcel per order, the count is simply the number of fulfilled orders. Produce a small structured object so the next step has clean values to map:
{
"packageCount": {{ orders.length }},
"orderCount": {{ orders.length }}
}
Save the result to a variable such as totals. If different orders ship as multiple parcels, compute the sum from each order's line or fulfillment data here instead of using the order count directly. You can also add a Condition node before the pickup to skip booking entirely when {{ totals.packageCount }} is 0, so an empty shipping day does not book a needless pickup.
Step 4: Book one DHL Express pickup
Add a Connector node in Direct mode, choose the DHL Express connection, and pick the create-pickup tool. This tool takes a single payload object that follows the MyDHL API pickup request shape. Provide the planned pickup date and time, your warehouse (shipper) details, the package count from the previous step, your product code, and your DHL account number:
{
"plannedPickupDateAndTime": "{{ scheduledAt }}",
"accounts": [
{ "typeCode": "shipper", "number": "YOUR_DHL_ACCOUNT" }
],
"customerDetails": {
"shipperDetails": {
"postalAddress": {
"postalCode": "2000",
"cityName": "Sydney",
"countryCode": "AU",
"addressLine1": "1 Warehouse Way"
},
"contactInformation": {
"companyName": "Your Company",
"fullName": "Dispatch Team",
"phone": "+61200000000",
"email": "dispatch@example.com"
}
}
},
"shipmentDetails": [
{
"productCode": "P",
"isCustomsDeclarable": false,
"packages": [
{ "weight": 5, "dimensions": { "length": 30, "width": 20, "height": 15 } }
],
"accounts": [
{ "typeCode": "shipper", "number": "YOUR_DHL_ACCOUNT" }
]
}
]
}
Save the result to a variable such as pickup. The response includes a dispatch confirmation number; capture it so you can reference it in the Slack message and, if needed, pass it to cancel-pickup later. Set plannedPickupDateAndTime to a real collection window (for example a fixed late-afternoon time on the trigger date) rather than the exact scheduledAt instant if your driver collects at a set hour.
Step 5: Confirm the pickup window in Slack
Add a Connector node in Direct mode, choose the Slack connection, and pick the send-message tool. Map channel to your dispatch channel ID and build the message text from the pickup result and totals:
{
"channel": "C0123456789",
"text": "DHL Express pickup booked for {{ totals.packageCount }} packages across {{ totals.orderCount }} orders. Dispatch confirmation: {{ pickup.data.dispatchConfirmationNumbers }}. Window: {{ scheduledAt }}."
}
Because this notification confirms a real-world collection, you can also add a second Send Email node to copy the warehouse lead by email at the same step, using Spojit's built-in mail service. Keep the channel ID, not the channel name, in channel; you can look it up with the Slack connector's list-channels tool once and paste the ID.
Step 6: Save, enable, and let the schedule run
Save the workflow, then enable it so the Schedule trigger becomes active. You can ask Miraxa, the intelligent layer across your automation, to wire any missing connections, for example: "Add a Slack send-message node after the DHL pickup that posts {{ totals.packageCount }} to channel C0123456789." Miraxa knows the workflow you are editing and can add or connect nodes on the canvas; it asks first if an instruction is ambiguous.
Tips
- Use a Condition node to skip the DHL Express step when
{{ totals.packageCount }}is0, so quiet days do not book empty pickups. - One pickup covers many parcels: book a single
create-pickupfor the batch rather than one per order to stay within carrier and rate limits. - Keep the cron timezone and the DHL
plannedPickupDateAndTimeconsistent so the booked window matches your local cutoff. - Capture the dispatch confirmation number from the
create-pickupresult; you need it if you later runcancel-pickup.
Common Pitfalls
- Pagination: Shopify
list-ordersreturns a page at a time. If you ship more than 250 orders a day, follow the page cursor and total across pages, or your package count will be too low. - Timezone drift: a cron of
0 15 * * 1-5with the wrong IANA timezone can fire hours early or late and miss the carrier cutoff. Double-check the timezone field on the Schedule trigger. - Double pickups: re-running the workflow books a second pickup. If a run fails after
create-pickupsucceeds, cancel the duplicate withcancel-pickuprather than re-running blindly. - Fulfillment filter: if your
fulfillment_statusor date filter is too broad, you may count unshipped or prior-day orders. Narrow thelist-ordersinputs to exactly the day's shipped batch.
Testing
Before enabling the daily schedule, validate on a small scope. Temporarily set the Schedule trigger to a cron a minute or two ahead, or use a Manual trigger copy of the workflow, and point list-orders at a narrow window so it returns a handful of test orders. Confirm the Transform node reports the expected packageCount, that create-pickup returns a dispatch confirmation number, and that the Slack message lands in your channel. Use a DHL test account or a near-future plannedPickupDateAndTime you can cancel, then switch the trigger back to your real afternoon cron and enable the workflow.