This guide explains how to connect a Shopify store with BotSailor AI Agent to create a real-time ecommerce assistant capable of retrieving live product prices and inventory availability.
The integration uses Shopify Admin API, Custom App authentication, API access tokens, BotSailor custom fields, HTTP API endpoints, response mapping, and AI Agent workflows.
After configuration, the AI chatbot can automatically understand customer product requests, convert product names into Shopify handles, fetch live inventory data, and provide accurate pricing and stock information instantly.
This setup helps ecommerce businesses reduce manual customer support tasks, improve shopping experiences, and create an automated conversational commerce workflow across chat platforms.
Connect Shopify with BotSailor- Reseller & End User Settings
If you are a BotSailor end-user who simply wants to connect your existing Shopify store, you can easily install the official BotSailor app directly from the Shopify App Store to link your store automatically. Here is how you can do it:
Step 1: Log In to BotSailor
Log in to your BotSailor account and it will take you to the BotSailor's Dashboard.
Dashboard —-> Connect Account —-> Shopify
Click Connect Account, Here, paste your shopify store url ( You will get it from your Shopify accounts settings —-> Below users)
Make sure you are logged in to your Shopify admin account on the same browser).
Step 2: Install the BotSailor app in your Shopify admin panel
Once you click the Connect Store button, you will be redirected to your Shopify admin panel and prompted to install the BotSailor app. Click Install to authorize the connection.
Step 3: Confirmation
After the installation is complete, you will be redirected back to your BotSailor account, where a success message will confirm that the integration has been completed. Your connected Shopify store will then appear in the store list below.
Configuring the Custom API in BotSailor (E-commerce API Panel)
Once you have generated your shpat_ access token from your Shopify custom app, you need to plug those credentials into BotSailor's E-commerce API setup panel to bind the store:
Chatbot Manager —> Commerce —> Woocommerce/Shopify(Click Shopify) —> Add new API
- Profile Name: Enter a recognizable label for your connection (e.g., Shopify Custom Domain (Queens)).
- Store Sub-Domain: Input your unique Shopify store prefix or handle (e.g., queens-calling-mk0xlrlj).
- Admin Access Token: Paste the Shopify Admin API access token (shpat_...) that you generated from your custom app credentials.
- Saving the Configuration:Click the Save button to finalize the API profile mapping so campaigns and live inventory sync can utilize it.
- Part 2
Creating and Mapping Custom Fields (Crucial Setup)
Before configuring your HTTP API endpoint, you must create and configure custom fields inside BotSailor. Why is this required? Because the AI agent needs a designated memory container (custom field) to store the user's product query dynamically and to hold the incoming live price and inventory data fetched from Shopify. Skipping or incorrectly naming these fields will break the data pipeline and cause the API to return empty results.
Step 1: When and Where to Create Custom Fields
Timing: Create these custom fields inside your BotSailor dashboard before configuring your HTTP API request or setting up the AI Agent prompt.
Dashboard —> Subscriber Manager —> Create Custom Fields
Fields to Create: For today's use case, we need to create three specific custom fields for input handling and data storage:
- Product Query Field: To Capture and store the lowercase product handle requested by the user.
- Price Storage Field: This field will Store the live price returned by Shopify.
- Stock Storage Field: Stores the live inventory quantity returned by Shopify.
Step 2: Detailed Custom Field Nomenclature & Setup
To ensure your API endpoint and response mapping work seamlessly without errors, use the exact field names and variable formats provided below:
| # | Field | Custom Field Name | Details |
|---|---|---|---|
| 1 | Product Query Field | product_query | BotSailor Syntax Format: #product_query#Purpose: This field acts as the dynamic variable injected directly into your API endpoint URL to search for specific items. |
| 2 | Price Storage Field | dynamic_price | Purpose: Maps to Shopify's pricing data structure to let the AI output the exact cost during live chats. |
| 3 | Stock Storage Field | live_stock | Purpose: Maps to Shopify's inventory count to track and display real-time stock availability. |
BotSailor HTTP API Integration Setup
Configure your API connection inside the BotSailor dashboard using your Shopify store details and the custom field variable embedded directly into the endpoint URL.
HTTP API Configuration Settings & Endpoint URL Breakdown
Dashboard —> Chatbot Manager —> Integrations —> Http API —> Create
To fetch real-time product data dynamically, you need to construct the correct REST API endpoint using your Shopify store domain and variable syntax. Here is how and why you build the endpoint URL:
Where the Endpoint URL Comes From:
The core API structure is derived directly from Shopify's official Admin REST API documentation for products (/admin/api/[version]/products.json), combined with your specific store subdomain and a query filter to search by product handle.
Here, We will Keep the Method as GET, since we want to receive data from Shopify, & we need this Specific Endpoint URL Structure:
https://your-subdomain.myshopify.com/admin/api/2026-07/products.json?handle=#product_query#
- Store Subdomain (your-subdomain): Replaces the placeholder with your unique Shopify store identifier (e.g., queens-calling-mk0xlrlj) to target your specific database.
- API Version (2026-07): Specifies the stable Shopify API release version ensuring the endpoint returns the correct schema.
- Query Parameter (?handle=): Tells Shopify to filter the product list by its URL handle rather than fetching all products.
- Dynamic Custom Field (#product_query#): Uses BotSailor's hash syntax instead of curly braces to dynamically capture the user's chat input at runtime and inject it into the request.
2. Request Headers Configuration
Add the following key-value pairs under headers (configured with Static Value type):
| Key | Value |
|---|---|
X-Shopify-Access-Token | shpat_your_access_token_here |
Content-Type | application/json |
Response Mapping Configuration
To ensure BotSailor extracts the price and stock quantity correctly from Shopify's nested JSON array response, map the JSON paths to your created custom fields precisely as follows:
| Map Response Path | Custom Field | |
|---|---|---|
products>0>variants>0>price | → | dynamic_price |
products>0>variants>0>inventory_quantity | → | live_stock |
AI Agent System Prompt Configuration
Dashboard —> Chatbot Manager —> AI —> Agents —> Create Agent
Add name, slug, description, & paste the following refined system prompt into your BotSailor AI Agent settings. This prompt instructs the agent to correctly process user queries, format product names into lowercase URL handles, save them to the custom field variable, and trigger the live API endpoint. Save the Agent.
You are a live inventory and pricing assistant connected to Shopify. Whenever a user asks about a product's price, stock, or availability, you MUST strictly follow these execution steps:1. Extract the product name from the user's message and format it into a clean lowercase URL handle with spaces replaced by hyphens (e.g., "Micellar Cleansing Water" becomes "micellar-cleansing-water"). 2. Save this formatted value to the custom field variable (#product_query#). 3. Trigger the HTTP API to fetch the real-time inventory and pricing data. 4. Reply to the user using the returned dynamic_price and live_stock values. If the product is not found or stock is 0, inform them that the item is currently unavailable.
Multi Agent AI Configuration
Once your HTTP API campaign chatbot is configured, you need to map your newly created agent inside the BotSailor AI configuration panel to handle real-time triggers seamlessly:
Enabling Multiple Active Agents: As shown in the configuration dashboard, you can assign multiple specialized agents simultaneously (e.g., General Agent, Live inventory and pricing tracking, and live tracking etc). While you can choose to run a single agent for simple setups, we highly recommend utilizing multiple dedicated agents for distinct task accomplishments to maximize response accuracy.
Configuring Agent Routing Rules: Define precise routing rules under the Agent Routing section to determine which agent handles specific customer inquiries:
- General Queries: Set standard conversation starters (like "hi, hello") to route toward the General Agent.
- Inventory & Pricing: Map keywords such as "Inventory, price, stock" to trigger your newly created Live inventory and pricing tracking agent, allowing it to instantly fetch real-time data using your HTTP API.
- Logistics & Delivery: Route shipment keywords (like "Shipment, Track, Delivery") to your tracking agent.
For advanced guides on creating, scaling, and optimizing additional multi-agent workflows, please refer to our core documentation repository.
Testing, Deployment & Real-World Results
Once you have completed your Shopify custom app integration, custom field bindings, HTTP API endpoint setup, and AI agent prompt configurations, the final stage is to test the live loop and deploy the assistant for production use.
Step 1: Live Chat Validation & Testing
- Initiate a Test Session: Open your connected chat channel (such as WhatsApp) and send a natural query asking for a specific product's price or stock (e.g., "Can you tell me the price of peach powder blush").
- Verify Execution Sequence: The AI agent will parse the text, normalize the product name into a lowercase URL slug, bind it to your custom field variable (#product_query#), and instantly trigger the Shopify HTTP API call.
- Inspect the Live Output: A successfully configured pipeline will bypass static responses and fetch live store data directly, replying with the precise pricing and inventory count in real time.
Step 2: Production Deployment & Multi-Agent Scaling
- Verify Intent Rules: Ensure your intent routing rules are active so incoming queries regarding stock or pricing trigger your specialized inventory agent instead of the general assistant.
- Monitor Logs & Fallbacks: Check your BotSailor execution logs to ensure payloads and variables are binding correctly on user input. If a product handle returns empty, the AI will gracefully execute its fallback logic and inform the user that the item is currently unavailable.
Conclusion
Integrating Shopify with BotSailor transforms a standard chat interface into an autonomous, real-time e-commerce powerhouse. By bridging Shopify's robust Admin REST API with BotSailor's flexible custom fields, dynamic HTTP endpoints, and multi-agent AI routing, businesses can deliver instant, accurate answers regarding product pricing and stock availability directly inside chat applications. Whether deploying an automated public connection as a standard end-user or configuring advanced custom private apps as a reseller, this architecture eliminates manual bottlenecks, enhances customer satisfaction, and drives higher conversions through immediate, frictionless engagement.


