Route new Shopify orders by local delivery radius

By General Input

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.

Integrations

  • Shopify
  • TrueWay Geocoding
  • Slack Bot

Type

Agentic Task

Categories

  • Operations
  • Sales

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).

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them