Williham
02/19/2025, 12:20 PMShubham Bajaj
02/20/2025, 3:37 AMWilliham
02/20/2025, 7:39 AMShubham Bajaj
02/20/2025, 4:26 PMWilliham
02/20/2025, 8:33 PMShubham Bajaj
02/24/2025, 6:38 AMstart
method signature:
typescript
start(assistant?: CreateAssistantDTO | string, assistantOverrides?: AssistantOverrides, squad?: CreateSquadDTO | string)
The customer information should be passed in the CreateCallDTO which is used when creating a call.
THere's no a direct way to pass customer information in web calls through the current SDK interface.
ts
class CustomerUserEditable {
/**
* This is the number of the customer.
*/
@MinLength(3)
@MaxLength(40)
number?: string;
/**
* This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it.
*
* Use cases:
* - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks.
* - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls.
*
* If `false`, the `number` is still required to only contain alphanumeric characters (regex: `/^\+?[a-zA-Z0-9]+$/`).
*
* @default true (E164 check is enabled)
*/
@ApiPropertyOptional({ default: true })
numberE164CheckEnabled?: boolean;
/**
* This is the SIP URI of the customer.
*/
sipUri?: string;
/**
* This is the name of the customer. This is just for your own reference.
*
* For SIP inbound calls, this is extracted from the `From` SIP header with format `"Display Name" <sip:username@domain>`.
*/
@MaxLength(40)
name?: string;
/**
* This is the extension that will be dialed after the call is answered.
*/
@MaxLength(10)
extension?: string;
}
Shubham Bajaj
02/24/2025, 6:38 AMWilliham
02/24/2025, 2:35 PMShubham Bajaj
02/26/2025, 2:54 AMCan use assistantOverrides.metadata
for this. However, this won’t be visible in the customer field in the logs table. It’s a bit of a hack where you add the information and then retrieve it using the API later. If this works for you, let me know. I’ll share all the details with you.Williham
02/26/2025, 7:48 AMShubham Bajaj
03/02/2025, 2:31 PMconst assistantOverrides = {
metadata: {
customerId: "user_123",
customerName: "John Doe",
// any other customer data you want to track
}
};
// Start the call with metadata
vapi.start(assistantId, assistantOverrides);
This metadata will be available in all webhooks sent to your server. Looking at the server message types in the code:
*/
assistant?: CreateAssistantDTO;
/**
* This is the customer associated with the call.
*
* This matches one of the following:
* - `call.customer`,
* - `call.customerId`.
*/
customer?: CreateCustomerDTO;
/**
* This is the call object.
*
* This matches what was returned in POST /call.
*
* Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
*/
call?: Call;
/** This is the voice input content */
input: string;
}
The webhook payload includes the full call object which contains the assistantOverrides metadata.You can retrieve this information later through the API by fetching call logs.
Here's why this solution works:
- The metadata is persisted with the call record
- It's included in all webhooks and API responses
- You can query calls using the API to find specific customer interactions
- While not shown in the UI customer field, the data is accessible programmatically