Track Shopify Orders in your AI Chatbot

Track Shopify Orders in your AI Chatbot

Tracking Shopify orders is one of those things most of our Shopify clients have been wanting for a very long time. I assume they're getting a lot of requests about orders from clients curious about the status of their shipping, and it's time consuming for store owners to respond to such requests. As of today, your AINIRO chatbot can finally track orders directly from within the chatbot interface.

How it works

We've got a Shopify plugin module for our AI chatbot that allows us to integrate towards your Shopify account. The Shopify API returns the internal status of the order, such as whether or not it's partially fulfilled, completely fulfilled, not yet fulfilled - In addition to that it returns a tracking URL for shipping providers that have such abilities. For the user of the AI chatbot, this resembles the following. Notice the conversation starter for "I want to track my order".

Track Shopify orders in your AI chatbot 1Track Shopify orders in your AI chatbot 2

The key point here being that as your customers clicks the above link, they are brought to your shipping provider's order tracking page for the specified order, allowing them to see stuff such as.

  • "Delivered at x terminal in y city"
  • "Given to local delivery service"
  • "Expected time of arrival updated to Thursday 12PM"
  • Etc ...

Configuring order tracking

Starting today, all of our Shopify store owners now have the option to track orders from directly within their AI chatbots, as long as they're using our Shopify plugin. The way it works, is that we create one additional training snippet with Hyperlambda code, and turn on "hard caching" for this snippet.

Prompt

Track my order with order no #ORDER_NO_HERE

Completion

{{
strings.matches:x:@.arguments/*/prompt
   .:"#[0-9]+"
if
   not-exists:x:@strings.matches/0
   .lambda
      return:"To track your order please write 'Track my order #12345'"
execute:shopify.orders.track
   secret:shpat_YOUR_SHOPIFY_API_KEY_HER
   shop:YOUR_STORE_NAME_-_HERE
   order_no:x:@strings.matches/0
return:x:-/*/description
}}

Notice - You will need to turn on "caching" of the above snippet. This is done by turning on the "Cached" checkbox as you create your snippet. Below is a screenshot of how the training snippet should look like.

AINIRO's AI chatbot

Wrapping up

Order tracking is fundamentally just a simple AI agent type of feature, where the AI chatbot reaches out to other systems using APIs to perform some task. For order tracking, the task is to retrieve the order's internal status, and its tracking URL from the shipping provider.

The way it works, is that if the above training snippet is matched as the top match for a query, then instead of invoking OpenAI's GPT models, the backend will return the result of executing the Hyperlambda code. The Hyperlambda code again will create a response resembling the following.

Order is fulfilled by us. You can track your shipping here (SOME-MARKDOWN-URL-HERE)

The above test will be returned as is, without invoking OpenAI, allowing the user to click the URL to go to some order tracking page provided by the shipping provider. Since the snippet is matched using VSS, the above snippet will rarely if ever be matched for something where the user does not want to track his or her order, resulting in that it will not interfer with normal usage of the AI chatbot.

There's no theoretical upper limit of what you can accomplish with such AI agents, allowing us to mix dynamic execution of Hyperlambda with OpenAI. If you have suggestions for features you need, and/or integrations you need, let us know by sending us an email, and we'd love to discuss it with you.

For features we can reuse for multiple partners and clients, and that have additional value for a lot of others, we typically implement these as an integrated part of our service without additional charges. If the feature you're asking us for is an "edge feature", only interesting for you, we might have to charge you to implement it.

Thomas Hansen

Thomas Hansen I am the CEO and Founder of AINIRO.IO, Ltd. I am a software developer with more than 25 years of experience. I write about Machine Learning, AI, and how to help organizations adopt said technologies. You can follow me on LinkedIn if you want to read more of what I write.

Published 9. Apr 2024