Phone Verify API

Quick Start: Ruby

There are three steps to integrating the Phone Verify API into your Ruby project.

1. Create an account.

Sign up for an Esendex account. When you register you will receive a license key. You will need this to use the API.

2. Install Ruby.

Install Ruby if it is not on your computer already. To check, run this command in your terminal: ruby --version

PS C:\> ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

3. Verify a phone number.

Install Savon, a SOAP client for Ruby. Run this command in your terminal: gem install savon

Create a new Ruby file. Let’s call it demo.rb.

You can use the CheckPhoneNumber method to verify a phone number. Add the displayed code to your new file.

Replace the LicenseKey value with your account’s license key.

require 'pp'
require 'savon'

client = Savon.client(wsdl: 'https://ws.esendex.us/phoneverify/phoneverify.asmx?wsdl')
phone_number = '17575449510'
license_key = '00000000-0000-0000-0000-000000000000'

response = client.call(
  :check_phone_number,
  message: {
    'PhoneNumber' => phone_number,
    'LicenseKey' => license_key
  }
)

pp response.body

Run the project in your terminal with this command: ruby demo.rb. The program will display the results of the phone number verification.

PS C:\RubyDemo> ruby demo.rb
{:check_phone_number_response=>
  {:check_phone_number_result=>
    {:company=>"LEVEL 3 COMMUNICATIONS, LLC - ",
     :valid=>true,
     :use=>"Assigned to a code holder for normal use.",
     :state=>"VA",
     :rc=>"PARKSLEY",
     :ocn=>"8825",
     :original_number=>"17575449510",
     :clean_number=>"7575449510",
     :switch_name=>"NORFOLK",
     :switch_type=>nil,
     :country=>"United States",
     :clli=>"CHSKVAAYDS0",
     :prefix_type=>"CLEC - (Competitive Local Exchange Carrier)",
     :lata=>"252",
     :sms=>"CLEC - (Competitive Local Exchange Carrier)",
     :email=>nil,
     :assign_date=>"Unknown",
     :telecom_city=>"Chesapeake",
     :telecom_county=>nil,
     :telecom_state=>"VA",
     :telecom_zip=>"23324",
     :time_zone=>"EST",
     :lat=>nil,
     :long=>nil,
     :wireless=>false,
     :lrn=>"7576559199"},
   :@xmlns=>"http://ws.cdyne.com/PhoneVerify/query"}}

Let’s start sending, together.