Build voice applications using TeXML markup language (TwiML-compatible). Manage applications, calls, conferences, recordings, queues, and streams. This skill provides Go SDK examples.
go get github.com/team-telnyx/telnyx-go
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
All examples below assume client is already initialized as shown above.
All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
import "errors"
result, err := client.Messages.Send(ctx, params)
if err != nil {
var apiErr *telnyx.Error
if errors.As(err, &apiErr) {
switch apiErr.StatusCode {
case 422:
fmt.Println("Validation error — check required fields and formats")
case 429:
// Rate limited — wait and retry with exponential backoff
fmt.Println("Rate limited, retrying...")
default:
fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Error())
}
} else {
fmt.Println("Network error — check connectivity and retry")
}
}
Common error codes: 401 invalid API key, 403 insufficient permissions,
404 resource not found, 422 validation error (check field formats),
429 rate limited (retry with exponential backoff).
ListAutoPaging() for automatic iteration: iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }.Returns multiple call resources for an account. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls
response, err := client.Texml.Accounts.Calls.GetCalls(
context.Background(),
"account_sid",
telnyx.TexmlAccountCallGetCallsParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Calls)
Returns: calls (array[object]), end (integer), first_page_uri (string), next_page_uri (string), page (integer), page_size (integer), start (integer), uri (string)
Initiate an outbound TeXML call. Telnyx will request TeXML from the XML Request URL configured for the connection in the Mission Control Portal.
POST /texml/Accounts/{account_sid}/Calls — Required: To, From, ApplicationSid
Optional: AsyncAmd (boolean), AsyncAmdStatusCallback (string), AsyncAmdStatusCallbackMethod (enum: GET, POST), CallerId (string), CancelPlaybackOnDetectMessageEnd (boolean), CancelPlaybackOnMachineDetection (boolean), CustomHeaders (array[object]), DetectionMode (enum: Premium, Regular), FallbackUrl (string), MachineDetection (enum: Enable, Disable, DetectMessageEnd), MachineDetectionSilenceTimeout (integer), MachineDetectionSpeechEndThreshold (integer), MachineDetectionSpeechThreshold (integer), MachineDetectionTimeout (integer), PreferredCodecs (string), Record (boolean), RecordingChannels (enum: mono, dual), RecordingStatusCallback (string), RecordingStatusCallbackEvent (string), RecordingStatusCallbackMethod (enum: GET, POST), RecordingTimeout (integer), RecordingTrack (enum: inbound, outbound, both), SendRecordingUrl (boolean), SipAuthPassword (string), SipAuthUsername (string), SipRegion (enum: US, Europe, Canada, Australia, Middle East), StatusCallback (string), StatusCallbackEvent (enum: initiated, ringing, answered, completed), StatusCallbackMethod (enum: GET, POST), SuperviseCallSid (string), SupervisingRole (enum: barge, whisper, monitor), Texml (string), TimeLimit (integer), Timeout (integer), Trim (enum: trim-silence, do-not-trim), Url (string), UrlMethod (enum: GET, POST)
response, err := client.Texml.Accounts.Calls.Calls(
context.Background(),
"account_sid",
telnyx.TexmlAccountCallCallsParams{
ApplicationSid: "example-app-sid",
From: "+13120001234",
To: "+13121230000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.From)
Returns: from (string), status (string), to (string)
Returns an individual call identified by its CallSid. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
call, err := client.Texml.Accounts.Calls.Get(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallGetParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", call.AccountSid)
Returns: account_sid (string), answered_by (enum: human, machine, not_sure), caller_name (string), date_created (string), date_updated (string), direction (enum: inbound, outbound), duration (string), end_time (string), from (string), from_formatted (string), price (string), price_unit (string), sid (string), start_time (string), status (enum: ringing, in-progress, canceled, completed, failed, busy, no-answer), to (string), to_formatted (string), uri (string)
Update TeXML call. Please note that the keys present in the payload MUST BE formatted in CamelCase as specified in the example.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
call, err := client.Texml.Accounts.Calls.Update(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallUpdateParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
UpdateCall: telnyx.UpdateCallParam{},
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", call.AccountSid)
Returns: account_sid (string), answered_by (enum: human, machine, not_sure), caller_name (string), date_created (string), date_updated (string), direction (enum: inbound, outbound), duration (string), end_time (string), from (string), from_formatted (string), price (string), price_unit (string), sid (string), start_time (string), status (enum: ringing, in-progress, canceled, completed, failed, busy, no-answer), to (string), to_formatted (string), uri (string)
Returns recordings for a call identified by call_sid.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
response, err := client.Texml.Accounts.Calls.RecordingsJson.GetRecordingsJson(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (uri), next_page_uri (string), page (integer), page_size (integer), previous_page_uri (uri), recordings (array[object]), start (integer), uri (string)
Starts recording with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), channels (enum: 1, 2), conference_sid (uuid), date_created (date-time), date_updated (date-time), duration (string | null), error_code (string | null), price (string | null), price_unit (string | null), sid (string), source (enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking), start_time (date-time), track (enum: inbound, outbound, both), uri (string)
Updates recording resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
response, err := client.Texml.Accounts.Calls.Recordings.RecordingSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
CallSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), channels (enum: 1, 2), conference_sid (uuid), date_created (date-time), date_updated (date-time), duration (string | null), error_code (string | null), price (string | null), price_unit (string | null), sid (string), source (enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking), start_time (date-time), track (enum: inbound, outbound, both), uri (string)
Starts siprec session with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
response, err := client.Texml.Accounts.Calls.SiprecJson(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallSiprecJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), date_created (string), date_updated (string), error_code (string), sid (string), start_time (string), status (enum: in-progress, stopped), track (enum: both_tracks, inbound_track, outbound_track), uri (string)
Updates siprec session identified by siprec_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json
response, err := client.Texml.Accounts.Calls.Siprec.SiprecSidJson(
context.Background(),
"siprec_sid",
telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
CallSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), date_updated (string), error_code (string), sid (string), status (enum: in-progress, stopped), uri (string)
Starts streaming media from a call to a specific WebSocket address.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
response, err := client.Texml.Accounts.Calls.StreamsJson(
context.Background(),
"call_sid",
telnyx.TexmlAccountCallStreamsJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), date_updated (date-time), name (string), sid (string), status (enum: in-progress), uri (string)
Updates streaming resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
response, err := client.Texml.Accounts.Calls.Streams.StreamingSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
CallSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), date_updated (date-time), sid (string), status (enum: stopped), uri (string)
Lists conference resources.
GET /texml/Accounts/{account_sid}/Conferences
response, err := client.Texml.Accounts.Conferences.GetConferences(
context.Background(),
"account_sid",
telnyx.TexmlAccountConferenceGetConferencesParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Conferences)
Returns: conferences (array[object]), end (integer), first_page_uri (string), next_page_uri (string), page (integer), page_size (integer), start (integer), uri (string)
Returns a conference resource.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
conference, err := client.Texml.Accounts.Conferences.Get(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceGetParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", conference.AccountSid)
Returns: account_sid (string), api_version (string), call_sid_ending_conference (string), date_created (string), date_updated (string), friendly_name (string), reason_conference_ended (enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded), region (string), sid (string), status (enum: init, in-progress, completed), subresource_uris (object), uri (string)
Updates a conference resource.
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
conference, err := client.Texml.Accounts.Conferences.Update(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceUpdateParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", conference.AccountSid)
Returns: account_sid (string), api_version (string), call_sid_ending_conference (string), date_created (string), date_updated (string), friendly_name (string), reason_conference_ended (enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded), region (string), sid (string), status (enum: init, in-progress, completed), subresource_uris (object), uri (string)
Lists conference participants
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
response, err := client.Texml.Accounts.Conferences.Participants.GetParticipants(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (string), next_page_uri (string), page (integer), page_size (integer), participants (array[object]), start (integer), uri (string)
Dials a new conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
response, err := client.Texml.Accounts.Conferences.Participants.Participants(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceParticipantParticipantsParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), call_sid (string), coaching (boolean), coaching_call_sid (string), conference_sid (uuid), end_conference_on_exit (boolean), hold (boolean), muted (boolean), status (enum: connecting, connected, completed), uri (string)
Gets conference participant resource
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
participant, err := client.Texml.Accounts.Conferences.Participants.Get(
context.Background(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantGetParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", participant.AccountSid)
Returns: account_sid (string), api_version (string), call_sid (string), call_sid_legacy (string), coaching (boolean), coaching_call_sid (string), coaching_call_sid_legacy (string), conference_sid (uuid), date_created (string), date_updated (string), end_conference_on_exit (boolean), hold (boolean), muted (boolean), status (enum: connecting, connected, completed), uri (string)
Updates a conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
participant, err := client.Texml.Accounts.Conferences.Participants.Update(
context.Background(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantUpdateParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", participant.AccountSid)
Returns: account_sid (string), api_version (string), call_sid (string), call_sid_legacy (string), coaching (boolean), coaching_call_sid (string), coaching_call_sid_legacy (string), conference_sid (uuid), date_created (string), date_updated (string), end_conference_on_exit (boolean), hold (boolean), muted (boolean), status (enum: connecting, connected, completed), uri (string)
Deletes a conference participant
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
err := client.Texml.Accounts.Conferences.Participants.Delete(
context.Background(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantDeleteParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
ConferenceSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
Lists conference recordings
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
response, err := client.Texml.Accounts.Conferences.GetRecordings(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceGetRecordingsParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (string), next_page_uri (string), page (integer), page_size (integer), participants (array[object]), recordings (array[object]), start (integer), uri (string)
Returns recordings for a conference identified by conference_sid.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
response, err := client.Texml.Accounts.Conferences.GetRecordingsJson(
context.Background(),
"conference_sid",
telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (uri), next_page_uri (string), page (integer), page_size (integer), previous_page_uri (uri), recordings (array[object]), start (integer), uri (string)
Lists queue resources.
GET /texml/Accounts/{account_sid}/Queues
page, err := client.Texml.Accounts.Queues.List(
context.Background(),
"account_sid",
telnyx.TexmlAccountQueueListParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)
Returns: end (integer), first_page_uri (string), next_page_uri (string), page (integer), page_size (integer), queues (array[object]), start (integer), uri (string)
Creates a new queue resource.
POST /texml/Accounts/{account_sid}/Queues
queue, err := client.Texml.Accounts.Queues.New(
context.Background(),
"account_sid",
telnyx.TexmlAccountQueueNewParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", queue.AccountSid)
Returns: account_sid (string), average_wait_time (integer), current_size (integer), date_created (string), date_updated (string), max_size (integer), sid (string), subresource_uris (object), uri (string)
Returns a queue resource.
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
queue, err := client.Texml.Accounts.Queues.Get(
context.Background(),
"queue_sid",
telnyx.TexmlAccountQueueGetParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", queue.AccountSid)
Returns: account_sid (string), average_wait_time (integer), current_size (integer), date_created (string), date_updated (string), max_size (integer), sid (string), subresource_uris (object), uri (string)
Updates a queue resource.
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
queue, err := client.Texml.Accounts.Queues.Update(
context.Background(),
"queue_sid",
telnyx.TexmlAccountQueueUpdateParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", queue.AccountSid)
Returns: account_sid (string), average_wait_time (integer), current_size (integer), date_created (string), date_updated (string), max_size (integer), sid (string), subresource_uris (object), uri (string)
Delete a queue resource.
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
err := client.Texml.Accounts.Queues.Delete(
context.Background(),
"queue_sid",
telnyx.TexmlAccountQueueDeleteParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
Returns multiple recording resources for an account.
GET /texml/Accounts/{account_sid}/Recordings.json
response, err := client.Texml.Accounts.GetRecordingsJson(
context.Background(),
"account_sid",
telnyx.TexmlAccountGetRecordingsJsonParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (uri), next_page_uri (string), page (integer), page_size (integer), previous_page_uri (uri), recordings (array[object]), start (integer), uri (string)
Returns recording resource identified by recording id.
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
texmlGetCallRecordingResponseBody, err := client.Texml.Accounts.Recordings.Json.GetRecordingSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)
Returns: account_sid (string), call_sid (string), channels (enum: 1, 2), conference_sid (uuid), date_created (date-time), date_updated (date-time), duration (string | null), error_code (string | null), media_url (uri), sid (string), source (enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking), start_time (date-time), status (enum: in-progress, completed, paused, stopped), subresources_uris (object), uri (string)
Deletes recording resource identified by recording id.
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
err := client.Texml.Accounts.Recordings.Json.DeleteRecordingSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
Returns multiple recording transcription resources for an account.
GET /texml/Accounts/{account_sid}/Transcriptions.json
response, err := client.Texml.Accounts.GetTranscriptionsJson(
context.Background(),
"account_sid",
telnyx.TexmlAccountGetTranscriptionsJsonParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.End)
Returns: end (integer), first_page_uri (uri), next_page_uri (string), page (integer), page_size (integer), previous_page_uri (uri), start (integer), transcriptions (array[object]), uri (string)
Returns the recording transcription resource identified by its ID.
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
response, err := client.Texml.Accounts.Transcriptions.Json.GetRecordingTranscriptionSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.AccountSid)
Returns: account_sid (string), api_version (string), call_sid (string), date_created (date-time), date_updated (date-time), duration (string | null), recording_sid (string), sid (string), status (enum: in-progress, completed), transcription_text (string), uri (string)
Permanently deletes a recording transcription.
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
err := client.Texml.Accounts.Transcriptions.Json.DeleteRecordingTranscriptionSidJson(
context.Background(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
AccountSid: "550e8400-e29b-41d4-a716-446655440000",
},
)
if err != nil {
log.Fatal(err)
}
Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side. The secrets are not visible in any logs.
POST /texml/secrets — Required: name, value
response, err := client.Texml.Secrets(context.Background(), telnyx.TexmlSecretsParams{
Name: "My Secret Name",
Value: "My Secret Value",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Data)
Returns: name (string), value (enum: REDACTED)
Returns a list of your TeXML Applications.
GET /texml_applications
page, err := client.TexmlApplications.List(context.Background(), telnyx.TexmlApplicationListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), created_at (string), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), friendly_name (string), id (string), inbound (object), outbound (object), record_type (string), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), updated_at (string), voice_fallback_url (uri), voice_method (enum: get, post), voice_url (uri)
Creates a TeXML Application.
POST /texml_applications — Required: friendly_name, voice_url
Optional: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), inbound (object), outbound (object), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), voice_fallback_url (uri), voice_method (enum: get, post)
texmlApplication, err := client.TexmlApplications.New(context.Background(), telnyx.TexmlApplicationNewParams{
FriendlyName: "call-router",
VoiceURL: "https://example.com",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), created_at (string), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), friendly_name (string), id (string), inbound (object), outbound (object), record_type (string), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), updated_at (string), voice_fallback_url (uri), voice_method (enum: get, post), voice_url (uri)
Retrieves the details of an existing TeXML Application.
GET /texml_applications/{id}
texmlApplication, err := client.TexmlApplications.Get(context.Background(), "1293384261075731499")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), created_at (string), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), friendly_name (string), id (string), inbound (object), outbound (object), record_type (string), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), updated_at (string), voice_fallback_url (uri), voice_method (enum: get, post), voice_url (uri)
Updates settings of an existing TeXML Application.
PATCH /texml_applications/{id} — Required: friendly_name, voice_url
Optional: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), inbound (object), outbound (object), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), voice_fallback_url (uri), voice_method (enum: get, post)
texmlApplication, err := client.TexmlApplications.Update(
context.Background(),
"1293384261075731499",
telnyx.TexmlApplicationUpdateParams{
FriendlyName: "call-router",
VoiceURL: "https://example.com",
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), created_at (string), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), friendly_name (string), id (string), inbound (object), outbound (object), record_type (string), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), updated_at (string), voice_fallback_url (uri), voice_method (enum: get, post), voice_url (uri)
Deletes a TeXML Application.
DELETE /texml_applications/{id}
texmlApplication, err := client.TexmlApplications.Delete(context.Background(), "1293384261075731499")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)
Returns: active (boolean), anchorsite_override (enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany), call_cost_in_webhooks (boolean), created_at (string), dtmf_type (enum: RFC 2833, Inband, SIP INFO), first_command_timeout (boolean), first_command_timeout_secs (integer), friendly_name (string), id (string), inbound (object), outbound (object), record_type (string), status_callback (uri), status_callback_method (enum: get, post), tags (array[string]), updated_at (string), voice_fallback_url (uri), voice_method (enum: get, post), voice_url (uri)