I have a twilio account for sending SMS. However, i need guidance on how to see a list of my account phone numbers by calling its API. I have tried to navigate through the different menus in API but i dont see any option to get list of my account phone numbers. Thank you in advance for your guidance.
Twilio developer evangelist here.
If you want to list the phone numbers you have in your Twilio account through the API you need the Incoming Phone Numbers list resource.
You can access this easily with the Twilio rubygem like so:
require 'twilio-ruby'
@client = Twilio::REST::Client.new YOUR_ACCOUNT_SID, YOUR_AUTH_TOKEN
numbers = @client.account.incoming_phone_numbers.list
numbers.each do |number|
# do something with the number
puts number.phone_number
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With