How to Trigger Live Webhooks and AI Actions from Customer Chats
Learn how to enable AI Custom Function Calling and HMAC-verified webhooks in SiteMind to look up live orders, capture CRM leads, book meetings, and trigger Zapier workflows directly from chat.
What you will achieve
- Enable AI assistant to query live backend databases (e.g. order tracking, stock lookup)
- Send qualified lead contact details automatically into your CRM
- Cryptographically verify webhook payloads with SHA-256 HMAC signatures
Prerequisites
- A SiteMind Growth or Pro plan
- An HTTPS webhook receiver endpoint (e.g., your API, Zapier, Make, or pipedream)
Navigate to Webhooks & AI Actions in your SiteMind Dashboard
Log in to SiteMind and open Dashboard > Webhooks. Click "Create Action Endpoint". You will define the webhook URL, custom headers, and the natural language tool definition that tells the AI when to trigger this action.
Define the Action Schema and Trigger Parameters
Specify the tool name and JSON Schema parameter arguments. For example, to allow the assistant to check an order status, create a tool named `check_order_status` with an `order_id` string parameter.
{
"name": "check_order_status",
"description": "Look up real-time shipping status and delivery date for a customer order",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The customer order number (e.g., ORD-8921)"
}
},
"required": ["order_id"]
}
}Configure HMAC SHA-256 Signature Verification
SiteMind signs every outgoing webhook payload using your workspace secret key in the `x-sitemind-signature` header. Verify this header on your server to guarantee the request originated from your authenticated assistant.
import crypto from 'node:crypto';
import type { Request, Response } from 'express';
export function verifySiteMindWebhook(req: Request, res: Response) {
const signatureHeader = req.headers['x-sitemind-signature'] as string;
const secret = process.env.SITEMIND_WEBHOOK_SECRET!;
const rawBody = req.rawBody as string;
const timestamp = signatureHeader.split(',').find((part) => part.startsWith('t='))?.slice(2) ?? '';
const received = signatureHeader.split(',').find((part) => part.startsWith('v1='))?.slice(3) ?? '';
if (!timestamp || !received) {
return res.status(401).json({ error: 'Invalid HMAC signature' });
}
const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
const a = Buffer.from(expected, 'utf8');
const b = Buffer.from(received, 'utf8');
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(401).json({ error: 'Invalid HMAC signature' });
}
// Handle action (e.g., look up order from database)
const { order_id } = req.body.parameters;
return res.json({
status: 'In Transit',
estimatedDelivery: 'Tomorrow by 4:00 PM',
carrier: 'FedEx'
});
}Test the live conversational action in the Playground
In the SiteMind Playground, ask: "Can you check the status of my order ORD-8921?". Watch the assistant intelligently extract the parameter, call your webhook, receive the structured JSON payload, and formulate a polite, grounded natural language reply.
Frequently asked questions
Can the assistant execute write operations like canceling a subscription?
Yes. You can configure any HTTP endpoint (POST, PUT, DELETE). We recommend returning a confirmation token or requiring email verification for sensitive operations.
What happens if my webhook endpoint times out or returns an error?
SiteMind enforces a strict 5-second timeout. If your endpoint fails or times out, the assistant gracefully falls back to a helpful response offering to connect the user with a human support agent.
Ready to put this recipe to work?
Start your 3-day free trial on SiteMind. Connect your website URL, test grounded answers in our interactive playground, and deploy on your site with zero coding.
More tutorials & recipes
How to Migrate from Chatbase to SiteMind in 5 Minutes (Zero Downtime)
Tired of Chatbase dynamic model multipliers and expensive branding removal fees? Here is how to switch your website chatbot to SiteMind in under 5 minutes with zero customer interruption.
How to Embed AI Chat in Shopify, WordPress, Webflow, and Framer
Zero-code installation guide with step-by-step instructions and code snippets for every major website builder and CMS.