Megan from Twilio.
I would be interested to know if you have ever tried on your own. But I wanted to point out to others in a similar situation, how you could capture a blacklist error, and then do whatever you might need.
In Ruby, it will look something like this:
require 'rubygems' require 'twilio-ruby' account_sid = 'YOUR_ACCOUNT_SID' auth_token = 'YOUR_AUTH_TOKEN' @client = Twilio::REST::Client.new account_sid, auth_token begin @message = @client.messages.create( from: 'TWILIO_NUMBER', to: 'USER_NUMBER', body: 'Howdy!' ) rescue Twilio::REST::RequestError => e if e.code == 21610
We check for a blacklist using the code '21610'. Additional error information can be found on the help page .
Hope this helps!
source share