Skip to main content

No-Code Voice Assistant

In this tutorial, you'll learn how to configure a voice assistant with Telnyx. You won't have to write a single line of code or create an account with anyone besides Telnyx. You'll be able to talk to your assistant over the phone in under ten minutes.

For a real example of the finished product, try out the public demo we built using this tutorial.

Requirements

There are 3 required steps for this tutorial

  1. Configure your AI Assistant
  2. Attach a TeXML Voice Application
  3. Assign a phone number

Configure your AI Assistant

First, navigate to the AI Assistants tab in the portal. You will create a new assistant to configure what context your assistant has and how it behaves.

To help you get started, we've shared the configuration from our public demo below.

Model: meta-llama/Meta-Llama-3.1-70B-Instruct

Instructions:

You are a voice assistant for Telnyx. At Telnyx, we’re architecting and amplifying access to global connectivity. We power communications, wireless, networking and storage from our private, global, multi-cloud IP network all the way out to the hyperlocal edge. And we make this edge infrastructure easily available through intuitive APIs housed in one space. As a voice assistant, you should stay CONCISE and FRIENDLY. You should also not use any formatting like bullet points or bolding because everything will be spoken aloud.
Note

You need to copy the assistant ID for your voice configuration in the next step.

AI Assistant Portal Config

Attach a TeXML Voice Application

Now, navigate to the TeXML Bins tab in the portal. You will create a new bin to configure the voice functionality for your assistant.

You don't need to have a deep understanding of TeXML for this tutorial, but if you'd like to learn more about it, here are some helpful resources:

We've shared some example TeXML below. Where it says PASTE YOUR ASSISTANT ID HERE you will want to use your AI Assistant ID from the previous step.

TeXML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Suppression direction="both" />
</Start>
<Connect>
<AIAssistant id="PASTE YOUR ASSISTANT ID HERE">
<Greeting>Good morning, how can I help you today?</Greeting>
<Voice name="AWS.Polly.Ruth-Neural" />
</AIAssistant>
</Connect>
</Response>
Note

You need to copy the bin URL for your voice configuration in the next step.

TeXML Bin Portal Config

Next, navigate to the TeXML Applications tab in the portal. Create a new application and set the TeXML Bin URL to the URL from the previous step.

TeXML App Portal Config

Assign a phone number

Finally, you need to search and buy a phone number with voice features.

Buy Number Portal Config

After adding the number to your cart, you can assign the voice application you just created and buy the number.

Assign AI App

Test it out!

You should now be able to call your phone number and interact with your voice assistant.

Optional enhancements

ElevenLabs integration for higher-quality voices

To use a voice from ElevenLabs in your assistant you will

  1. Create an ElevenLabs API Key
  2. Securely store this key with Telnyx
  3. Reference the key in your TeXML Bin
Note

From our testing, requests from a free plan are rejected. You will likely have to use a paid plan to set up this integration successfully.

Create an ElevenLabs API Key

First, check out their guide on creating an API Key

Securely store this key with Telnyx

Next, navigate to the Integration Secrets tab in the portal. Choose a memorable identifier to refer to the API key and store it in the Secret Value field.

Note

You will not be able to access the value of a secret after it is stored.

Integration Secret Portal Config

Reference the key in your TeXML Bin

Copy the identifier of the secret you just stored.

Remember the TeXML Bin we created earlier? We are going to modify the voice provider section.

Old TeXML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Suppression direction="both" />
</Start>
<Connect>
<AIAssistant id="PASTE YOUR ASSISTANT ID HERE">
<Greeting>Good morning, how can I help you today?</Greeting>
<Voice name="AWS.Polly.Ruth-Neural" />
</AIAssistant>
</Connect>
</Response>

New TeXML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Suppression direction="both" />
</Start>
<Connect>
<AIAssistant id="PASTE YOUR ASSISTANT ID HERE">
<Greeting>Good morning, how can I help you today?</Greeting>
<Voice name="ElevenLabs.eleven_multilingual_v2.iP95p4xoKVk53GoZ742B" api_key_ref="PASTE YOUR SECRET IDENTIFIER HERE" />
</AIAssistant>
</Connect>
</Response>

In this example, we are using an example ElevenLabs model_id and voice_id to get you started. Feel free to read through their documentation on how to pick a voice_id that works for your use case.

Test it out! (Again!)

You should now be able to call your phone number and interact with your ElevenLabs-integrated voice assistant.

OpenAI integration and configuring hang-ups

To use an LLM from OpenAI in your assistant you will

  1. Create an OpenAI API Key
  2. Securely store this key with Telnyx
  3. Reference the key in your TeXML Bin
  4. Configure the language model in your AI Assistant
Note

From our testing, requests from a free plan are rejected. You will likely have to use a paid plan to set up this integration successfully.

Create an OpenAI API Key

First, check out their guide on creating an API Key

Securely store this key with Telnyx

Next, navigate to the Integration Secrets tab in the portal. Choose a memorable identifier to refer to the API key and store it in the Secret Value field.

Note

You will not be able to access the value of a secret after it is stored.

Integration Secret Portal Config

Reference the key in your TeXML Bin

Copy the identifier of the secret you just stored.

Remember the TeXML Bin we created earlier? We are going to modify the voice provider section.

Old TeXML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Suppression direction="both" />
</Start>
<Connect>
<AIAssistant id="PASTE YOUR ASSISTANT ID HERE">
<Greeting>Good morning, how can I help you today?</Greeting>
<Voice name="AWS.Polly.Ruth-Neural" />
</AIAssistant>
</Connect>
</Response>

New TeXML:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Suppression direction="both" />
</Start>
<Connect>
<AIAssistant id="PASTE YOUR ASSISTANT ID HERE" openai_api_key_ref="PASTE YOUR SECRET IDENTIFIER HERE">
<Greeting>Good morning, how can I help you today?</Greeting>
<Voice name="AWS.Polly.Ruth-Neural" />
</AIAssistant>
</Connect>
</Response>

Configure the language model in your AI Assistant

Back at the AI Assistants tab in the portal, edit your assistant.

First, change the model to an OpenAI model like openai/gpt-4o.

Second, OpenAI models excel at function calling. If you'd like to give your assistant the autonomy to hang up the phone, click Add new Telnyx Function at the bottom of the page and select Hangup.

After doing so, you can optionally update your system prompt to give clear instructions on when a hangup would be appropriate.

AI Assistant Hangup

Test it out! (Again!)

You should now be able to call your phone number and interact with your OpenAI-integrated voice assistant.

Future tutorials

In future tutorials, we will show you how to:

  • Enable outbound calling
  • Provide your assistant with more context than what can fit into its instructions, using embeddings