Loading...
Loading...
Build voice applications using TeXML markup language (TwiML-compatible). Manage applications, calls, conferences, recordings, queues, and streams. This skill provides Ruby SDK examples.
npx skill4agent add team-telnyx/skills telnyx-texml-rubygem install telnyxrequire "telnyx"
client = Telnyx::Client.new(
api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)clientbegin
result = client.messages.send_(to: "+13125550001", from: "+13125550002", text: "Hello")
rescue Telnyx::Errors::APIConnectionError
puts "Network error — check connectivity and retry"
rescue Telnyx::Errors::RateLimitError
# 429: rate limited — wait and retry with exponential backoff
sleep(1) # Check Retry-After header for actual delay
rescue Telnyx::Errors::APIStatusError => e
puts "API error #{e.status}: #{e.message}"
if e.status == 422
puts "Validation error — check required fields and formats"
end
end401403404422429.auto_paging_eachpage.auto_paging_each { |item| puts item.id }GET /texml/Accounts/{account_sid}/Callsresponse = client.texml.accounts.calls.retrieve_calls("account_sid")
puts(response)callsendfirst_page_urinext_page_uripagepage_sizestarturiPOST /texml/Accounts/{account_sid}/CallsToFromApplicationSidAsyncAmdAsyncAmdStatusCallbackAsyncAmdStatusCallbackMethodCallerIdCancelPlaybackOnDetectMessageEndCancelPlaybackOnMachineDetectionCustomHeadersDetectionModeFallbackUrlMachineDetectionMachineDetectionSilenceTimeoutMachineDetectionSpeechEndThresholdMachineDetectionSpeechThresholdMachineDetectionTimeoutPreferredCodecsRecordRecordingChannelsRecordingStatusCallbackRecordingStatusCallbackEventRecordingStatusCallbackMethodRecordingTimeoutRecordingTrackSendRecordingUrlSipAuthPasswordSipAuthUsernameSipRegionStatusCallbackStatusCallbackEventStatusCallbackMethodSuperviseCallSidSupervisingRoleTexmlTimeLimitTimeoutTrimUrlUrlMethodresponse = client.texml.accounts.calls.calls(
"account_sid",
application_sid: "example-app-sid",
from: "+13120001234",
to: "+13121230000"
)
puts(response)fromstatustoGET /texml/Accounts/{account_sid}/Calls/{call_sid}call = client.texml.accounts.calls.retrieve("call_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(call)account_sidanswered_bycaller_namedate_createddate_updateddirectiondurationend_timefromfrom_formattedpriceprice_unitsidstart_timestatustoto_formatteduriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}call = client.texml.accounts.calls.update("call_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(call)account_sidanswered_bycaller_namedate_createddate_updateddirectiondurationend_timefromfrom_formattedpriceprice_unitsidstart_timestatustoto_formatteduriGET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.jsonresponse = client.texml.accounts.calls.recordings_json.retrieve_recordings_json(
"call_sid",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.jsonresponse = client.texml.accounts.calls.recordings_json.recordings_json("call_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codepriceprice_unitsidsourcestart_timetrackuriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.jsonresponse = client.texml.accounts.calls.recordings.recording_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
call_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codepriceprice_unitsidsourcestart_timetrackuriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.jsonresponse = client.texml.accounts.calls.siprec_json("call_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)account_sidcall_siddate_createddate_updatederror_codesidstart_timestatustrackuriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.jsonresponse = client.texml.accounts.calls.siprec.siprec_sid_json(
"siprec_sid",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
call_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)account_sidcall_siddate_updatederror_codesidstatusuriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.jsonresponse = client.texml.accounts.calls.streams_json("call_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)account_sidcall_siddate_updatednamesidstatusuriPOST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.jsonresponse = client.texml.accounts.calls.streams.streaming_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
call_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)account_sidcall_siddate_updatedsidstatusuriGET /texml/Accounts/{account_sid}/Conferencesresponse = client.texml.accounts.conferences.retrieve_conferences("account_sid")
puts(response)conferencesendfirst_page_urinext_page_uripagepage_sizestarturiGET /texml/Accounts/{account_sid}/Conferences/{conference_sid}conference = client.texml.accounts.conferences.retrieve("conference_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(conference)account_sidapi_versioncall_sid_ending_conferencedate_createddate_updatedfriendly_namereason_conference_endedregionsidstatussubresource_urisuriPOST /texml/Accounts/{account_sid}/Conferences/{conference_sid}conference = client.texml.accounts.conferences.update("conference_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(conference)account_sidapi_versioncall_sid_ending_conferencedate_createddate_updatedfriendly_namereason_conference_endedregionsidstatussubresource_urisuriGET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participantsresponse = client.texml.accounts.conferences.participants.retrieve_participants(
"conference_sid",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)endfirst_page_urinext_page_uripagepage_sizeparticipantsstarturiPOST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participantsresponse = client.texml.accounts.conferences.participants.participants("conference_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)account_sidcall_sidcoachingcoaching_call_sidconference_sidend_conference_on_exitholdmutedstatusuriGET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}participant = client.texml.accounts.conferences.participants.retrieve(
"call_sid_or_participant_label",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
conference_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(participant)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 = client.texml.accounts.conferences.participants.update(
"call_sid_or_participant_label",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
conference_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(participant)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}result = client.texml.accounts.conferences.participants.delete(
"call_sid_or_participant_label",
account_sid: "550e8400-e29b-41d4-a716-446655440000",
conference_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(result)GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordingsresponse = client.texml.accounts.conferences.retrieve_recordings("conference_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)endfirst_page_urinext_page_uripagepage_sizeparticipantsrecordingsstarturiGET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.jsonresponse = client.texml.accounts.conferences.retrieve_recordings_json("conference_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(response)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiGET /texml/Accounts/{account_sid}/Queuespage = client.texml.accounts.queues.list("account_sid")
puts(page)endfirst_page_urinext_page_uripagepage_sizequeuesstarturiPOST /texml/Accounts/{account_sid}/Queuesqueue = client.texml.accounts.queues.create("account_sid")
puts(queue)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriGET /texml/Accounts/{account_sid}/Queues/{queue_sid}queue = client.texml.accounts.queues.retrieve("queue_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(queue)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriPOST /texml/Accounts/{account_sid}/Queues/{queue_sid}queue = client.texml.accounts.queues.update("queue_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(queue)account_sidaverage_wait_timecurrent_sizedate_createddate_updatedmax_sizesidsubresource_urisuriDELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}result = client.texml.accounts.queues.delete("queue_sid", account_sid: "550e8400-e29b-41d4-a716-446655440000")
puts(result)GET /texml/Accounts/{account_sid}/Recordings.jsonresponse = client.texml.accounts.retrieve_recordings_json("account_sid")
puts(response)endfirst_page_urinext_page_uripagepage_sizeprevious_page_urirecordingsstarturiGET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.jsontexml_get_call_recording_response_body = client.texml.accounts.recordings.json.retrieve_recording_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(texml_get_call_recording_response_body)account_sidcall_sidchannelsconference_siddate_createddate_updateddurationerror_codemedia_urlsidsourcestart_timestatussubresources_urisuriDELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.jsonresult = client.texml.accounts.recordings.json.delete_recording_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(result)GET /texml/Accounts/{account_sid}/Transcriptions.jsonresponse = client.texml.accounts.retrieve_transcriptions_json("account_sid")
puts(response)endfirst_page_urinext_page_uripagepage_sizeprevious_page_uristarttranscriptionsuriGET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.jsonresponse = client.texml.accounts.transcriptions.json.retrieve_recording_transcription_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(response)account_sidapi_versioncall_siddate_createddate_updateddurationrecording_sidsidstatustranscription_texturiDELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.jsonresult = client.texml.accounts.transcriptions.json.delete_recording_transcription_sid_json(
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
account_sid: "550e8400-e29b-41d4-a716-446655440000"
)
puts(result)POST /texml/secretsnamevalueresponse = client.texml.secrets(name: "My Secret Name", value: "My Secret Value")
puts(response)namevalueGET /texml_applicationspage = client.texml_applications.list
puts(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_methodtexml_application = client.texml_applications.create(friendly_name: "call-router", voice_url: "https://example.com")
puts(texml_application)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}texml_application = client.texml_applications.retrieve("1293384261075731499")
puts(texml_application)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_methodtexml_application = client.texml_applications.update(
"1293384261075731499",
friendly_name: "call-router",
voice_url: "https://example.com"
)
puts(texml_application)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}texml_application = client.texml_applications.delete("1293384261075731499")
puts(texml_application)activeanchorsite_overridecall_cost_in_webhookscreated_atdtmf_typefirst_command_timeoutfirst_command_timeout_secsfriendly_nameidinboundoutboundrecord_typestatus_callbackstatus_callback_methodtagsupdated_atvoice_fallback_urlvoice_methodvoice_url