Eric
03/02/2025, 8:35 PMVapi Support Bot
03/02/2025, 8:36 PMjson
{
"provider": "custom-knowledge-base",
"server": {
"url": "your-server-url"
}
}
### Key Points:
- The provider
field is mandatory and should be set to "custom-knowledge-base"
.
- The server
object must include a valid url
.
### Example POST Request:
When making a POST request to Vapi, you would also need to include headers for authentication:
python
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {your_auth_token}"
}
response = InternalRequestHandler.post("https://api.vapi.ai/call", json=payload, headers=headers)
Make sure to replace your_auth_token
with your actual token for secure authentication.
If you need more specific examples or have any other questions, feel free to ask! 😊
Sources:
- [Report on Sending Data to Vapi from n8n](https://discord.com/channels/1211482211119796234/1211483291191083018/1340615317772308520)
- [Example POST Request to Vapi](https://discord.com/channels/1211482211119796234/1211483291191083018/1343574701909344297)Eric
03/02/2025, 8:39 PMVapi Support Bot
03/02/2025, 8:41 PMtransferCall
Tool**:
Create a transfer call tool that specifies the destination. Here’s an example of how to define this tool:
javascript
export const TRANSFER_CALL = (number: string): CreateTransferCallToolDto => {
return {
type: "transferCall",
destinations: [
{
type: "number",
number: number,
},
],
messages: [
{
type: "request-start",
content: "Transferring your call...",
conditions: [
{
param: "destination",
operator: "eq",
value: number
},
],
},
],
};
};
2. **Integrate with Custom LLM**:
Integrate this tool within your custom Language Learning Model (LLM) configuration:
javascript
export const MODEL: CustomLlmModel = {
provider: "custom-llm",
url: `${ENDPOINT}/api/agent`,
model: "gpt-4o",
tools: [TRANSFER_CALL("+17753609450")]
};
3. **Handle Streaming Responses**:
Ensure that your custom LLM sends responses in Server-Sent Events (SSE) format to Vapi.
4. **Trigger the transferCall
Function**:
When a trigger condition is met, invoke the transferCall
function:
json
{
"type": "transfer",
"destination": {
"type": "number",
"number": "+1234567890" // Example number
}
}
5. **Respond to Transfer Requests**:
Your server should respond with either the destination to transfer the call or an error message:
json
{
"destination": {
"type": "number",
"message": "Connecting you to our support line.",
"number": "+14155552671"
}
}
### Webhook ResponseVapi Support Bot
03/02/2025, 8:41 PMtransfer-destination-request
webhook is sent to your server, which you need to set up to handle incoming requests and respond appropriately.
For more detailed information, you can refer to the [dynamic call transfers guide](https://docs.vapi.ai/phone-calling/dynamic-call-transfers).
If you have any more questions or need further clarification, feel free to ask! 😊
Source:
- [Steps to Transfer a Call using VAPI](https://docs.vapi.ai/phone-calling/dynamic-call-transfers)Eric
03/02/2025, 8:42 PMVapi Support Bot
03/02/2025, 8:42 PMjson
{
"destination": {
"type": "number",
"message": "Connecting you to our support line.",
"number": "+14155552671"
}
}
### Key Points:
- The destination
object contains the type of destination (e.g., number or SIP).
- The message
field provides feedback to the user about the transfer status.
- The number
field specifies the actual number to which the call is being transferred.
If the transfer cannot be completed for any reason, you would typically receive an error response instead, which might look like this:
json
{
"error": "Invalid destination specified."
}
If you have any more questions or need further clarification, feel free to ask! 😊
Source:
- [Steps to Transfer a Call using VAPI](https://docs.vapi.ai/phone-calling/dynamic-call-transfers)Eric
03/02/2025, 8:47 PMVapi Support Bot
03/02/2025, 8:48 PMCEO_Call_Transfer
tool correctly for sending to Vapi, you can break it down into the main components that Vapi expects. Here’s how you can structure it:
### 1. Define the Tool
You can define the tool as follows:
json
{
"name": "CEO_Call_Transfer",
"type": "transferCall",
"destinations": [
{
"type": "number",
"number": "+14058182636",
"description": "Transfer the caller to the CEO.",
"transferPlan": {
"mode": "warm-transfer-with-twiml",
"twiml": "<Say>Hello, you have an incoming call from eric huggins.</Say><Pause length=\"1\"/><Say>They are calling to speak with you.</Say><Pause length=\"1\"/><Say>Connecting you now.</Say>"
}
}
],
"function": {
"name": "CEO_Call_Transfer",
"description": "Use this function to transfer the caller to the CEO with a warm introduction using TwiML.",
"parameters": {
"type": "object",
"properties": {
"destination": {
"type": "string",
"enum": ["+14058182636"],
"description": "The destination phone number to transfer the call to."
}
},
"required": ["destination"]
}
},
"messages": [
{
"type": "request-start",
"content": "I am forwarding your call to the CEO. Please stay on the line.",
"conditions": [
{
"param": "destination",
"operator": "eq",
"value": "+14058182636"
}
]
}
]
}
### 2. Sending to Vapi
When sending this to Vapi, ensure you wrap it in the appropriate structure for the API request. Here’s an example of how you might structure the entire request:
```json
{
"provider": "custom-knowledge-base",
"server": {
"url": "your-server-url"
},
"tools": [
{
"name": "CEO_Call_Transfer",
"type": "transferCall",
"destinations": [
{
"type": "number",
"number": "+14058182636",Vapi Support Bot
03/02/2025, 8:48 PMprovider
and server
fields are correctly set for your Vapi integration.
- The destinations
array should contain the correct destination details.
- The function
and messages
sections should be structured as shown to ensure proper functionality.
If you have any more questions or need further clarification, feel free to ask! 😊
Source:
- [Steps to Transfer a Call using VAPI](https://docs.vapi.ai/phone-calling/dynamic-call-transfers)Mason | Building KOI
03/02/2025, 8:56 PMEric
03/02/2025, 9:27 PMMason | Building KOI
03/02/2025, 10:29 PMKyle Brunker
03/03/2025, 2:15 PM{
"destination": {
"type": "number",
"number": "+14058182636",
"message": "Connecting you to our support line."
}
}
Key Points:
1. The type field should be "transfer" for direct transfers or "transferCall" when defining a tool.
2. The destination object must include:
type: "number" for phone numbers or "sip" for SIP URIs
number: The phone number to transfer to
message (optional): What to say before transferring
3. For dynamic transfers based on contacts, you'll need to set up a webhook endpoint that receives the transfer request and returns the appropriate destination based on your contact's "assignedTo" field.Kyle Brunker
03/03/2025, 2:15 PM