Skip to main content

Phone Verification Widget integration guide

The widget is a quick and easy way to add phone verification without building your own integration. Listed below is the primary code snippet to integrate the Phone Verification Widget into your website or form.

Customise to your needs - configuration options and available metadata.

Steps to integrate

Make sure you have access to the website or the form you want to add the widget to. Then follow the steps below:

  1. Copy and paste the javascript code snippet (below) into the HTML of your webpage. Ideally this should be inserted immediately before the closing </body> tag.
  2. Within the code snippet replace the phoneSelector value with the ID of the field on which you collect phone numbers (e.g. #phone_number). Alternatively, you could use a CSS selector such as input [type=email] inplace of the email field ID.
  3. Replace the licenceKey value with your Addressfinder account key. Found under Credentials in the Addressfinder Portal.
  4. Set the default country code using the ISO alpha-2 standard. Eg. US
  5. Add the code snippet to your website - it should immediately start working.
  6. Add the URL of your website (eg, https://website.com) to the domains page in the Addressfinder Portal.
  7. Test the widget by entering different phone numbers to the phone field. Check the results and adjust the rules if needed.

If you don't have an Addressfinder account, sign up for a free tiral.


<script>
(function (d) {

var conf = {
phoneSelector: "#id_of_your_phone_number_field",
licenceKey: "your_addressfinder_licence_key",
defaultCountryCode: "AU",
// allowedCountryCodes: "AU, US, GB, CA, NZ",
// countrySelect: "#id_of_your_country_select_field",
// timeout: "10",

rules: {
unverified: {
rule: "block",
message: "Phone number not verified."
},
nonMobile: {
rule: "allow"
},
countryNotAllowed: {
rule: "block",
message: "Allowed countries: {LIST}"
}
}
};

d.addEventListener("DOMContentLoaded", function () {if (d.querySelector(conf.phoneSelector)) {var e=d.createElement("script");e.src="https://api.addressfinder.io/assets/phone/v2/widget.js",e.async =!0,e.onload=function(){new AddressfinderPhone.Phone.Widget(conf.phoneSelector,conf.licenceKey,conf)},d.body.appendChild(e)}});
})(document);
</script>

Phone Verification Integration methods:

  1. Phone Verification Widget - ideal for interactive phone checking on customer facing websites, forms & CRMs
  2. Phone Verification API - advanced integration for direct calls from a server or application
  3. Bulk Phone Verification - verify large volumes of phone numbers - contact support