Identity Resolution (SDK)
SDK tools can advertise lookup.required — identity attributes the Qefro runtime must resolve before tool.invoke.
This is separate from REST identity forwarding: the SDK receives attributes (email, phone), not raw JWT secrets.
Advertise in handler
app.tool(
{
name: 'my_orders_list',
description: 'List orders for the current customer.',
auth: 'required',
lookup: { required: ['email'] },
input_schema: {
type: 'object',
properties: {
email: { type: 'string', description: 'When channel did not provide email' },
},
},
},
async (ctx) => {
const customer = ctx.customer.require();
return orderService.listForCustomer(customer.id);
},
);
Use lookup: { required: ['phone'] } for phone-first flows (common on WhatsApp).
Sync Tools stores this as preconditions.lookup_required on the Business Tool.
Resolution order
- Verified / channel identity — Portal email, WhatsApp phone, Widget after partial identify.
- Conversation variables — Previously collected values in thread.
- Tool arguments — LLM-filled parameters.
- Ask user — Prompt for missing attribute.
Channel behavior matrix
| Channel | lookup: email | lookup: phone |
|---|---|---|
| Portal / Playground | Admin login email auto | Asks user for phone |
| Asks user for email | WhatsApp phone auto | |
| Widget (anonymous) | Asks user for email | Asks user for phone |
| Widget + identify() | Uses profile email if present | Uses profile if present |
After resolution, your customer.lookup matches the directory — Qefro does not hardcode channel rules in your handler.
Example flows
Widget + email lookup + OTP
- User: “show my orders”
- Runtime: missing email → asks user
- User:
[email protected] - Runtime: invokes SDK with
identity.email - SDK:
lookup→authorizechallenge (OTP) - User: OTP →
tool.resume→ order list
WhatsApp + phone lookup
- User: “my orders”
- Runtime: phone from WhatsApp satisfies
lookup.required: ['phone'] - SDK: lookup by phone → OTP if configured
Portal + email
- Playground uses admin email automatically for
lookup: email - SDK lookup must recognize that email in your customer directory
REST tools and lookup
lookup.required is primarily an SDK sync feature. REST tools typically encode parameters in URL/body and use END_USER_IDENTITY for auth — not SDK-style lookup preconditions.