webcalling using squads
# support
y
Hi, I'm trying to make a Vapi web calling using squads instead of the assistants configuration. https://docs.vapi.ai/quickstart/web Web calling works when invoking an assistant, but not for a squad. In the dashboard though, when testing a squad with the "talk with squad" button, the web calling is working, so I guess it should work somehow. Has anyone ever managed to make a web call using squads?
v
Hi there! 👋 I can help you with setting up web calling for squads in Vapi. To make web calls using squads instead of assistants, you'll need to use the Vapi Web SDK with the
squadCall
method rather than the regular assistant call method. Here's how: 1. **Install the SDK**:
Copy code
bash
npm install @vapi-ai/web
2. **Initialize the SDK**:
Copy code
javascript
import Vapi from "@vapi-ai/web";
const vapi = new Vapi("your-public-key");
3. **Create a squad call**:
Copy code
javascript
const squadMembers = [
    { type: 'assistant', id: 'assistant_id' }, // The assistant to initiate the call
    { type: 'destination', number: '+1234567890' } // Destination phone number
];

vapi.squadCall(squadMembers)
    .then(response => {
        console.log('Call initiated successfully:', response);
    })
    .catch(error => {
        console.error('Error initiating call:', error);
    });
The first member should be an assistant who will initiate the call [VAPI Integration Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/1333667779039203380). Be aware of some known issues with squad web calling: - Call transfer issues between agents in a squad - Voice selection problems specific to squads - Webhook call inconsistencies - Function call errors Since web calling works when using the "talk with squad" button in the dashboard, it suggests the squad configuration itself is correct. The issue might be in how you're implementing the SDK call. Double-check your API key, assistant IDs, and make sure you're using the correct method for squad calls. Let me know if you need any clarification or run into specific errors! Sources: - [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web) - [VAPI Integration Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333667779039203380)
y
@Vapi Support Bot can you give me an example with two temporary assistants (A and B) where assistant A has assistantDestinations = assistant B? Or could you provide me with the full documentation regarding squadCall with webCalling? I don't have access to the 'Vapi integration Discussion' you are referring to.
s
Copy code
ts
vapi.start(null, null, <insert-your-squad-config-here>)
@yonnigm you need to pass the squad config as third parameter to the start method. Let me know if you need any clarification on any part of this integration, or if you'd like more specific details about any aspect of the configuration.
g
@Shubham Bajaj How can we start the call with squad id instead of squad configuring on frontend? I would like to ocnfigure on backend and just pass the squadid for making web call
k
As of now, you can only use SQUAD config to start the web calls using Web SDK. You cannot use SQUAD ID. It's a limitation for now, but you can raise a feature request for it to use the SQUAD ID as well. You can raise an feature request for it over here: https://roadmap.vapi.ai
g
Hello, thanks for your answer but I just tried and seems working. I passed the squad Id that is used by createsquaddto for my understanding.
(Null,null,squadid)
k
If it's working, then great! The team might have added the functionality. Good for you!