- Products API: paginated endpoint returning your products in a standard shape.
- Search API: endpoint for searching products with queries and filters.
- Get by IDs API: endpoint for fetching specific products by their IDs.
Prerequisites
- Three publicly reachable API endpoints for products, search, and get by IDs.
Configure in Dashboard
1
Open Integrations
In your ToteBot dashboard, go to Integrations and under Custom Webshop click Connect.
2
Enter Products API URL
Paste your HTTPS endpoint that returns the first page of products.
Pagination is handled with
?page and ?limit.
Example: https://api.yourstore.com/products3
Enter Search API URL
Paste your HTTPS endpoint for searching products with queries and filters.
Example:
https://api.yourstore.com/products/search4
Enter Get by IDs API URL
Paste your HTTPS endpoint for fetching specific products by their IDs.
Example:
https://api.yourstore.com/products/by-ids5
Enable product page knowledge (optional)
Toggle Scan product pages ON to let ToteBot crawl product pages and enrich AI responses. You can change this later.
6
Connect
Click Connect. The integration validates the URLs and saves your settings.
Products API
Your API must return products with pagination. Endpoint:page: 1-based page number (default: 1)limit: page size (default: 20, recommended up to 250)
- Required:
id,name,url,status(one ofactive|archived|draft),availability(boolean) - Recommended:
description,productType,tags,price.amount,price.currency,images[],created_at,updated_at - Optional:
attributes(key-value pairs for custom fields)
Search API
Your search API should handle product queries with optional filters. Endpoint:query: Search query string (required)filters[availability]: Filter by availability (boolean)filters[price][min]: Minimum price filter (number)filters[price][max]: Maximum price filter (number)filters[productType]: Filter by product type (string)page: 1-based page number (default: 1)limit: page size (default: 10)
Get by IDs API
Your get by IDs API should fetch specific products by their IDs. Endpoint:ids: Comma-separated list of product IDs (required)
ids parameter is empty, return an empty products array:
Reference Implementation
Here’s a complete reference implementation based on ToteBot’s own products API: Products Controller (Node.js/Express):API Validation
ToteBot will validate your API endpoints during the integration setup process:- Products API: Tests connectivity and response structure
- Search API: Validates search functionality with a test query
- Get by IDs API: Ensures proper handling of product ID lookups
Error Handling
Your APIs should handle errors gracefully and return appropriate HTTP status codes: Common Error Responses:200: Success400: Bad Request (invalid parameters)404: Not Found (product/endpoint not found)500: Internal Server Error
Security Considerations
- HTTPS Required: All API endpoints must use HTTPS
- Rate Limiting: Implement rate limiting to prevent abuse
- Input Validation: Validate all query parameters and request data
- CORS: Configure CORS headers if needed for web requests
- Authentication: Consider adding API keys for production use
Performance Optimization
- Caching: Implement caching for frequently accessed product data
- Pagination: Use efficient pagination to handle large product catalogs
- Database Indexing: Ensure proper database indexes for search queries
- CDN: Use a CDN for product images to improve loading times
Best Practices
Data Consistency
- Ensure product availability is real-time
- Keep inventory updated across all channels
- Handle price changes during checkout flow
- Validate product data before returning responses
Testing Your Implementation
- API Endpoints: Test all three endpoints with various parameters
- Error Scenarios: Test with invalid IDs, empty responses, network errors
- Performance: Load test with concurrent users and large catalogs
- Integration: Test end-to-end with ToteBot’s conversation flow
- Edge Cases: Test empty product lists, malformed JSON, timeout scenarios
Validation Rules
- Products API: Must return
productsarray andpaginationobject withhasNextPageboolean - Search API: Must return
productsarray,paginationobject, andquerystring - Get by IDs API: Must return
productsarray (can be empty if no products found) - Product Objects: Should align with the field requirements above; unknown fields go into
attributes
Troubleshooting
- Zero Products: Verify your API returns
products[]andpagination.hasNextPage - Search Issues: Ensure your search endpoint handles queries and filters correctly
- Connectivity: Ensure all URLs are reachable from ToteBot’s backend
- Validation Errors: Check that your API responses match the expected JSON structure
- Performance: Monitor response times and implement caching if needed
Common Issues
Issue: “Unable to connect to Products API”- Solution: Verify the URL is correct and accessible via HTTPS
- Solution: Ensure your search endpoint returns the expected JSON format with
productsandpagination
- Solution: Check that your endpoint handles empty
idsparameter and returns{"products": []}
- Solution: Verify your pagination logic and ensure
hasNextPageis calculated correctly