This is the API V2 documentation. To switch out of beta revert back to our API V1.

Open SidemenuDocs
Close Sidemenu

TeXML Translator Setuptexml-translator-setup

TeXML is an XML based data structure used by Telnyx to build quick Call Control applications to be associated with your Telnyx phone numbers. TeXML is the quickest way to get started with Call Control using a simple .xml file. TeXML allows you to specify call instructions in your file using commands called verbs and nouns. TeXML Translator starts at the top of your TeXML file and executes your TeXML commands sequentially in the order they are arranged in the file.

In this guide, you'll learn how to write a simple text to speech TeXML application using Telnyx Call Control in just five lines of code.

Step 1: Setup a Telnyx Account, Phone Number, and TeXML Applicationstep-1--setup-a-telnyx-account--phone-number--and-texml-application

First, follow our Quickstart guide to create a Telnyx account, phone number, and TeXML Application.

Step 2: Create an XML file containing TeXML call instructionsstep-2--create-an-xml-file-containing-texml-call-instructions

If you already have an XML call instruction file from another provider, skip to Step 3. TeXML Translator will seamlessly interpret your existing verbs and nouns.

Create an empty standard .xml file using your preferred editor.

TeXML files contain the following items:

  • <Response> element -- tag defining the body of the TeXML document
  • verb -- an XML tag denoting the action that you want Telnyx to take
  • noun -- the item for the action specified in the associated verb

Our TeXML Translator API documentationAPI contains full details of currently supported commands.

In this example, we want to our application to answer incoming calls, play some speech to the caller and hangup so we only need <Say> and <Hangup>.

<?xml version="1.0" encoding="UTF-8"?>
  <!-- XML file setup above-->
 <!-- The Response element wraps the body and is required -->
     <!-- You don't need to issue an answer command, start with Say for text to speech -->
    <Say>This is TeXML text to speech setup in seconds! The call will now hangup.</Say>
    <!-- For this example, you want to hangup the call otherwise there will be silence -->
    <Hangup />

Step 3: Make your TeXML file accessible on the internetstep-3--make-your-texml-file-accessible-on-the-internet

In order to execute your TeXML file, it has to be available via the internet for Telnyx Call Control to execute. Upload the XML file to your own publicly accessible server or use a temporary file storage service such as Developers for this example.

Step 4: Configure your Telnyx Call Control Application to point at your TeXML filestep-4--configure-your-telnyx-call-control-application-to-point-at-your-texml-file

In your Telnyx Mission Control Portal account created in Step 1:

  • Select "Call Control"PORTAL on the left-hand side navigation menu and navigate to the TeXML Applications tab
  • Edit the TeXML Application you created in Step 1 by clicking on the row
  • Change the Implementation from Webhook to XML
  • For this example, change the XML Request Method to GET
  • Enter the URL for the XML file you made available via the internet in Step 3
  • Save All Changes
    TeXML Screenshot

Step 5: Dial your Telnyx numberstep-5--dial-your-telnyx-number

Using your favorite telephony client or your own device, dial the number you purchased in Step 1 which is connected to the Call Control Application we just configured. The call will answer automatically and you should hear your text to speech playing. It's that simple!

Was this page helpful?was-this-page-helpful