Loading...
Loading...
Configure phone number settings including caller ID, call forwarding, messaging enablement, and connection assignments. This skill provides Ruby SDK examples.
npx skill4agent add team-telnyx/skills telnyx-numbers-config-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+13125550001+.auto_paging_eachpage.auto_paging_each { |item| puts item.id }POST /messaging_numbers_bulk_updatesmessaging_profile_idnumbersassign_onlymessaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.create(
messaging_profile_id: "00000000-0000-0000-0000-000000000000",
numbers: ["+18880000000", "+18880000001", "+18880000002"]
)
puts(messaging_numbers_bulk_update)failedorder_idpendingrecord_typesuccessGET /messaging_numbers_bulk_updates/{order_id}messaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.retrieve("order_id")
puts(messaging_numbers_bulk_update)failedorder_idpendingrecord_typesuccessGET /mobile_phone_numbers/messagingpage = client.mobile_phone_numbers.messaging.list
puts(page)country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /mobile_phone_numbers/{id}/messagingmessaging = client.mobile_phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /phone_numberspage = client.phone_numbers.list
puts(page)billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atPOST /phone_numbers/actions/verify_ownershipphone_numbersresponse = client.phone_numbers.actions.verify_ownership(phone_numbers: ["+15551234567"])
puts(response)foundnot_foundrecord_typeGET /phone_numbers/jobspage = client.phone_numbers.jobs.list
puts(page)created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atPOST /phone_numbers/jobs/delete_phone_numbersphone_numbersresponse = client.phone_numbers.jobs.delete_batch(phone_numbers: ["+19705555098", "+19715555098", "32873127836"])
puts(response)created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atPOST /phone_numbers/jobs/update_emergency_settingsemergency_enabledphone_numbersemergency_address_idresponse = client.phone_numbers.jobs.update_emergency_settings_batch(
emergency_enabled: true,
phone_numbers: ["+19705555098", "+19715555098", "32873127836"]
)
puts(response)created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atPOST /phone_numbers/jobs/update_phone_numbersphone_numbersbilling_group_idconnection_idcustomer_referencedeletion_lock_enabledexternal_pinhd_voice_enabledtagsvoiceresponse = client.phone_numbers.jobs.update_batch(phone_numbers: ["1583466971586889004", "+13127367254"])
puts(response)created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atGET /phone_numbers/jobs/{id}job = client.phone_numbers.jobs.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(job)created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atGET /phone_numbers/messagingpage = client.phone_numbers.messaging.list
puts(page)country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /phone_numbers/slimpage = client.phone_numbers.slim_list
puts(page)billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idcountry_iso_alpha2created_atcustomer_referenceemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningphone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledupdated_atGET /phone_numbers/voicepage = client.phone_numbers.voice.list
puts(page)call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodGET /phone_numbers/{id}phone_number = client.phone_numbers.retrieve("1293384261075731499")
puts(phone_number)billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atPATCH /phone_numbers/{id}address_idbilling_group_idconnection_idcustomer_referenceexternal_pinhd_voice_enabledidtagsphone_number = client.phone_numbers.update("1293384261075731499")
puts(phone_number)billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atDELETE /phone_numbers/{id}phone_number = client.phone_numbers.delete("1293384261075731499")
puts(phone_number)billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecreated_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledexternal_pinhd_voice_enabledidmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledtagsupdated_atPATCH /phone_numbers/{id}/actions/bundle_status_changebundle_idresponse = client.phone_numbers.actions.change_bundle_status(
"1293384261075731499",
bundle_id: "5194d8fc-87e6-4188-baa9-1c434bbe861b"
)
puts(response)call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodPOST /phone_numbers/{id}/actions/enable_emergencyemergency_enabledemergency_address_idresponse = client.phone_numbers.actions.enable_emergency(
"1293384261075731499",
emergency_address_id: "53829456729313",
emergency_enabled: true
)
puts(response)call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodGET /phone_numbers/{id}/messagingmessaging = client.phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atPATCH /phone_numbers/{id}/messagingmessaging_productmessaging_profile_idtagsmessaging = client.phone_numbers.messaging.update("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /phone_numbers/{id}/voicevoice = client.phone_numbers.voice.retrieve("1293384261075731499")
puts(voice)call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodPATCH /phone_numbers/{id}/voicecall_forwardingcall_recordingcaller_id_name_enabledcnam_listinginbound_call_screeningmedia_featurestech_prefix_enabledtranslated_numberusage_payment_methodvoice = client.phone_numbers.voice.update("1293384261075731499")
puts(voice)call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodGET /v2/mobile_phone_numberspage = client.mobile_phone_numbers.list
puts(page)call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atGET /v2/mobile_phone_numbers/{id}mobile_phone_number = client.mobile_phone_numbers.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atPATCH /v2/mobile_phone_numbers/{id}call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idcustomer_referenceinboundinbound_call_screeningnoise_suppressionoutboundtagsmobile_phone_number = client.mobile_phone_numbers.update("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_at