Loading...
Loading...
Build voice applications using TeXML markup language (TwiML-compatible). Manage applications, calls, conferences, recordings, queues, and streams. This skill provides Go SDK examples.
npx skill4agent add team-telnyx/skills telnyx-texml-gogo get github.com/team-telnyx/telnyx-goimport (
"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")),
)clientimport "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")
}
}401403404422429ListAutoPaging()iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }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)callsendfirst_page_urinext_page_uripagepage_sizestarturiPOST /texml/Accounts/{account_sid}/CallsToFromApplicationSidAsyncAmdAsyncAmdStatusCallbackAsyncAmdStatusCallbackMethodCallerIdCancelPlaybackOnDetectMessageEndCancelPlaybackOnMachineDetectionCustomHeadersDetectionModeFallbackUrlMachineDetectionMachineDetectionSilenceTimeoutMachineDetectionSpeechEndThresholdMachineDetectionSpeechThresholdMachineDetectionTimeoutPreferredCodecsRecordRecordingChannelsRecordingStatusCallbackRecordingStatusCallbackEventRecordingStatusCallbackMethodRecordingTimeoutRecordingTrackSendRecordingUrlSipAuthPasswordSipAuthUsernameSipRegionStatusCallbackStatusCallbackEventStatusCallbackMethodSuperviseCallSidSupervisingRoleTexmlTimeLimitTimeoutTrimUrlUrlMethod 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)fromstatustoGET /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)account_sidanswered_bycaller_namedate_createddate_updateddirectiondurationend_timefromfrom_formattedpriceprice_unitsidstart_timestatustoto_formatteduriPOST /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)account_sidanswered_bycaller_namedate_createddate_updateddirectiondurationend_timefromfrom_formattedpriceprice_unitsidstart_timestatustoto_formatteduriGET /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)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiPOST /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)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codepriceprice_unitsidsourcestart_timetrackuriPOST /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)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codepriceprice_unitsidsourcestart_timetrackuriPOST /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)account_sidcall_siddate_createddate_updatederror_codesidstart_timestatustrackuriPOST /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)account_sidcall_siddate_updatederror_codesidstatusuriPOST /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)account_sidcall_siddate_updatednamesidstatusuriPOST /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)account_sidcall_siddate_updatedsidstatusuriGET /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)conferencesendfirst_page_urinext_page_uripagepage_sizestarturiGET /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)account_sidapi_versioncall_sid_ending_conferencedate_createddate_updatedfriendly_namereason_conference_endedregionsidstatussubresource_urisuriPOST /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)account_sidapi_versioncall_sid_ending_conferencedate_createddate_updatedfriendly_namereason_conference_endedregionsidstatussubresource_urisuriGET /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)endfirst_page_urinext_page_uripagepage_sizeparticipantsstarturiPOST /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)account_sidcall_sidcoachingcoaching_call_sidconference_sidend_conference_on_exitholdmutedstatusuriGET /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)account_sidapi_versioncall_sidcall_sid_legacycoachingcoaching_call_sidcoaching_call_sid_legacyconference_siddate_createddate_updatedend_conference_on_exitholdmutedstatusuriPOST /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)account_sidapi_versioncall_sidcall_sid_legacycoachingcoaching_call_sidcoaching_call_sid_legacyconference_siddate_createddate_updatedend_conference_on_exitholdmutedstatusuriDELETE /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)
}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)endfirst_page_urinext_page_uripagepage_sizeparticipantsrecordingsstarturiGET /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)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiGET /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)endfirst_page_urinext_page_uripagepage_sizequeuesstarturiPOST /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)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriGET /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)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriPOST /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)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriDELETE /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)
}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)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiGET /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)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codemedia_urlsidsourcestart_timestatussubresources_urisuriDELETE /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)
}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)endfirst_page_urinext_page_uripagepage_sizeprevious_page_uristarttranscriptionsuriGET /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)account_sidapi_versioncall_siddate_createddate_updateddurationrecording_sidsidstatustranscription_texturiDELETE /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)
}POST /texml/secretsnamevalue 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)namevalueGET /texml_applications page, err := client.TexmlApplications.List(context.Background(), telnyx.TexmlApplicationListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_urlPOST /texml_applicationsfriendly_namevoice_urlactiveanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_method 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)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_urlGET /texml_applications/{id} texmlApplication, err := client.TexmlApplications.Get(context.Background(), "1293384261075731499")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_urlPATCH /texml_applications/{id}friendly_namevoice_urlactiveanchorsite_overridecall_cost_in_webhooksdtmf_typefirst_command_timeoutfirst_command_timeout_secsinboundoutboundstatus_callbackstatus_callback_methodtagsvoice_fallback_urlvoice_method 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)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_urlDELETE /texml_applications/{id} texmlApplication, err := client.TexmlApplications.Delete(context.Background(), "1293384261075731499")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", texmlApplication.Data)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_url