Custom API Actions (Live Tools)
While web crawling and uploading static knowledge bases are perfect for static information (like FAQs, refund policies, and company history), they have limitations when it comes to dynamic, real-time data.
If you need the chatbot to answer questions about live inventory, real-time pricing, order statuses, or dynamic booking availability (e.g. "Is the blue running shoe in stock in size 10?", "Where is my order #12345?", or "What are the top properties in Mumbai right now?"), you should use Custom API Actions.
Why Use API Actions Instead of Crawling?
- Scale: E-commerce stores and Booking sites have millions of pages. You cannot crawl all of them efficiently into a vector database.
- Freshness: Prices, stock levels, and availability change every minute. If you crawled it yesterday, the bot will hallucinate outdated prices or in-stock statuses today.
- Accuracy: You want the chatbot to read the exact JSON data from your database rather than parsing scraped HTML.
How Custom API Actions Work
Instead of putting all the data into the chatbot, you teach the chatbot how to fetch the data on demand.
When you configure an API Tool, you give the LLM (like GPT-4o or Claude) access to a specific endpoint.
- User asks a question: A user asks, "Do you have any sea-facing hotels in Mumbai under $100?" or "Are the Nike Air Max in stock in size 9?"
- AI Pauses: The LLM realizes it needs real-time data to answer this, so it pauses the conversation.
- Secret API Call: The AI secretly makes an HTTP request to your backend endpoint (e.g.,
GET /api/inventory?product=nike_air_max&size=9orGET /api/properties?city=mumbai). - Data Return: Your backend returns the live JSON data.
- AI Responds: The LLM reads that JSON and writes a beautiful, natural-sounding response back to the user, complete with real-time prices, order tracking, and availability.
Configuring an Action in Sentrup
To set up a new API action, navigate to Knowledge Base > Custom API Actions in your dashboard.
You will need to provide:
- Action Name: A recognizable name for the tool (e.g.,
Get Live Properties,Check Order Status, orCheck Live Inventory). - API Endpoint (URL): The URL the AI should send requests to (e.g.,
https://api.yourdomain.com/v1/inventory). - Authentication Headers (Optional): A JSON block containing any required API keys (e.g.,
{"Authorization": "Bearer YOUR_SECRET_KEY"}). See Security section below. - Description: This is the most important field. You must write clear instructions on when the AI should trigger this tool. For example: "Use this tool when the user asks for available properties, checks stock for a specific product, or wants to know their order status."
Once saved, the Sentrup AI will automatically use this tool whenever a visitor's request aligns with the description you provided!
Security & Trust
Allowing an AI chatbot to trigger your backend APIs requires strict security protocols. Sentrup ensures your data and endpoints remain safe:
- Encrypted Secrets: Any API keys or authentication headers you provide are encrypted at rest using AES-256. They are never exposed to the AI model itself; the AI simply asks the Sentrup backend to execute the tool, and the Sentrup backend securely injects your headers into the HTTP request.
- Read-Only Mentality: We highly recommend configuring your endpoints to only accept
GETrequests (for reading inventory or tracking statuses) to eliminate the risk of accidental data modification. - No Direct Database Access: Unlike Text-to-SQL solutions, API actions act as a firewall. The AI can only request exactly what your API allows, completely neutralizing the risk of SQL injection or accessing unauthorized tables.