Created
February 3, 2016 01:40
-
-
Save acamino/4db7e7c9ab02716808f1 to your computer and use it in GitHub Desktop.
Releasing Twilio Numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The numbers will be pulled in groups of 50, so if you | |
# have more than 50 numbers then you'll have to run this | |
# script more than once. | |
require 'twilio-ruby' | |
# Get your Account Sid and Auth Token from twilio.com/user/account | |
account_sid = ENV['TWILIO_ACCOUNT_SID'] | |
auth_token = ENV['TWILIO_AUTH_TOKEN'] | |
client = Twilio::REST::Client.new(account_sid, auth_token) | |
# A delightful explanation can be found here: | |
# https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list-post | |
client.account.incoming_phone_numbers.list.each do |number| | |
# Tracking which numbers will be released | |
p number.phone_number | |
# Release your twilio number | |
number.delete | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment