vapi4k-docs Help

Run the Template Applications

If you look at src/main/kotlin/com/myapp/Application.kt, you will see that the Vapi4k plugin is used like any other Ktor plugin. The Vapi4k plugin has a Vapi4kConfig context where you can define the desired applications.

The template includes three applications:

  1. An inbound call application that uses an assistant to respond to incoming calls.

  2. An outbound call application that calls a phone number and uses the assistant to respond.

  3. A web application that uses the assistant to respond to a web page call button.

Verify the Applications

Before running the applications, verify that the assistant request responses and tool calls work correctly for each of the applications.

Verify the Applications

  1. Start the Vapi4k server.

  2. Click on the `VAPI4K_BASE_URL` value in the log to open the Vapi4k admin page.

  3. Click on /vapi4k under InboundCall Applications.

  4. The Assistant Response tab contains the JSON message generated for an inbound call using the /incomingCall/vapi4k path.

  5. Click on Service Tools to see the weather tool.

  6. Type some values for city and state, and click Invoke Tool to see the resulting JSON message.

  7. Have a look at the /callCustomer and /talkApp serverPaths as well.

Inbound Call Application

Configure Vapi for an Inbound Call

  1. Go to the Vapi dashboard.

  2. Click on the green organization button on the lower left.

  3. Click on the Settings option and assign the Server URL.

The Server URL is a combination of the VAPI4K_BASE_URL value and a /inboundCall/serverPath value.

The /inboundCall indicates that the URL corresponds to a Vapi4k inboundCallApplication{} declaration.

The serverPath value is defined in the inboundCallApplication{} declaration and defaults to /vapi4k.

The Server URL should look something like this:

https://c7dc-2601-644-8722-6250-eb1d.ngrok-free.app/inboundCall/vapi4k

Run the Inbound Call Application

  1. Start the Vapi4k server.

  2. Call your Vapi phone number and you should see messages in the admin log.

  3. To test a tool call, ask the assistant "What is the weather in Dallas, Texas?"

Outbound Call Application

Run the Outbound Call Application

  1. Start the Vapi4k server.

  2. Open src/main/kotlin/com/myapp/CallCustomer.kt and edit the phone number appropriately.

  3. Click on the green arrow to the left of fun main() to create the call.

  4. You should now receive a phone call at the specified number.

  5. Ask the assistant "What is the weather in Los Angeles, California?"

Web Application

Run the Web Application

  1. Start the Vapi4k server.

  2. Open the $VAPI4K_BASE_URL/talk URL in your browser.

  3. Click on the talk button and ask the assistant "What is the weather in Miami, Florida?"

Last modified: 05 October 2024