Dograh

How to Connect a Voice Agent to Shopify for Order Status

How to Connect a Voice Agent to Shopify for Order Status
TutorialDecember 4, 2026·11 min read

How to Connect a Voice Agent to Shopify for Order Status

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

To connect a voice agent to Shopify, run a small service that holds the Shopify token, checks the caller and returns the order status, then call it from an HTTP API tool. Store teams can run that tool on Dograh, the open-source AI voice agent platform, and self-host it or run it on Dograh Cloud.

Key Takeaways

  • New Shopify app tokens last 24 hours, so a small service refreshes them.
  • Check the order number and delivery ZIP code before the agent names any order.
  • Dograh passes the whole reply to the agent, so the service sends four fields.

Most "where is my order?" calls need three order fields and one clear sentence. This tutorial builds that lookup step by step in Dograh, our open-source AI voice agent platform, from the Shopify token to the spoken answer, then covers the fallbacks for slow lookups, throttling and canceled orders.

What you need before you start

These steps follow the published Dograh and Shopify docs. Try them on a development store, or one with a few test orders, before production, so no real customer ever hears a wrong answer.

Dograh reaches Shopify through endpoints you run. HTTP API tools ask them during the call, Pre-Call Data Fetch can ask as the call starts and a Webhook node reports after it, while only your endpoint calls Shopify's GraphQL Admin API. If you have not created the Shopify app yet, our tutorial on building a voice agent for e-commerce walks through the Dev Dashboard app, the scopes and the client credentials grant, so this post does not repeat them.

For order status the app needs the read_orders scope. Shopify's Order object returns only the last 60 days of orders by default, and older orders need read_all_orders. You also need an agent with a node that answers order questions, and somewhere to run a small service, such as an existing backend or a serverless function.

Step 1: Put the Shopify token in a small service

Shopify's access token expires every day, so it cannot sit in the agent's settings. Since 1 January 2026, new custom apps are built in Shopify's Dev Dashboard, and the client credentials grant gives them a token that lasts 86,399 seconds, about 24 hours. The grant works only when the app and the store belong to the same Shopify organization.

A Dograh credential holds a fixed value, such as a Bearer Token, so a Shopify token pasted there would stop working within a day. The service holds the app's client ID and secret instead, asks Shopify for a new token before the old one runs out and keeps it in memory. Shopify also made expiring offline access tokens a requirement for new custom apps from 1 December 2026, so a refresh step belongs in any new build. Custom apps created in the Shopify admin before 2026 keep working with their existing tokens.

Dograh then talks only to the service, with a secret of your own in a Bearer Token credential. That makes the service a thin middle layer, the same pattern our post on connecting a voice agent to your ERP builds in full. On a self-hosted install the service can sit on a private address inside your network, while Dograh Cloud needs it on a public HTTPS address.

Check: the service fetches one test order from Shopify using only the client ID and secret it holds, and refuses a request that lacks your own secret.

Step 2: Ask Shopify for only the status fields

GraphQL lets the service ask for the few fields a status call needs and nothing else. The orders query takes a search string, so the service finds one order by its number with name:1001. The query below asks for the order's name, its displayFulfillmentStatus, cancelledAt, the tracking company on each fulfillment and the shipping zip used to check the caller:

query OrderStatus($q: String!) {
  orders(first: 1, query: $q) {
    nodes {
      name
      displayFulfillmentStatus
      cancelledAt
      shippingAddress { zip }
      fulfillments(first: 5) {
        trackingInfo(first: 1) { company }
      }
    }
  }
}

What this does: It returns one order with five fields and leaves out prices, line items, the customer and the rest of the address. The ZIP code stays inside the service for the check in Step 3 and never goes on to the agent.

The ZIP code is protected data, so plan for it. Shopify treats name, email, phone and address as protected customer data. A custom app on your own store can read them, so ask only for the fields the call needs. A public app needs Shopify's approval first. Older custom apps made in the Shopify admin get these fields depending on the store's plan, so a ZIP code that comes back null may be a plan limit.

Check: the query returns the status, the cancellation field and the ZIP code for a test order, and nothing more.

Step 3: Verify the caller inside the service

Calling from the number on an order does not prove the caller placed it. So the agent asks for two things before it says anything about the order, the order number and the ZIP code it was delivered to. The service compares the ZIP code with shippingAddress.zip itself, so the stored value never reaches the agent.

On a mismatch the service answers with verified: false and nothing else, with no status and no hint about which part was wrong. On a match it answers with verified, the order number, a short status, the carrier and one say sentence for the agent to read, as in this sample we wrote:

{
  "verified": true,
  "order": "#1001",
  "status": "partly shipped",
  "carrier": "UPS",
  "say": "Order 1001 has partly shipped with UPS. The rest is still being packed."
}

What this does: It gives the agent a finished answer and four small facts, with no address, item or price. Every caller with the same order hears the same sentence, because the service wrote it.

The prompt rule is short. "Ask for the order number and the delivery ZIP code, then call get_order_status. Say nothing about any order until it returns verified true. After two failed tries, offer a callback request." Pre-Call Data Fetch, at the bottom of the Start Call node, sends a POST with the caller's details to an endpoint you run, so the service can tell the agent whether the number has recent orders. It helps the greeting, and it never replaces this check.

Check: a test call with a wrong ZIP code hears no order details, and the right ZIP code hears the status sentence.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 4: Turn fulfillment states into plain words

Shopify's status values are written for the admin screen, not for a caller. displayFulfillmentStatus returns values such as PARTIALLY_FULFILLED or ON_HOLD, so the service maps each one to a sentence and puts it in say. The agent reads that sentence instead of guessing what a code means. The table below is a starting map for the current fulfillment status values.

A Shopify admin screen lists order status codes. An arrow takes the first code into the store's own service, a card box, which hands out a card reading Part of your order has shipped, and the rest is still being prepared. The card goes to the AI agent on a call with the caller, and a delivery van above is labeled which carrier has the parcel.
Callers never see the store's back office, so every order state has to reach them as words they already understand. Naming the carrier gives them somewhere to look next without a link read aloud.
Shopify valueWhat the agent says
UNFULFILLEDYour order is confirmed and has not shipped yet.
IN_PROGRESS or PENDING_FULFILLMENTYour order is being prepared for shipping.
SCHEDULEDYour order is scheduled to ship at a later date.
PARTIALLY_FULFILLEDPart of your order has shipped, and the rest is still being prepared.
FULFILLEDYour order has shipped with [carrier].
ON_HOLDYour order is waiting on a check before it ships, so I'll arrange a callback.
REQUEST_DECLINEDPart of your order needs the team's attention, so I'll arrange a callback.
FULFILLMENT_NOT_REQUIREDThis order has nothing to ship.

A filled cancelledAt beats every row above. The service then answers "This order was canceled" and sets a flag so the agent offers a callback request if the caller did not expect it. Older values that Shopify has replaced, such as OPEN and RESTOCKED, can share the UNFULFILLED sentence.

Tracking needs one more rule. A tracking URL cannot be read out on a call, and a long tracking number is not much better. The service passes the carrier name from trackingInfo.company, and the agent says which carrier has the parcel and points the caller to the shipping message the store sends, if it sends one. What to say when an order runs late, and when a text beats a call, is covered in our post on order status calls in e-commerce.

Check: test orders in each state you can create get their own sentence, and no code word such as PARTIALLY_FULFILLED is spoken.

Step 5: Add the order status tool in Dograh

In Dograh the service becomes one HTTP API tool. First open Credentials in the sidebar, choose Add Credential, pick Bearer Token as the Credential Type and paste the secret your service expects into Token. Then open Tools, choose Create Tool and pick External HTTP API.

On the Settings tab, name the tool get_order_status and write a Description that says when to call it, such as "Call after the caller gives the order number and delivery ZIP code". Set the HTTP Method to POST and paste the service's address into Endpoint URL. Pick your credential on the Authentication tab. On the Parameters tab, add two LLM Parameters, order_number and zip_code, both strings. The HTTP API tool page explains each field.

Whatever the service returns lands with the agent as data, next to a status of success or error. Nothing trims it on the way, which is why the service sends four fields and a sentence rather than Shopify's full order. Timeout (ms) starts at 5,000, so give the service its own Shopify budget below that, for example 3 seconds, and it always answers in time.

A Shopify lookup can take a moment, so fill the pause with the tool's Messages. Put one line under "When the tool starts", such as "Let me look that order up", and another under "While the tool is running", set to play after about 3 seconds. Then attach the tool to the node that handles order questions, under Tools, and add the prompt rule from Step 3.

Check: the tool's test run with a known order number and ZIP code returns your sample shape, and the run shows status: success.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 6: Plan for timeouts, throttles and cancellations

Some lookups will fail, and the caller still deserves a clear answer when one does. A failed or timed-out request reaches the agent once as status: error, because HTTP API tools do not retry by themselves. The prompt then says sorry once, offers a callback request and never guesses at the order.

Shopify can also throttle the service. The GraphQL Admin API refills each app's query budget at 100 points a second on Standard plans, 200 on Advanced and 1,000 on Plus. Shopify recommends waiting one second before retrying a throttled request, so the service retries once after a second, then returns an error the agent can speak around.

Some calls need a person, such as a canceled order the caller did not expect or a declined fulfillment. A third HTTP API tool can write a callback request to your helpdesk. On Twilio, Telnyx, Plivo, Cloudonix and Asterisk ARI numbers, Transfer Call can hand the call over instead. Dograh calls the destination first and connects the caller only when someone answers.

After the call, a Webhook node can post the outcome to your own system. It adds a call_disposition key, retries temporary failures up to five attempts in all, and also fires on calls nobody answered, so your system can count the lookups that ended in a callback request.

Check: with the service stopped, a test call hears the sorry line and a callback offer within the timeout, and no order detail.

Before you ship it

Run the whole path on a trial setup before real calls reach it. Place a browser test call with a wrong ZIP code, then one with the right ZIP code, and hear the status sentence only the second time. Then call from a real phone, because a spoken ZIP code is harder to catch on a phone line than in a browser.

Check the edges next. Try an order older than 60 days, a canceled order and an order number that does not exist, and confirm each one gets a clear sentence. Open View Trace on each run to see how long the tool took, and watch the service's log for Shopify throttle replies during busy hours.

Where you run the agent decides where the service may live and what the platform costs. When you self-host Dograh, the service can stay on a private address inside your network, and there is no per-minute platform fee, but servers, model keys and phone minutes still cost money. Dograh Cloud charges a 1¢-a-minute platform fee, and there the service needs a public HTTPS address.

Glossary

Client credentials grant
Shopify's way for an app and a store in the same organization to swap a client ID and secret for an Admin API token. The token lasts 24 hours.
displayFulfillmentStatus
The fulfillment state Shopify shows for an order, such as UNFULFILLED or PARTIALLY_FULFILLED. The service maps each value to a spoken sentence.
Protected customer data
Shopify's rules for customer name, email, phone and address. Custom apps on your own store can read them, and public apps need approval first.
Restore rate
How fast Shopify refills an app's GraphQL query budget, such as 100 points a second on Standard plans and 1,000 on Plus.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.