Lookups
Let the AI agent fetch a signed-in customer's own data, like an order's status, from your backend, with signed requests.
A lookup is an endpoint on your backend that the AI agent can call to answer questions about a customer's own data, such as "where is my order?" or "which plan am I on?". Set them up under AI agent → Lookups.
How a lookup works
- A customer asks something your knowledge can't answer but your systems can.
- The agent picks a lookup, fills in its parameters (for example the order number the customer gave), and calls your endpoint.
- PandaDesk adds who the customer is and signs the request. Your endpoint answers for that customer only.
- The agent answers from the response and cites it, just like knowledge. A failed lookup isn't an answer: the agent asks for a missing detail or offers your team.
Create a lookup
| Field | Details |
|---|---|
| Name | Lowercase letters, digits and underscores, starting with a letter, 2–40 characters, e.g. order_status. |
| What it looks up, and when to use it | 10–500 characters. The agent reads this to decide when to call it, so be specific. |
| Method | GET or POST. |
| URL | https:// only. Use {name} for parameters in the path, e.g. https://api.example.com/support/orders/{order_id}. |
| Parameters | Up to 8, each with a name, a description for the agent, and whether it's required. Parameters not used in the path go in the query string (GET) or a JSON body (POST). Values are URL-encoded and capped at 200 characters. |
| Auth header | Optional, sent with every request, e.g. Authorization: Bearer sk_live_…. It's never shown again after saving; leave it empty to keep it, or enter - to remove it. |
| Signed-in customers only | On by default, and recommended for anything about a customer's own data. |
Use Test to call the endpoint as a given user ID and see exactly what comes back. You can have up to 10 lookups per workspace.
What PandaDesk sends
| Header | Value |
|---|---|
PandaDesk-User-Id |
The customer's user ID from signed identity. Only sent for verified customers. |
PandaDesk-User-Email |
Their email, for verified customers. |
PandaDesk-Conversation-Id |
The conversation the lookup is for. |
PandaDesk-Signature |
t=<unix seconds>,v1=<hex HMAC-SHA256> (below). |
| Your auth header | If you set one. |
Note: Identify the customer from
PandaDesk-User-Id, never from a parameter. Parameters are filled in by the AI from what the customer typed; the user ID header comes from your own signed identity.
Verify the signature
The signature is an HMAC-SHA256, with your workspace's signing secret, of the string below. Admins find the secret under Settings → Webhooks; a coding agent gets it with get_signing_secret. Keep it in your server's environment as PANDADESK_SIGNING_SECRET. It is not the identity secret.
<t>.<METHOD>.<full URL, including query string>.<body>
The body is empty for GET. Reject requests whose timestamp is more than a few minutes old.
Node.js
import crypto from "node:crypto";
// Pass the method, the full URL PandaDesk called (https://your.host/path?query), the raw body ("" for GET)
// and the PandaDesk-Signature header. Return 401 when it's false; answer only for PandaDesk-User-Id.
export function verifyPandaDeskLookup({ method, url, body = "", signature = "" }, secret = process.env.PANDADESK_SIGNING_SECRET) {
const { t, v1 } = Object.fromEntries(signature.split(",").map((p) => p.split("=")));
if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${t}.${method}.${url}.${body}`).digest("hex");
return v1.length === expected.length && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}
Python
import hashlib, hmac, time
def verify_pandadesk(headers, method, url, body, secret):
parts = dict(p.split("=", 1) for p in headers.get("PandaDesk-Signature", "").split(",") if "=" in p)
t, v1 = parts.get("t"), parts.get("v1")
if not t or not v1 or abs(time.time() - int(t)) > 300:
return False
message = f"{t}.{method}.{url}.{body or ''}".encode()
expected = hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(v1, expected)
Use the exact URL PandaDesk called (scheme, host, path and query string). If your server sits behind a proxy, rebuild it from the forwarded host and protocol.
Show results as cards
Turn on Show results as cards in the chat on a lookup to show its JSON response as cards (orders, plans, bookings), with an optional button that opens a link or runs a browser action on your site. See Cards, suggestions and actions.
Limits and safety
httpsonly, public addresses only, and redirects aren't followed.- A request fails after 8 seconds or if the response is over 200 KB. The agent reads the first 4,000 characters of the response. JSON is easiest for it to read.
- At most 3 lookups per reply, 20 per conversation an hour, and 300 per lookup an hour across all conversations. Past that, the agent is told to try later, so a visitor can't use the chat to flood your backend.
- Lookups marked signed-in customers only aren't offered to the agent at all for visitors who aren't verified.
- Answers that used a lookup are never cached or shown to another customer.
- Each call appears under How was this answered? in the inbox, with its arguments, status and timing. The auth header is never shown.
With your coding agent
list_lookups,save_lookup(create or update),delete_lookuptest_lookupcalls the endpoint as a given signed-in user ID. It returns the exact request sent (URL, body and headers with the signature; your auth header masked), and by default sends the same request again with a wrong signature to check that your backend refuses it with 401 or 403get_signing_secretreturns the signing secret, the exact signed strings for lookups and webhooks, and the verify function abovetest_questionruns the full agent; passas_user_idto test as a signed-in customer, so signed-in-only lookups are available
The signing secret is the same one used for webhooks; rotate it under Settings → Webhooks.