Skip to content

How to Trigger Live Webhooks and AI Actions from Customer Chats

Actions & Webhooks·Intermediate·8 min read

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)
01

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.

02

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.

tool-definition.jsonjson
{
  "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"]
  }
}
03

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.

api/webhook-handler.tstypescript
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'
  });
}
04

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

Test it on your own website in under 2 minutes.

Enter your domain to index your pages and preview live answers.

https://
No credit card required2-minute automated setupEmbed with one line