Route new Shopify orders by local delivery radius
When a new Shopify order comes in, check the address against your local delivery zone and post it to the right Slack channel for the right team.
Build me an agent workflow that routes every new Shopify order based on whether it falls inside our local delivery radius. The trigger is a Shopify outgoing webhook on order creation (orders/create).
Workflow inputs (configurable, set once at install):
- storeLatitude (number) and storeLongitude (number): the coordinates of our store or warehouse HQ.
- radius (number) and radiusUnit ("km" or "mi"): the local delivery radius.
- localChannel (Slack channel ID or name): where in-radius orders are posted.
- exceptionsChannel (Slack channel ID or name): where out-of-radius and unmatched orders are posted.
Steps the agent should take on each webhook:
1) Use Shopify's Get Order operation to pull the full order by its ID from the webhook payload, so we have the customer name, shipping address, order number, total, and the admin order URL.
2) Use TrueWay Geocoding's Geocode (Forward Geocoding) operation to turn the shipping address into latitude/longitude. Build the address string from address1, address2, city, province/state, zip, and country.
3) If TrueWay returns an empty results array (no match), post a single short Slack message to exceptionsChannel saying the order needs human review because the address could not be located, and include the order number, customer name, raw address, and order link. Stop here.
4) Otherwise, compute the great-circle distance between the geocoded coordinates and the store coordinates using the haversine formula inline. Convert to the configured radiusUnit.
5) If the distance is less than or equal to the radius, send a compact Slack message to localChannel using slackbot's Send a Message. Include the customer name, shipping address, distance from HQ (with units), order total, and a clickable link to the order in Shopify Admin. Keep the message tight so a driver can scan a day's worth and build a route.
6) If the distance is greater than the radius, send a Slack message to exceptionsChannel suggesting whether to offer in-store pickup or to hand the order to a carrier. Include the customer, address, distance, the geocoded latitude/longitude so ops can sanity-check the result, and the order link.
Voice and quality: the agent should write tight, scannable Slack messages with Slack mrkdwn formatting. Use the order link in <url|text> form so it renders as a clickable label. Do not include long blocks of JSON. When suggesting pickup vs carrier, use the distance to make a sensible recommendation (e.g., just past the radius suggests pickup; far away suggests carrier). Treat any TrueWay 4xx or no-match response as the unmatched path, not a hard failure.
Integrations to use: shopify (Get Order), trueway-geocoding (Geocode), slackbot (Send a Message).
Additional information
What does this prompt do?
- Watches your Shopify store for new orders and grabs the shipping address the moment one lands.
- Looks up the exact location of that address and measures how far it is from your store or warehouse.
- Sends a clean Slack alert to your local delivery channel when the order is inside your radius, with customer, address, distance, and order link.
- Sends a different Slack alert to your delivery exceptions channel when the order is outside the radius, with a suggestion to offer pickup or hand off to a carrier.
- Flags ambiguous addresses to Slack with a single note so a teammate can call the customer to confirm before shipping.
What do I need to use this?
- A Shopify store you can install a custom app on.
- A Slack workspace with two channels set up: one for local delivery runs, one for delivery exceptions.
- A TrueWay Geocoding account (free tier works) so we can turn shipping addresses into map coordinates.
- Your store or warehouse address, plus the delivery radius you want to use (in miles or kilometers).
How can I customize it?
- Change your delivery radius, units, or store coordinates without touching the rest of the workflow.
- Point each branch at a different Slack channel, or split exceptions into separate channels per region.
- Tweak the wording of the Slack alerts so they match how your driver or ops team already talks about routes.
Frequently asked questions
Does this replace Shopify's built-in local delivery setting?
How fast does the Slack alert show up after an order is placed?
What happens if the address is ambiguous or can't be located?
Can I change which Slack channels it posts to?
What if I measure my delivery zone in kilometers instead of miles?
Stop sorting local orders by hand.
Connect Shopify and Slack once, and Geni routes every new order to the right team the second it lands.