TwilioLookup Data Connector

The TwilioLookup Data Connector allows you to lookup phone numbers using the Twilio Lookup API.

Constructor

TwilioLookup(sid, authToken) → {object}

The Twilio Lookup Data Connector extends the functionality of the Twilio Data Connector.

We recommend that you create a Data Connector Configuration called "Twilio" via the Verj.io Runtime Environment's Administration Application.

A TwilioLookup Data Connector is then available at connectors.verjio.twilio.lookup using that configuration.

If you are unable to do that, you may use this constructor to create a new TwilioLookup Data Connector.

This method accepts an Account SID and an Auth Token.

Parameters:
Name Type Description
sid string

Twilio Account SID.

authToken string

Auth Token used to authenticate API requests.

Returns:
object

The TwilioLookup Data Connector.

Functions

handleError(response)

Checks an API response for errors. If an error is encountered, the appropriate Error is thrown.

Parameters:
Name Type Description
response object

The response from a services.rest request.

Throws:
  • HttpAuthorisationError

    Thrown when an incorrect SID or token are used.

  • HttpNotFoundError

    Thrown when the requested resource is not available.

  • HttpRequestError

    Thrown when a request is malformed or required parameters are not supplied. See the error message for more details.

  • HttpUnknownError

    Thrown when an unhandled error is encountered.

phone(phone, packagesopt) → (nullable) {object}

Retrieve information about a phone number.

Parameters:
Name Type Attributes Description
phone string  

A phone number in E.164 format.

packages string | Array.<string> <optional>

One or more additional data packages to include in response.

See:
Returns:
object

Details about the phone number. Returns null if one or more parameters are invalid.

Example:
var response = connectors.verjio.twilio.lookup.phone(fields.phone.value);

if (!response.valid) {
	event.owner.addErrorMessage('The phone number that you entered is not valid.');
}