How can I view a list of my Twilio phone numbers using the Twilio API?
1 answer
Twilio developer evangelist is here.
If you want to list the phone numbers you have in your Twilio account through the API, you need a list of inbound numbers resources .
You can easily access Twilio rubygem like this:
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
+4
source to share