Configuring Inbound and Outbound Calls for Squads

Configuring assistants for inbound/outbound calls.

This guide details how to set up and manage inbound and outbound call functionality within Squads, leveraging AI assistants.

Key Concepts

  • Transient Assistant: A temporary assistant configuration passed directly in the request payload.
  • Assistant ID: A unique identifier referring to a pre-existing assistant configuration.
When using Assistant IDs, ensure the name property in the payload matches the associated assistant’s name accurately.

Inbound Call Configuration

When your server receives a request of type assistant-request, respond with a JSON payload structured as follows:

1{
2 "squad": {
3 "members": [
4 {
5 "assistant": {
6 "name": "Emma",
7 "model": { "model": "gpt-4o", "provider": "openai" },
8 "voice": { "voiceId": "emma", "provider": "azure" },
9 "transcriber": { "provider": "deepgram" },
10 "firstMessage": "Hi, I am Emma, what is your name?",
11 "firstMessageMode": "assistant-speaks-first"
12 },
13 "assistantDestinations": [
14 {
15 "type": "assistant",
16 "assistantName": "Mary",
17 "message": "Please hold on while I transfer you to our appointment booking assistant Mary.",
18 "description": "Transfer the user to the appointment booking assistant."
19 }
20 ]
21 },
22 {
23 "assistantId": "your-assistant-id"
24 }
25 ]
26 }
27}

In this example:

  • The first members entry is a transient assistant (full configuration provided).
  • The second members entry uses an Assistant ID.
  • assistantDestinations defines how to transfer the call to another assistant.

Outbound Call Configuration

To initiate an outbound call, send a POST request to the API endpoint /call/phone with a JSON payload structured as follows:

1{
2 "squad": {
3 "members": [
4 {
5 "assistant": {
6 "name": "Emma",
7 "model": { "model": "gpt-4o", "provider": "openai" },
8 "voice": { "voiceId": "emma", "provider": "azure" },
9 "transcriber": { "provider": "deepgram" },
10 "firstMessage": "Hi, I am Emma, what is your name?",
11 "firstMessageMode": "assistant-speaks-first"
12 },
13 "assistantDestinations": [
14 {
15 "type": "assistant",
16 "assistantName": "Mary",
17 "message": "Please hold on while I transfer you to our appointment booking assistant Mary.",
18 "description": "Transfer the user to the appointment booking assistant."
19 }
20 ]
21 },
22 {
23 "assistantId": "your-assistant-id"
24 }
25 ]
26 },
27 "customer": {
28 "number": "your-phone-number"
29 },
30 "phoneNumberId": "your-phone-number-id"
31}

Key points:

  • customer.number is the phone number to call.
  • phoneNumberId is a unique identifier for the phone number (obtain this from your provider).