Let’s build an outbound sales agent that can schedule appointments.
Create an assistant
transcriber
- We’re defining this to make sure the transcriber picks up the custom word “Bicky”model
- We’re using the OpenAI GPT-4 model, which is better at function calling.messages
- We’re defining the assistant’s instructions for how to run the call.functions
- We’re providing a bookAppointment function with a datetime parameter. The assistant can call this during the conversation to book the appointment.voice
- We’re using the Onyx voice from OpenAI.forwardingPhoneNumber
- Since we’ve added this, the assistant will be provided the transferCall function to use.voicemailMessage
- If the call goes to voicemail, this message will be played.firstMessage
- This is the first message the assistant will say when the user picks up.endCallMessage
- This is the message the assistant will deciding to hang up.endCallFunctionEnabled
- This will give the assistant the endCall function.recordingEnabled
- We’ve disabled recording, since we don’t have the user’s consent to record the call.Buy a phone number
id
field- we’ll need it later.Configure your Server URL
bookAppointment
function, we’ll want to handle that function call and actually book the appointment. We also want to let the user know if booking the appointment was unsuccessful.First, we’ll create an endpoint on our server for Vapi to hit. It’ll receive messages as shown in the Function Calling docs. Once created, we’ll add that endpoint URL to the Server URL field in the Account page on the Vapi Dashboard.Handle function calls
bookAppointment
, our server will get something like this:Place a call
forwardingPhoneNumber
, when the user asks to speak to a human, the assistant will transfer the call to that number automatically.We can then check the Dashboard to see the call logs and read the transcripts.