healthmatch_michael
01/28/2025, 5:19 AMAtlas
01/28/2025, 5:19 AMVapi
01/28/2025, 5:22 AMVapi
01/28/2025, 5:22 AMhealthmatch_michael
01/28/2025, 5:22 AMVapi
01/28/2025, 5:23 AMhealthmatch_michael
01/28/2025, 5:26 AMVapi
01/28/2025, 5:26 AMhtml
<!-- Example of including VAPI Web SDK via CDN (URL is hypothetical) -->
<script src="https://cdn.vapi.com/sdk/vapi-web-sdk.min.js"></script>
2. **Initialize the SDK**: Before you can make any calls, you need to initialize the SDK with your credentials.
javascript
const vapi = new VAPI({
apiKey: 'your_api_key', // Replace with your actual API key
});
3. **Create a Squad and Trigger a Call**: Use the SDK to create a squad and start a call. You'll need to define the squad members and their roles.
javascript
// Define squad members
const squadMembers = [
{ type: 'assistant', id: 'assistant_id' }, // The assistant that initiates the call
{ type: 'destination', number: '+1234567890' } // The destination phone number
];
// Start the call
vapi.squadCall(squadMembers)
.then(response => {
console.log('Call initiated successfully:', response);
})
.catch(error => {
console.error('Error initiating call:', error);
});
Please replace 'your_api_key'
, 'assistant_id'
, and '+1234567890'
with your actual API key, assistant ID, and destination number, respectively.
Remember, this is a simplified example to give you an idea of how to use the SDK. The actual implementation may vary based on the SDK's methods and the structure of your application. If you need more specific examples or have any questions about the code, feel free to ask!healthmatch_michael
01/28/2025, 5:28 AMVapi
01/28/2025, 5:28 AMShubham Bajaj
01/28/2025, 5:30 AMts
const call = vapi.start(null, null, <insert-here-squadId-or-squadConfig>)
Shubham Bajaj
01/28/2025, 5:30 AMhealthmatch_michael
01/28/2025, 5:30 AMhealthmatch_michael
01/28/2025, 5:30 AM