When a customer asks "Where is my order?" during a flash sale, a static FAQ page is useless. E-commerce support teams face bottlenecks where agents spend hours answering repetitive questions while complex issues wait in the queue. AI support agents can resolve this by routing queries through different mechanisms, but building one requires more than just plugging in a chatbot. Developers must train the agent on custom data, connect it to live backend systems via APIs, and rigorously test the integration to ensure reliability. This guide covers the technical implementation of AI support agents, using Fetchply as a primary platform example to demonstrate data training, API integrations, and software testing best practices.
Training Your AI Chatbot on Custom Data
An AI agent is only as reliable as the data it learns from. Training involves providing the agent with your business knowledge so it can answer open questions accurately. Developers can train an agent by crawling website content, uploading documents, and defining instant answers.
Crawling your website allows the agent to index pages, policies, and product information. This creates a baseline knowledge base. For more specific or proprietary information, you can upload files directly, such as PDFs or internal documentation. This ensures the agent has access to information that may not be publicly available.
For critical, repetitive questions, defining Instant Answers is essential. These are word-for-word responses that bypass the AI's generative process, ensuring the customer receives an approved answer every time. This reduces the risk of hallucination and saves AI message allowances. Predictable requests can also follow Guided Flows, which walk the customer through a predefined sequence of steps.
After training, set the scope and tone of the agent under widget and AI rules. This controls how the agent interacts with customers and what topics it should decline to answer. A well-defined scope prevents the agent from providing irrelevant or incorrect information.
Implementing Live API Lookups with Custom Functions
Some answers live in your backend, not in any document. For real-time data such as order status, inventory levels, or account details, the agent needs to make live API calls. Custom functions allow the chatbot to call approved HTTPS endpoints mid-conversation.

Custom functions enable AI agents to fetch real-time data from backend systems mid-conversation.
Developers can register any HTTPS GET or POST endpoint once. When a customer asks a question requiring live data, the agent calls the endpoint, fetches the answer, and replies in plain language. For example, if a customer asks, "Do you still have 3 in stock in size M?", the agent can call a custom_inventory_check function, passing the product and size as parameters. The endpoint returns the live stock count, and the agent relays the information.
Parameters are typed, so the agent collects exactly the inputs your endpoint expects before calling it. This prevents malformed requests and ensures the API call is successful.
Security is a primary concern when connecting chatbots to backend systems. Credentials like Bearer tokens and API keys should be stored encrypted. Requests must be restricted to public HTTPS endpoints, and every call should be recorded in an activity log for auditing. A built-in test runner can help verify the function before deploying it to live chat.
Integrating with E-commerce Platforms (Shopify & WooCommerce)
Connecting your AI agent to your e-commerce platform syncs your catalog and policies, enabling the agent to answer product and order questions. Fetchply integrates with both Shopify and WooCommerce.
Shopify Integration
For Shopify, install the Fetchply app from the Shopify App Store. The app syncs your pages, policies, and catalog. You can then enable Product search and Order lookup in Settings and turn on the chat widget from the theme editor. This allows the agent to answer questions about specific products and track orders without requiring custom API development for basic lookups.
WooCommerce Integration
For WooCommerce, the process requires creating WooCommerce REST API keys in WordPress. You provide your store URL and the two API keys to connect the agent. No plugin conflicts or theme surgery is required. Credentials are stored server-side, and no order is revealed without verification.
Routing Logic
Once integrated, the agent routes customer queries through different mechanisms: Instant Answers for repeats, Guided Flows for predictable requests, the knowledge base for open questions, and human handoff for complex issues. This ensures every customer question gets the right path without forcing every request through AI, which can be costly and slow.
Logging and Automations: Connecting to Google Sheets
Integrating your AI agent with tools like Google Sheets allows you to log chat events, capture leads, and automate follow-up actions. This is useful for tracking orders and important messages.
To connect Google Sheets, authorize the connection by approving access with the account that owns or can edit the destination sheet. Select the spreadsheet by pasting the Google Sheet URL or ID, and test the connection.
Configure which agent activity creates rows by turning on options like "Save orders & important messages." Map the supported columns shown in the app, such as Timestamp, Name, Email, Phone, Product, and Message. Keep headers stable after the connection is active to prevent data flow issues.
Verify the data flow by triggering a qualifying test conversation and confirming the expected values appear once, in the correct sheet. If access expires or the sheet is moved, reconnect Google and test again.
Beyond logging, webhooks can push chat events back into your stack. This allows for automating follow-up actions, such as notifying your team or sending a webhook event when a lead is captured.
Software Testing Best Practices for AI Integrations
Building an AI agent is not a set-and-forget task. Software testing best practices recommend integrating quality assurance throughout the development lifecycle. Shift-left testing and behavior-driven development (BDD) are crucial for ensuring robust application performance.

Integrating quality assurance throughout the development lifecycle ensures AI agent reliability.
Shift-Left Testing
Shift-left testing means testing earlier in the development process. For AI agents, this involves testing the training data and custom functions before deploying them to live chat. Use a built-in test runner to verify API calls and check the agent's responses to known queries. This prevents faulty integrations from reaching production.
Behavior-Driven Development
Behavior-driven development involves writing test cases in plain language that describe the behavior of the agent. For example, "Given a customer asks for order status, when they provide a valid order number, then the agent should return the tracking information." This helps ensure the agent meets business requirements and provides a clear framework for QA teams.
Testing Edge Cases
Test both expected queries and edge-case queries. Expected queries verify the agent can handle common questions, while edge-case queries test the agent's ability to handle unexpected or out-of-scope questions gracefully. This includes testing questions the agent should decline to answer. Risk-based testing can help prioritize efforts, focusing on the most critical paths like order lookups and checkout assistance.
Continuous Testing
Continuous testing in your CI/CD pipeline ensures that any updates to the training data or custom functions do not break existing functionality. This transforms quality assurance from a final gatekeeper into a catalyst for innovation and speed.
Sources and further reading
- Product changelog | Fetchply
- How to add an AI chatbot to your Shopify store | Fetchply
- Functions for live API answers | Fetchply
- How to train an AI chatbot on your own data | Fetchply
- Connect Google Sheets — Fetchply
- Functions and webhooks | Fetchply
- 10 Software Testing Best Practices for Elite Teams in 2025 – Group107
- WooCommerce AI support agent | Fetchply
Top comments (0)