-
Notifications
You must be signed in to change notification settings - Fork 71
Add Assistant Request Doc #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🌿 Preview your docs: https://vapi-preview-0cfca3d5-4e49-44fc-948e-08b7d042da99.docs.buildwithfern.com |
| ```524:533:libs/core/src/types/message.types.ts | ||
| export class AssistantRequestMessage extends OutboundMessageBase { | ||
| @IsIn(['assistant-request']) | ||
| type: 'assistant-request'; | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this
| } | ||
| ``` | ||
|
|
||
| Sample payload (truncated for brevity): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to API Reference -> Webhook -> Server Message and Assistant Request
| ```1679:1750:libs/core/src/types/message.types.ts | ||
| export class AssistantRequestMessageResponse extends IntersectionType( | ||
| OutboundMessageResponseBase, | ||
| CallAssistant, | ||
| ) { | ||
| destination?: TransferDestinationSip | TransferDestinationNumber; | ||
| error?: string; | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
| "voice": { "provider": "11labs", "voiceId": "..." } | ||
| }, | ||
| "assistantOverrides": { | ||
| "variables": { "accountId": "12345" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls add more creative examples to let users know they can enrich the assistant with context about the user like: name, last name, past call summaries, etc.
| participant Transfer as "Transfer Destination (optional)" | ||
|
|
||
| %% 1. Caller calls Vapi | ||
| Caller->>Vapi: Inbound phone call ("Connect me to support") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need Connect me to support
| sequenceDiagram | ||
| participant Caller | ||
| participant Vapi | ||
| participant ARS as "Assistant Request Server" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename to Your HTTP server
| %% 6. Vapi splits: forward vs assistant | ||
| alt Response includes destination | ||
| Vapi->>Transfer: Forward call to number/SIP destination | ||
| Transfer-->>Caller: Connected to destination | ||
| else Assistant provided (default) | ||
| Vapi->>Caller: Assistant joins call using provided config | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a bit confusing to have both: assistantId and forward destination in the same diagram. Can you pls split into 2 different sequence diagrams?
|
|
||
| ## Troubleshooting & Tips | ||
|
|
||
| - **Timeouts:** The assistant request times out after ~5 s (`DEFAULT_TIMEOUT_SECOND_ASSISTANT_REQUEST`). Keep logic fast or cache lookups. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually 7.5 seconds
| - **Missing server URL:** Calls end immediately with `call-start-error-neither-assistant-nor-server-set`. | ||
| - **Invalid response:** Vapi records ended reasons such as `assistant-request-returned-error` or `assistant-request-returned-no-assistant`. Check the call log and your server logs. | ||
| - **Authentication failures:** Ensure the secret/credential in the phone number matches what you validate in the webhook. | ||
| - **Debugging:** Use the ngrok inspector (`http://127.0.0.1:4040`) to inspect payloads, or log the entire request as shown above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather put a link to our Webhook Logs dashboard page
| slug: webhooks/assistant-request | ||
| --- | ||
|
|
||
| The Assistant Request webhook lets you decide which assistant (or transfer destination) should handle an inbound phone call at runtime. When a phone number or org has a **Server URL** configured, Vapi pauses the call setup, POSTs an `assistant-request` message to your server, and expects you to reply with the assistant configuration to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be more creative in the use case? Also explain that can be used for enriching the context with the caller information and give examples
Description
Testing Steps
fern docs devor navigate to preview deployment