diff --git a/fern/assistants/quickstart.mdx b/fern/assistants/quickstart.mdx index 9bc794a3d..f7f35262b 100644 --- a/fern/assistants/quickstart.mdx +++ b/fern/assistants/quickstart.mdx @@ -6,18 +6,20 @@ slug: assistants/quickstart ## Overview -Create a voice assistant with a simple prompt, attach a phone number, and make your first call. You’ll also learn how to add tools to take real actions. +Create a voice assistant, connect it to a phone number, and make your first calls. You can complete this quickstart in the Dashboard or with the Vapi API. -**In this quickstart, you’ll:** -- Create an assistant (Dashboard or SDK) -- Attach a phone number +**In this quickstart, you'll:** + +- Create and test an assistant +- Connect the assistant to a phone number - Make inbound and outbound calls ## Prerequisites -- A Vapi account and a [Vapi API key](/security-and-privacy/api-keys) +- [A Vapi account](https://dashboard.vapi.ai) +- For cURL or SDK requests, a [Vapi API key](/security-and-privacy/api-keys) -## 1) Create an assistant +## 1. Create an assistant By default, when you create an assistant, the transcriber, model, and voice are set to the [Balanced preset](/assistants/model-intelligence/presets#balanced). @@ -27,20 +29,87 @@ By default, when you create an assistant, the transcriber, model, and voice are - Go to the [Vapi Dashboard](https://dashboard.vapi.ai) → Assistants → Create Assistant. + Open the [Dashboard](https://dashboard.vapi.ai) and select **Assistants**. - - ```txt title="System Prompt" maxLines=8 - You are a friendly phone support assistant. Greet the caller and offer help. Keep responses under 30 words. If a transfer is requested, confirm reason first. + + + Select **Create Assistant** to create a blank assistant. + + + To start from a predefined template instead, select the down arrow next to **Create Assistant**, then choose a template. + + + + + Replace the content in **First Message** and **System Prompt** with the following examples. + + **First message** + + ```txt title="First message" wordWrap + Hello! How can I help you today? + ``` + + **System prompt** + + ```txt title="System prompt" wordWrap + You are a friendly phone support assistant. Greet the caller and offer help. Keep responses under 30 words. If a transfer is requested, confirm the reason first. ``` + + + Assistant editor with First Message and System Prompt fields visible and the other assistant names blurred + - - Click Publish and then “Talk to Assistant” to validate behavior. - Publishing creates a new [version](/assistants/versioning) of your assistant. + + Select **Publish**, review the changes, then select **Quick Publish**. Publishing creates a new [assistant version](/assistants/versioning/versioning-assistants). + + + + Select **Talk** to start a web call. When prompted, allow the Dashboard to use your microphone. + + + + + Export your Vapi API key as an environment variable. + + ```bash + export VAPI_API_KEY="YOUR_VAPI_API_KEY" + ``` + + + + ```bash + curl --request POST \ + --url https://api.vapi.ai/assistant \ + --header "Authorization: Bearer $VAPI_API_KEY" \ + --header "Content-Type: application/json" \ + --data '{ + "name": "Support Assistant", + "firstMessage": "Hello! How can I help you today?", + "model": { + "provider": "openai", + "model": "gpt-4o", + "messages": [ + { + "role": "system", + "content": "You are a friendly phone support assistant. Greet the caller and offer help. Keep responses under 30 words. If a transfer is requested, confirm the reason first." + } + ] + } + }' + ``` + + Copy the `id` from the response. You will use it as `YOUR_ASSISTANT_ID` in the next steps. + + + + ```typescript import { VapiClient } from "@vapi-ai/server-sdk"; @@ -54,7 +123,10 @@ By default, when you create an assistant, the transcriber, model, and voice are provider: "openai", model: "gpt-4o", messages: [ - { role: "system", content: "You are a friendly phone support assistant. Keep responses under 30 words." } + { + role: "system", + content: "You are a friendly phone support assistant. Greet the caller and offer help. Keep responses under 30 words. If a transfer is requested, confirm the reason first." + } ] } }); @@ -62,42 +134,142 @@ By default, when you create an assistant, the transcriber, model, and voice are -## 2) Add a phone number +## 2. Connect a phone number - In the Dashboard, go to Phone Numbers → Create Phone Number → assign your assistant. + + + Open the [Dashboard](https://dashboard.vapi.ai) and select **Phone Numbers**. + + + + Select **Create Phone Number**, then choose **Free Vapi Number**. To use a number from another provider, choose the corresponding import option instead. + + + Create Phone Number dialog with Free Vapi Number selected and the Area Code field visible + + + + + Enter a three-digit US area code in **Area Code**, then select **Create**. + + Your first free Vapi number does not require a payment method. To create additional free Vapi numbers, add a payment method. You can create up to five free Vapi numbers in total. + + + Free Vapi phone numbers support US area codes only. For international use, import a number from another provider. + + + + + Open the phone number. Under **Inbound Settings**, choose the assistant you created in **Assistant**, then select **Save**. + + + + + + + Replace `YOUR_ASSISTANT_ID` with the assistant ID returned in the previous section. + + ```bash + curl --request POST \ + --url https://api.vapi.ai/phone-number \ + --header "Authorization: Bearer $VAPI_API_KEY" \ + --header "Content-Type: application/json" \ + --data '{ + "provider": "vapi", + "numberDesiredAreaCode": "415", + "assistantId": "YOUR_ASSISTANT_ID" + }' + ``` + + Copy the `id` from the response. You will use it as `YOUR_PHONE_NUMBER_ID` to make an outbound call. + + + + ```typescript - const number = await vapi.phoneNumbers.create({ - name: "Support Line", + const phoneNumber = await vapi.phoneNumbers.create({ + provider: "vapi", + numberDesiredAreaCode: "415", assistantId: assistant.id }); ``` -## 3) Make your first calls +## 3. Make your first calls + +### Test an inbound call + +Call the phone number you created. Your assistant answers with its configured first message. + +### Place an outbound call + + + + + + Open the [Dashboard](https://dashboard.vapi.ai), select **Phone Numbers**, then select the phone number that will place the call. + + + + Select **Test**. + + + + Choose **Single Number**, enter the destination phone number, and choose your assistant in **Assistant**. + + + + Select **Call** to start the call immediately, or select **Schedule Call** to place it later. + + - - - Call the phone number you created. Your assistant will answer with the first message. - - + + Test Outbound Call panel with Single Number, destination number, and assistant controls + + + + + ```bash + curl --request POST \ + --url https://api.vapi.ai/call \ + --header "Authorization: Bearer $VAPI_API_KEY" \ + --header "Content-Type: application/json" \ + --data '{ + "phoneNumberId": "YOUR_PHONE_NUMBER_ID", + "assistantId": "YOUR_ASSISTANT_ID", + "customer": { + "number": "+15551234567" + } + }' + ``` + + + ```typescript await vapi.calls.create({ + phoneNumberId: phoneNumber.id, assistantId: assistant.id, - customer: { number: "+1234567890" } + customer: { number: "+15551234567" } }); ``` - - + + ## Next steps - **Add tools**: [Custom tools](/tools/custom-tools) - **Tune speech**: [Speech configuration](/customization/speech-configuration) -- **Use a preset**: [Model Intelligence presets](/assistants/model-intelligence/presets) bundle a transcriber, model, and voice tuned for common use cases, so you can configure your assistant in one click. +- **Use a preset**: [Model Intelligence presets](/assistants/model-intelligence/presets) bundle a transcriber, model, and voice for common use cases. - **Structure data**: [Structured outputs](/assistants/structured-outputs) - **Move to multi-assistant**: [Squads](/squads) diff --git a/fern/static/images/assistants/quickstart/configure-assistant-dashboard.png b/fern/static/images/assistants/quickstart/configure-assistant-dashboard.png new file mode 100644 index 000000000..d66ba145e Binary files /dev/null and b/fern/static/images/assistants/quickstart/configure-assistant-dashboard.png differ diff --git a/fern/static/images/assistants/quickstart/create-assistant-template-dashboard.png b/fern/static/images/assistants/quickstart/create-assistant-template-dashboard.png new file mode 100644 index 000000000..0d165710e Binary files /dev/null and b/fern/static/images/assistants/quickstart/create-assistant-template-dashboard.png differ diff --git a/fern/static/images/assistants/quickstart/create-phone-number-dashboard.png b/fern/static/images/assistants/quickstart/create-phone-number-dashboard.png new file mode 100644 index 000000000..bd907c8f4 Binary files /dev/null and b/fern/static/images/assistants/quickstart/create-phone-number-dashboard.png differ