Loading...
Loading...
Manage sub-accounts for reseller and enterprise scenarios. This skill provides Ruby SDK examples.
npx skill4agent add team-telnyx/skills telnyx-account-management-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 /managed_accountspage = client.managed_accounts.list
puts(page)api_usercreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atPOST /managed_accountsbusiness_nameemailmanaged_account_allow_custom_pricingpasswordrollup_billingmanaged_account = client.managed_accounts.create(business_name: "Larry's Cat Food Inc")
puts(managed_account)api_keyapi_tokenapi_userbalancecreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atGET /managed_accounts/allocatable_global_outbound_channelsresponse = client.managed_accounts.get_allocatable_global_outbound_channels
puts(response)allocatable_global_outbound_channelsmanaged_account_allow_custom_pricingrecord_typetotal_global_channels_allocatedGET /managed_accounts/{id}managed_account = client.managed_accounts.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(managed_account)api_keyapi_tokenapi_userbalancecreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atPATCH /managed_accounts/{id}managed_account_allow_custom_pricingmanaged_account = client.managed_accounts.update("550e8400-e29b-41d4-a716-446655440000")
puts(managed_account)api_keyapi_tokenapi_userbalancecreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atPOST /managed_accounts/{id}/actions/disableresponse = client.managed_accounts.actions.disable("550e8400-e29b-41d4-a716-446655440000")
puts(response)api_keyapi_tokenapi_userbalancecreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atPOST /managed_accounts/{id}/actions/enablereenable_all_connectionsresponse = client.managed_accounts.actions.enable("550e8400-e29b-41d4-a716-446655440000")
puts(response)api_keyapi_tokenapi_userbalancecreated_atemailidmanaged_account_allow_custom_pricingmanager_account_idorganization_namerecord_typerollup_billingupdated_atPATCH /managed_accounts/{id}/update_global_channel_limitchannel_limitresponse = client.managed_accounts.update_global_channel_limit("550e8400-e29b-41d4-a716-446655440000")
puts(response)channel_limitemailidmanager_account_idrecord_typeGET /organizations/userspage = client.organizations.users.list
puts(page)created_atemailgroupsidlast_sign_in_atorganization_user_bypasses_ssorecord_typeuser_statusGET /organizations/users/users_groups_reportresponse = client.organizations.users.get_groups_report
puts(response)created_atemailgroupsidlast_sign_in_atorganization_user_bypasses_ssorecord_typeuser_statusGET /organizations/users/{id}user = client.organizations.users.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(user)created_atemailgroupsidlast_sign_in_atorganization_user_bypasses_ssorecord_typeuser_statusPOST /organizations/users/{id}/actions/removeaction = client.organizations.users.actions.remove("550e8400-e29b-41d4-a716-446655440000")
puts(action)created_atemailgroupsidlast_sign_in_atorganization_user_bypasses_ssorecord_typeuser_status