Give the AI agent live context about the signed-in visitor: their plan, trial status, seats, recent activity, open invoices, and any custom attributes. This lets it look up a plan or renewal date instead of relying on static training content. Your backend must verify which account the visitor may access.
You expose one read-only JSON endpoint on your backend. Boei calls it during the conversation via a webhook tool, using a shared bearer token for auth. No SDK changes needed for the basic setup.
How to get there: Go to AI agents in the left menu → click your agent → Actions. Open Copilot from the app header and ask it to create the action described below. Review the proposed action and credential settings before enabling it.
Boei({ email: ... }) call, a lead form, or by typing it).get_customer_account tool.GET to your endpoint with the visitor's email and your shared bearer token.The AI only calls the tool when it's actually useful (billing, plan, usage questions), not on every message.
Host a single endpoint on your backend, for example:
GET https://app.example.com/api/boei/customer-lookup?email={email}
Authorization: Bearer <shared-secret>
200 with {"found": false} if the email isn't a customer. Do not return 404.Return a JSON object. All fields are optional. Include only what you have. Return only fields needed for the supported questions. Keep the response short.
{
"found": true,
"identity": {
"customer_id": "cus_9F3aQ",
"email": "sara@example.com",
"name": "Sara de Vries",
"company": "Acme BV",
"phone": "+31 6 12345678",
"locale": "nl",
"timezone": "Europe/Amsterdam",
"signup_date": "2025-11-14",
"account_url": "https://app.example.com/admin/customers/cus_9F3aQ"
},
"subscription": {
"status": "active",
"plan": "Pro",
"plan_interval": "monthly",
"price": 49,
"currency": "EUR",
"trial": false,
"trial_ends_at": null,
"renews_at": "2026-08-01",
"cancel_at_period_end": false,
"payment_method": "card_visa_4242",
"billing_portal_url": "https://billing.stripe.com/session/xyz"
},
"usage": {
"seats_used": 3,
"seats_limit": 10,
"projects": 12,
"storage_used_gb": 4.2,
"storage_limit_gb": 50,
"period_start": "2026-07-01",
"period_end": "2026-07-31"
},
"billing": {
"open_invoice": false,
"open_invoice_amount": 0,
"last_invoice_date": "2026-07-01",
"last_invoice_amount": 49,
"past_due": false,
"vat_number": "NL123456789B01"
},
"activity": {
"last_login_at": "2026-07-05T14:22:00Z",
"days_since_signup": 236,
"days_since_last_login": 2,
"active_last_30_days": true,
"onboarding_completed": true,
"onboarding_step": null
},
"role": {
"is_admin": true,
"is_owner": true,
"team_size": 4
},
"flags": {
"is_vip": false,
"beta_features": ["new-editor", "ai-summaries"],
"referral_source": "google"
},
"custom": {
"industry": "logistics",
"signup_utm_campaign": "spring-launch",
"csm_name": "Milan"
},
"recent_events": [
{ "type": "invoice_paid", "at": "2026-07-01", "detail": "€49" },
{ "type": "seat_added", "at": "2026-06-18", "detail": "user #3" },
{ "type": "plan_upgraded", "at": "2026-05-02", "detail": "Starter → Pro" }
]
}
Guidance on what to include:
signup_date so the AI can reason about "new vs long-time customer".status, plan, trial_ends_at, renews_at, cancel_at_period_end support common plan and billing questions.open_invoice and past_due let the AI acknowledge payment issues instead of ignoring them.Do not include: other users' emails, chat transcripts, support ticket bodies, uploaded files, or any content the visitor shouldn't see about themselves.
{ "found": false }
Set the action instructions to explain that no account was found and ask the visitor to check their details. Test this response too.
In Copilot, ask:
Store a credential called
customer_lookup_tokenwith value<your shared bearer token>.
Credentials are encrypted at rest and only referenced by name from tools. They appear in the Credentials panel next to the chat, where you can override or delete them.
In Copilot, provide the action settings below. Review the proposal before saving:
{
"name": "get_customer_account",
"description": "Look up the current visitor's account details (plan, trial status, seats, billing state, recent activity). Call this whenever the visitor asks anything about their subscription, billing, invoices, plan limits, usage, or account status. Only call this once you have the visitor's email, either from the SDK identity fields, a lead form, or because they typed it. Do not call it for general product questions.",
"execution_type": "webhook",
"http_method": "GET",
"endpoint_url": "https://app.example.com/api/boei/customer-lookup?email={{context.email}}",
"headers": {
"Authorization": "Bearer {{credential:customer_lookup_token}}",
"Accept": "application/json"
},
"parameters": [],
"response_mapping": {
"found": "found",
"plan": "subscription.plan",
"status": "subscription.status",
"trial_ends_at": "subscription.trial_ends_at",
"renews_at": "subscription.renews_at",
"past_due": "billing.past_due",
"seats_used": "usage.seats_used",
"seats_limit": "usage.seats_limit",
"last_login_at": "activity.last_login_at",
"billing_portal_url": "subscription.billing_portal_url"
},
"requires_confirmation": false,
"is_enabled": true
}
The response_mapping block selects fields from the returned JSON. Do not rely on this mapping to hide private data. Your endpoint must leave out anything the visitor may not see.
Open the widget preview, tell the bot your email, and ask "what plan am I on?" or "when does my trial end?". You should see the AI call get_customer_account in the trace and respond with real values.
A typed email address does not prove who the visitor is. Do not return private account details based only on that address. Use an authenticated backend session or a signed token that your endpoint verifies.
If you want to expose more sensitive fields (open invoice amounts, billing portal URLs, event history), verify the visitor first.
{email, exp} with the shared secret (HMAC-SHA256, 5-minute expiry).Boei({...}). The identity_token goes inside the custom bag because it isn't one of the built-in identity fields:window.Boei({
email: "sara@example.com",
custom: {
identity_token: "<hmac-signed-token>"
}
});
"endpoint_url": "https://app.example.com/api/boei/customer-lookup?email={{context.email}}&identity_token={{context.custom.identity_token}}"
This token is your own endpoint's verification method. It is separate from Boei's signed visitor identity. Validate it on your server; passing a custom field alone does not verify a visitor.
Use a demo account and check a valid visitor, an unknown account, an expired token and an attempt to request another account. Confirm that the endpoint refuses unauthorized access and that the agent explains missing information without inventing account details.