Skip to content
Try Free →

Call your own API from chat

A custom action lets your agent call your own HTTPS endpoint in the middle of a conversation with details it collected, then answer from your reply. Use it for any system AskVault does not connect to directly. Business+

You set the URL, the HTTP method, an auth header and the fields the agent should fill in.

Good fits

  • A CRM or help desk AskVault does not connect to. Your endpoint calls its API.
  • Home-grown inventory, returns or order systems.
  • Order status for a store that is not on Shopify or WooCommerce.
  • Triggering a Zapier or Make scenario.

Before you start

  • Business plan or up.
  • An HTTPS endpoint that answers within a few seconds and returns JSON.
  • Up to 10 custom actions per agent.

Steps

  1. Open Behaviour under Your agent, then Actions.
  2. Under More, open Custom actions and add one.
  3. Fill in the fields below, switch it on and save.
FieldWhat to enter
NameA short name for the action.
MethodGET, POST, PUT, PATCH or DELETE.
Description (when the AI should use it)Say plainly when to use it. This is how the agent decides. There are no trigger phrases.
Endpoint URLWhere AskVault sends the call.
ParametersThe fields the agent fills in: a name, a type and whether it is required.
Auth header and Auth valueOptional. One custom header, for example Authorization with a Bearer token. The value is stored encrypted.
EnabledOff until you switch it on.

What your endpoint receives

For POST, PUT and PATCH, AskVault sends exactly the parameters as a JSON body. For GET and DELETE it sends them as a query string such as ?sku=A12, after any query string already in your URL. There is no fixed envelope around them.

A schema with the fields ticket_subject, priority and customer_email produces:

{
"ticket_subject": "Can't log in to my account",
"priority": "high",
"customer_email": "[email protected]"
}

What your endpoint returns

Return HTTP 200 with a JSON body that describes what happened. The agent reads it and writes its own reply, so keep it self-explanatory: a status, any ID the customer would want, and a short message. A status of 400 or above makes the agent say something generic and offer a person.

Example for a stock check:

app.post('/stock', express.json(), async (req, res) => {
if (req.get('Authorization') !== `Bearer ${process.env.STOCK_TOKEN}`) {
return res.status(401).end();
}
const { sku } = req.body;
const qty = await inventory.count(sku);
res.json({ sku, in_stock: qty > 0, quantity: qty });
});

Customer confirmation

An action that changes something, which is any method other than GET, shows the customer a confirmation card first, such as "I'll apply Create order (order_id=1042). Proceed?". It runs only after the customer's own yes in a later message. A confirmation the AI writes for itself is ignored. A GET action runs without a card.

Security

The action authenticates with the header you configure. Check that header on your server and reject anything without it. Rotate the value if you suspect it leaked.

Signed requests and verified identity (rolling out)

When request signing is on for your workspace, the action editor shows a Signing secret (owners and admins only, hidden until you click Reveal), and every action request carries two extra headers:

  • X-AskVault-Timestamp: Unix seconds when the request was sent.
  • X-AskVault-Signature: sha256= followed by the HMAC-SHA256 of timestamp + "." + raw_body, keyed with your signing secret. This is the same scheme as AskVault's event webhooks, but the secret is a different one.

For POST, PUT and PATCH the JSON body also carries a reserved askvault object next to your parameters:

{
"order_id": "1042",
"askvault": {
"identity_verified": true,
"identity_customer_id": "[email protected]",
"identity_email": "[email protected]",
"workspace_id": "ws_123",
"conversation_id": "conv_456",
"timestamp": 1763640000
}
}

identity_customer_id and identity_email appear only when identity_verified is true, which means the visitor's widget session passed identity verification (the user ID you signed). identity_email is present only when the ID you signed is an email address. The email a visitor types in chat is never put here. For GET and DELETE, which have no body, the same object is sent as JSON in the X-AskVault-Context header, and the signature covers that header's value instead of a body. The query string itself is not signed, so treat GET and DELETE parameters as untrusted input and act only on the signed identity. A signed request never follows a redirect to a different host: point the action at the final URL.

The AI fills in your parameters from the conversation, so a visitor can make it send any email or customer ID they like. Trust askvault.identity_*, never a model parameter such as customer_email, for anything that touches a customer's account. Parameters named askvault, identity_verified, identity_email or identity_customer_id are removed before the request is sent, so the AI cannot fake them.

Verify the signature on the raw bytes, before parsing, and reject requests older than five minutes:

import hashlib, hmac, time
def verify(raw_body: bytes, secret: str, timestamp: str, signature: str) -> bool:
if abs(time.time() - int(timestamp)) > 300:
return False
expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)
# Flask: verify(request.get_data(), SECRET, request.headers["X-AskVault-Timestamp"],
# request.headers["X-AskVault-Signature"])
# GET/DELETE: pass request.headers["X-AskVault-Context"].encode() as raw_body.
const crypto = require('crypto');
function verify(rawBody, secret, timestamp, signature) {
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = 'sha256=' + crypto.createHmac('sha256', secret)
.update(`${timestamp}.`).update(rawBody).digest('hex');
const a = Buffer.from(expected), b = Buffer.from(signature || '');
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
app.post('/refund', express.raw({ type: 'application/json' }), (req, res) => {
if (!verify(req.body, process.env.ASKVAULT_SIGNING_SECRET,
req.get('X-AskVault-Timestamp'), req.get('X-AskVault-Signature'))) {
return res.status(401).end();
}
const { askvault, order_id } = JSON.parse(req.body);
if (!askvault.identity_verified) return res.status(403).json({ error: 'sign in first' });
// act for askvault.identity_customer_id, never for a parameter the AI filled in
});

Limits

  • Timeout. 15 seconds per attempt. The visitor is waiting, so aim to answer in a second or two.
  • Retries. A 5xx response or timeout is retried up to 2 more times by default. A 4xx is never retried. max_retries takes 0 to 2 per action, and 0 means one attempt.
  • Rate. Up to 60 calls per agent per hour. Hitting it gives the customer a polite fallback.
  • Slow work. For jobs over about 10 seconds, reply at once that the work started, finish in the background, and tell the customer another way, such as email.

Turn on dry run while you test an endpoint that changes data.

Check it worked

Ask your agent a question that should need the action in the test chat. Check your endpoint's logs for the call and that the reply uses your data. Add that question to a test suite with the expected behaviour Use an action.

If it doesn't work

The action never fires. The agent sees no reason to call it. Make the description say plainly when to use it, and check the action is on.

Your auth check fails. The header value differs between AskVault and your server. Re-copy it.

The agent gives a generic error. Your endpoint returned an error status or timed out. Check its logs.

The reply reads oddly. Make the JSON you return clearer.