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/telnyx-ext-agent-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")),
)clientGET /texml_applications page, err := client.TexmlApplications.List(context.TODO(), telnyx.TexmlApplicationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /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.TODO(), telnyx.TexmlApplicationNewParams{
FriendlyName: "call-router",
VoiceURL: "https://example.com",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", texmlApplication.Data)GET /texml_applications/{id} texmlApplication, err := client.TexmlApplications.Get(context.TODO(), "1293384261075731499")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", texmlApplication.Data)PATCH /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.TODO(),
"1293384261075731499",
telnyx.TexmlApplicationUpdateParams{
FriendlyName: "call-router",
VoiceURL: "https://example.com",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", texmlApplication.Data)DELETE /texml_applications/{id} texmlApplication, err := client.TexmlApplications.Delete(context.TODO(), "1293384261075731499")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", texmlApplication.Data)GET /texml/Accounts/{account_sid}/Calls response, err := client.Texml.Accounts.Calls.GetCalls(
context.TODO(),
"account_sid",
telnyx.TexmlAccountCallGetCallsParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Calls)POST /texml/Accounts/{account_sid}/CallsToFromApplicationSidAsyncAmdAsyncAmdStatusCallbackAsyncAmdStatusCallbackMethodCallerIdCancelPlaybackOnDetectMessageEndCancelPlaybackOnMachineDetectionCustomHeadersDetectionModeFallbackUrlMachineDetectionMachineDetectionSilenceTimeoutMachineDetectionSpeechEndThresholdMachineDetectionSpeechThresholdMachineDetectionTimeoutPreferredCodecsRecordRecordingChannelsRecordingStatusCallbackRecordingStatusCallbackEventRecordingStatusCallbackMethodRecordingTimeoutRecordingTrackSendRecordingUrlSipAuthPasswordSipAuthUsernameSipRegionStatusCallbackStatusCallbackEventStatusCallbackMethodSuperviseCallSidSupervisingRoleTexmlTimeLimitTimeoutTrimUrlUrlMethod response, err := client.Texml.Accounts.Calls.Calls(
context.TODO(),
"account_sid",
telnyx.TexmlAccountCallCallsParams{
ApplicationSid: "example-app-sid",
From: "+13120001234",
To: "+13121230000",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.From)GET /texml/Accounts/{account_sid}/Calls/{call_sid} call, err := client.Texml.Accounts.Calls.Get(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallGetParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", call.AccountSid)POST /texml/Accounts/{account_sid}/Calls/{call_sid} call, err := client.Texml.Accounts.Calls.Update(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallUpdateParams{
AccountSid: "account_sid",
UpdateCall: telnyx.UpdateCallParam{},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", call.AccountSid)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants response, err := client.Texml.Accounts.Conferences.Participants.GetParticipants(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceParticipantGetParticipantsParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants response, err := client.Texml.Accounts.Conferences.Participants.Participants(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceParticipantParticipantsParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label} participant, err := client.Texml.Accounts.Conferences.Participants.Get(
context.TODO(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantGetParams{
AccountSid: "account_sid",
ConferenceSid: "conference_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", participant.AccountSid)POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label} participant, err := client.Texml.Accounts.Conferences.Participants.Update(
context.TODO(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantUpdateParams{
AccountSid: "account_sid",
ConferenceSid: "conference_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", participant.AccountSid)DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label} err := client.Texml.Accounts.Conferences.Participants.Delete(
context.TODO(),
"call_sid_or_participant_label",
telnyx.TexmlAccountConferenceParticipantDeleteParams{
AccountSid: "account_sid",
ConferenceSid: "conference_sid",
},
)
if err != nil {
panic(err.Error())
}GET /texml/Accounts/{account_sid}/Conferences response, err := client.Texml.Accounts.Conferences.GetConferences(
context.TODO(),
"account_sid",
telnyx.TexmlAccountConferenceGetConferencesParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Conferences)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid} conference, err := client.Texml.Accounts.Conferences.Get(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceGetParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", conference.AccountSid)POST /texml/Accounts/{account_sid}/Conferences/{conference_sid} conference, err := client.Texml.Accounts.Conferences.Update(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceUpdateParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", conference.AccountSid)GET /texml/Accounts/{account_sid}/Queues page, err := client.Texml.Accounts.Queues.List(
context.TODO(),
"account_sid",
telnyx.TexmlAccountQueueListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /texml/Accounts/{account_sid}/Queues queue, err := client.Texml.Accounts.Queues.New(
context.TODO(),
"account_sid",
telnyx.TexmlAccountQueueNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", queue.AccountSid)GET /texml/Accounts/{account_sid}/Queues/{queue_sid} queue, err := client.Texml.Accounts.Queues.Get(
context.TODO(),
"queue_sid",
telnyx.TexmlAccountQueueGetParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", queue.AccountSid)POST /texml/Accounts/{account_sid}/Queues/{queue_sid} queue, err := client.Texml.Accounts.Queues.Update(
context.TODO(),
"queue_sid",
telnyx.TexmlAccountQueueUpdateParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", queue.AccountSid)DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid} err := client.Texml.Accounts.Queues.Delete(
context.TODO(),
"queue_sid",
telnyx.TexmlAccountQueueDeleteParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}GET /texml/Accounts/{account_sid}/Recordings.json response, err := client.Texml.Accounts.GetRecordingsJson(
context.TODO(),
"account_sid",
telnyx.TexmlAccountGetRecordingsJsonParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json texmlGetCallRecordingResponseBody, err := client.Texml.Accounts.Recordings.Json.GetRecordingSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountRecordingJsonGetRecordingSidJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", texmlGetCallRecordingResponseBody.AccountSid)DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json err := client.Texml.Accounts.Recordings.Json.DeleteRecordingSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountRecordingJsonDeleteRecordingSidJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json response, err := client.Texml.Accounts.Calls.RecordingsJson.GetRecordingsJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallRecordingsJsonGetRecordingsJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json response, err := client.Texml.Accounts.Calls.RecordingsJson.RecordingsJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallRecordingsJsonRecordingsJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json response, err := client.Texml.Accounts.Calls.Recordings.RecordingSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountCallRecordingRecordingSidJsonParams{
AccountSid: "account_sid",
CallSid: "call_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings response, err := client.Texml.Accounts.Conferences.GetRecordings(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceGetRecordingsParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json response, err := client.Texml.Accounts.Conferences.GetRecordingsJson(
context.TODO(),
"conference_sid",
telnyx.TexmlAccountConferenceGetRecordingsJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)POST /texml/secretsnamevalue response, err := client.Texml.Secrets(context.TODO(), telnyx.TexmlSecretsParams{
Name: "My Secret Name",
Value: "My Secret Value",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json response, err := client.Texml.Accounts.Calls.SiprecJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallSiprecJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json response, err := client.Texml.Accounts.Calls.Siprec.SiprecSidJson(
context.TODO(),
"siprec_sid",
telnyx.TexmlAccountCallSiprecSiprecSidJsonParams{
AccountSid: "account_sid",
CallSid: "call_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json response, err := client.Texml.Accounts.Calls.StreamsJson(
context.TODO(),
"call_sid",
telnyx.TexmlAccountCallStreamsJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json response, err := client.Texml.Accounts.Calls.Streams.StreamingSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountCallStreamStreamingSidJsonParams{
AccountSid: "account_sid",
CallSid: "call_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)GET /texml/Accounts/{account_sid}/Transcriptions.json response, err := client.Texml.Accounts.GetTranscriptionsJson(
context.TODO(),
"account_sid",
telnyx.TexmlAccountGetTranscriptionsJsonParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.End)GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json response, err := client.Texml.Accounts.Transcriptions.Json.GetRecordingTranscriptionSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountTranscriptionJsonGetRecordingTranscriptionSidJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AccountSid)DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json err := client.Texml.Accounts.Transcriptions.Json.DeleteRecordingTranscriptionSidJson(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.TexmlAccountTranscriptionJsonDeleteRecordingTranscriptionSidJsonParams{
AccountSid: "account_sid",
},
)
if err != nil {
panic(err.Error())
}telnyx-timestamptelnyx-signature-ed25519| Event | Description |
|---|---|
| TeXML Call Answered. Webhook sent when a TeXML call is answered |
| TeXML Call Completed. Webhook sent when a TeXML call is completed |
| TeXML Call Initiated. Webhook sent when a TeXML call is initiated |
| TeXML Call Ringing. Webhook sent when a TeXML call is ringing |
| TeXML Call AMD. Webhook sent when Answering Machine Detection (AMD) completes during a TeXML call |
| TeXML Call DTMF. Webhook sent when a DTMF digit is received during a TeXML call |
| TeXML Gather. Webhook sent when a Gather command completes (sent to the action URL) |
| TeXML HTTP Request. Webhook sent as response to an HTTP Request instruction |
| TeXML AI Gather. Webhook sent when AI Gather completes with transcription results |
| TeXML Refer Status. Webhook sent for SIP REFER status updates |
| TeXML Conference Join. Webhook sent when a participant joins a TeXML conference |
| TeXML Conference Leave. Webhook sent when a participant leaves a TeXML conference |
| TeXML Conference Speaker. Webhook sent when a participant starts or stops speaking in a TeXML conference |
| TeXML Conference End. Webhook sent when a TeXML conference ends |
| TeXML Conference Start. Webhook sent when a TeXML conference starts |
| TeXML Queue. Webhook sent for queue status events (triggered by Enqueue command waitUrl) |
| TeXML Recording Completed. Webhook sent when a recording is completed during a TeXML call (triggered by recordingStatusCallbackEvent) |
| TeXML Recording In-Progress. Webhook sent when a recording starts during a TeXML call (triggered by recordingStatusCallbackEvent) |
| TeXML SIPREC. Webhook sent for SIPREC session status updates |
| TeXML Stream. Webhook sent for media streaming status updates |
| TeXML Transcription. Webhook sent when a recording transcription is completed |