|
| 1 | +--- |
| 2 | +title: "Configuring Inbound and Outbound Calls for Squads" |
| 3 | +sidebarTitle: "Example" |
| 4 | +description: "Configuring assistants for inbound/outbound calls." |
| 5 | +--- |
| 6 | + |
| 7 | +This guide details how to set up and manage inbound and outbound call functionality within Squads, leveraging AI assistants. |
| 8 | + |
| 9 | +### Key Concepts |
| 10 | +* **Transient Assistant:** A temporary assistant configuration passed directly in the request payload. |
| 11 | +* **Assistant ID:** A unique identifier referring to a pre-existing assistant configuration. |
| 12 | + |
| 13 | +<Note>When using Assistant IDs, ensure the `name` property in the payload matches the associated assistant's name accurately.</Note> |
| 14 | + |
| 15 | +### Inbound Call Configuration |
| 16 | + |
| 17 | +When your server receives a request of type `assistant-request`, respond with a JSON payload structured as follows: |
| 18 | + |
| 19 | + |
| 20 | +```json |
| 21 | +{ |
| 22 | + "squad": { |
| 23 | + "members": [ |
| 24 | + { |
| 25 | + "assistant": { |
| 26 | + "name": "Emma", |
| 27 | + "model": { "model": "gpt-4o", "provider": "openai" }, |
| 28 | + "voice": { "voiceId": "emma", "provider": "azure" }, |
| 29 | + "transcriber": { "provider": "deepgram" }, |
| 30 | + "firstMessage": "Hi, I am Emma, what is your name?", |
| 31 | + "firstMessageMode": "assistant-speaks-first" |
| 32 | + }, |
| 33 | + "assistantDestinations": [ |
| 34 | + { |
| 35 | + "type": "assistant", |
| 36 | + "assistantName": "Mary", |
| 37 | + "message": "Please hold on while I transfer you to our appointment booking assistant Mary.", |
| 38 | + "description": "Transfer the user to the appointment booking assistant." |
| 39 | + } |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "assistantId": "your-assistant-id" |
| 44 | + } |
| 45 | + ] |
| 46 | + } |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +**In this example:** |
| 51 | + |
| 52 | +* The first `members` entry is a **transient assistant** (full configuration provided). |
| 53 | +* The second `members` entry uses an **Assistant ID**. |
| 54 | +* `assistantDestinations` defines how to **transfer the call** to another assistant. |
| 55 | + |
| 56 | +### Outbound Call Configuration |
| 57 | + |
| 58 | +To initiate an outbound call, send a POST request to the API endpoint /call/phone with a JSON payload structured as follows: |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "squad": { |
| 63 | + "members": [ |
| 64 | + { |
| 65 | + "assistant": { |
| 66 | + "name": "Emma", |
| 67 | + "model": { "model": "gpt-4o", "provider": "openai" }, |
| 68 | + "voice": { "voiceId": "emma", "provider": "azure" }, |
| 69 | + "transcriber": { "provider": "deepgram" }, |
| 70 | + "firstMessage": "Hi, I am Emma, what is your name?", |
| 71 | + "firstMessageMode": "assistant-speaks-first" |
| 72 | + }, |
| 73 | + "assistantDestinations": [ |
| 74 | + { |
| 75 | + "type": "assistant", |
| 76 | + "assistantName": "Mary", |
| 77 | + "message": "Please hold on while I transfer you to our appointment booking assistant Mary.", |
| 78 | + "description": "Transfer the user to the appointment booking assistant." |
| 79 | + } |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + "assistantId": "your-assistant-id" |
| 84 | + } |
| 85 | + ] |
| 86 | + }, |
| 87 | + "customer": { |
| 88 | + "number": "your-phone-number" |
| 89 | + }, |
| 90 | + "phoneNumberId": "your-phone-number-id" |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +**Key points:** |
| 95 | + |
| 96 | +* `customer.number` is the phone number to call. |
| 97 | +* `phoneNumberId` is a unique identifier for the phone number (obtain this from your provider). |
0 commit comments