Create a connection-scoped TeXML call
Initiate an outbound TeXML call using a TeXML application connection ID, not an account SID. Request parameter names are case-sensitive. From and To are required; Texml supplies inline instructions and Url overrides the application XML request URL. When neither is supplied, the application configuration supplies the instructions. The response is a flat call object without a data wrapper.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.texml.calls.create('connection_id', {
From: '+13120001234',
To: '+13121230000',
});
console.log(response.call_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.texml.calls.create(
connection_id="connection_id",
from_="+13120001234",
to="+13121230000",
)
print(response.call_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
call, err := client.Texml.Calls.New(
context.TODO(),
"connection_id",
telnyx.TexmlCallNewParams{
From: "+13120001234",
To: "+13121230000",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", call.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.calls.CallCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallCreateParams params = CallCreateParams.builder()
.From("+13120001234")
.To("+13121230000")
.build();
var response = client.texml().calls().create("connection_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.texml.calls.create("connection_id", from: "+13120001234", to: "+13121230000")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->texml->calls->create(
'connection_id',
From: '+13120001234',
To: '+13121230000',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:calls create \
--api-key 'My API Key' \
--connection-id 1234567890 \
--from +13120001234 \
--to +13121230000curl --request POST \
--url https://api.telnyx.com/v2/texml/calls/{connection_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"From": "+13120001234",
"To": "+13121230000",
"Texml": "<Response><Say>Hello</Say></Response>"
}
'{
"call_sid": "v3:call-control-id",
"from": "+13120001234",
"to": "+13121230000",
"status": "queued"
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10004",
"detail": "Can't be blank: To",
"source": {
"pointer": "/To"
},
"title": "Missing required parameter"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the connection holding the TeXML application to call from.
Body
Connection-scoped outbound call parameters.
The E.164-formatted phone number or SIP URI to present as the caller.
"+13120001234"
The E.164-formatted phone number or SIP URI to call.
"+13121230000"
Inline TeXML instructions to execute when the call is answered.
"<Response><Say>Hello</Say></Response>"
The URL from which to retrieve TeXML instructions. Overrides the TeXML application XML request URL.
"https://example.com/instructions.xml"
HTTP method used to retrieve TeXML instructions from Url.
GET, POST "POST"
Response
The outbound call was queued.
The call control ID of the created call.
"v3:call-control-id"
The caller address.
"+13120001234"
The called address.
"+13121230000"
The initial status of the outbound call.
queued "queued"
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.texml.calls.create('connection_id', {
From: '+13120001234',
To: '+13121230000',
});
console.log(response.call_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.texml.calls.create(
connection_id="connection_id",
from_="+13120001234",
to="+13121230000",
)
print(response.call_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
call, err := client.Texml.Calls.New(
context.TODO(),
"connection_id",
telnyx.TexmlCallNewParams{
From: "+13120001234",
To: "+13121230000",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", call.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.calls.CallCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallCreateParams params = CallCreateParams.builder()
.From("+13120001234")
.To("+13121230000")
.build();
var response = client.texml().calls().create("connection_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.texml.calls.create("connection_id", from: "+13120001234", to: "+13121230000")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->texml->calls->create(
'connection_id',
From: '+13120001234',
To: '+13121230000',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:calls create \
--api-key 'My API Key' \
--connection-id 1234567890 \
--from +13120001234 \
--to +13121230000curl --request POST \
--url https://api.telnyx.com/v2/texml/calls/{connection_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"From": "+13120001234",
"To": "+13121230000",
"Texml": "<Response><Say>Hello</Say></Response>"
}
'{
"call_sid": "v3:call-control-id",
"from": "+13120001234",
"to": "+13121230000",
"status": "queued"
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10004",
"detail": "Can't be blank: To",
"source": {
"pointer": "/To"
},
"title": "Missing required parameter"
}
]
}