Advanced Features
Implement Order Tracking
Learn how to leverage our AI Actions feature to implement an order tracking system for your online store.
Step 1: Create a Custom Action
Create a custom action using the AI Actions API. Give it a descriptive name such as order_tracking_tool
.
Step 2: Define the Tool Description
Set the description to A tool to track the order status
for the action.
Step 3: Configure the API Endpoint
Configure the API endpoint that your chatbot will use to retrieve order status information. Below are implementation examples for both Shopify and WooCommerce platforms.
Shopify Order Tracking
Configure Access Token
First, set up the appropriate permissions by following the Shopify Products Training Guide. For order tracking, you'll only need the read_orders
permission. If you plan to implement order cancellation functionality, include the write_orders
permission as well.
Implement Order Status Retrieval
Use the following Shopify REST API format:
curl -X GET "https://yourstore.myshopify.com/admin/api/2024-01/orders.json?name={order_number}" \
-H "X-Shopify-Access-Token: {access_token}"
Configure your API endpoint as https://yourstore.myshopify.com/admin/api/2024-01/orders.json
, using name
as the query parameter for the customer's order number. Add the X-Shopify-Access-Token
header with your access token that has read_orders
permission. For reference, our test store endpoint is https://chat-data-test.myshopify.com/admin/api/2024-01/orders.json
.
Once you've confirmed a successful response, save your AI Action configuration.
WooCommerce Order Tracking
For WooCommerce integration, follow the WooCommerce Products Training Guide to set up authentication. You'll only need the read_orders
permission.
Use this API endpoint format to retrieve order status:
curl -X GET "https://yourstore.com/wp-json/wc/v3/orders/{orderId}?consumer_key={consumer_key}&consumer_secret={consumer_secret}" \
Configure your consumer_key
and consumer_secret
as shown below:
Customize the Base Prompt
To ensure proper interaction flow, update your chatbot's base prompt. Add instructions similar to:
If the user inquires about order status, request their order number before using the
order_tracking_tool
to retrieve the status.
Test Your Implementation
Below is an example using a Shopify order number (WooCommerce testing follows the same process, though order number formats may differ):
The chatbot demonstrates the complete workflow: triggering the order_tracking_tool
, collecting the order ID, and presenting the current order status. Users can also access a detailed order tracking page: