Skip to contentSkip to navigationSkip to topbar
On this page

Toll-Free Verification Compliance Embeddable Onboarding Guide


(information)

Info

In addition to Toll-Free Verification, the Compliance Embeddable can also help ISVs onboard their customers to Regulatory Compliance Bundles, Branded Calling, SHAKEN/STIR, and CNAM. For these programs, the Compliance Embeddable is available as a Pilot product. If you'd like to participate in our Pilot, please submit your interest via this form.(link takes you to an external page)

Overview

overview page anchor

The Compliance Embeddable is a white-label embed offering designed to seamlessly integrate into an Independent Software Vendor's (ISV) existing portal or web application. The user interface is tailored specifically for the ISV tenant use case with a form containing all the necessary questions required by a verification or registration, allowing ISVs' end customers to submit their compliance information via self-service. Twilio manages the questions that are asked in the UI, but there is no Twilio branding on the Compliance Embeddable. The UI can be customized by the Twilio team to align with your design standards, including color palette and typeface.

After reading this document, you will be able to integrate the Compliance Embeddable into your web application to allow self-service Toll-Free Verification for your end customers.

Twilio Compliance Embeddable UI embedded in ISV's website for Toll-Free Verification.

The Compliance Embeddable requires two integrations:

  1. Server-side integration to invoke the Twilio Initialize ComplianceInquiry APIs to initialize the ComplianceInquiry and get back a session token and inquiry ID.
  2. Client-side integration to embed the ComplianceInquiry UI in your existing web application using an iframe, utilizing the returned session token and inquiry ID.

This onboarding guide provides a step-by-step walkthrough on how to integrate the Compliance Embeddable into an ISV's web application, allowing self-service Toll-Free Verification for your end customers.

If you have questions about this product, check out the Compliance Embeddable FAQ(link takes you to an external page) or contact us at via the Twilio Help Center.(link takes you to an external page)


The Compliance Embeddable's data collection process is secured via server-side authentication and is triggered by a server-side API call. This API call initializes a ComplianceInquiry and returns a token, which you can then pass to your web client to authenticate into a submission flow.

Initialize ComplianceInquiry API for Toll-Free Verification

initialize-complianceinquiry-api-for-toll-free-verification page anchor

To initialize a ComplianceInquiry for a Toll-Free Verification, make an HTTPS request to the following API:

POST https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize

This call must be authenticated using Twilio's REST API credentials(link takes you to an external page) where the account SID is either your primary Twilio Account SID or a subaccount SID. All of the parameters except for TollfreePhoneNumber and NotificationEmail are optional. If this data is provided, it will automatically appear pre-filled in the subsequent forms in the user's UI.

(information)

Info

The Account SID given in the credentials is the Account that the Toll-Free Verification will be associated with after completion of the ComplianceInquiry.

The body of the request will require the following x-www-form-urlencoded parameters:

Request Parameters

request-parameters page anchor
ParameterField TypeDescription
TollfreePhoneNumber [required]StringThe Toll-Free number, in E.164 format, for which the verification request needs to be submitted.
NotificationEmail [required]StringThe email ID to which all notifications for the status of Toll-Free Verification will be sent.
ThemeSetId [optional]StringTheme ID for the UI. Relevant for customers who've requested customized font/color. To request a customized Theme, please follow the instructions in our FAQ(link takes you to an external page).
BusinessName [optional]StringThe name of the business or organization using the Toll-Free phone number.
BusinessStreetAddress [optional]StringThe address of the business or organization using the Toll-Free phone number.
BusinessStreetAddress2 [optional]StringThe second row of the street address of the business or organization using the Toll-Free phone number.
BusinessCity [optional]StringThe city of the business or organization using the Toll-Free phone number.
BusinessStateProvinceRegion [optional]StringThe state/province or region of the business or organization using the Toll-Free phone number.
BusinessPostalCode [optional]StringThe postal code of the business or organization using the Toll-Free phone number.
BusinessCountry [optional]StringThe ISO country code of the business or organization using the Toll-Free phone number.
BusinessWebsite [optional]StringThe website of the business or organization using the Toll-Free phone number.
BusinessContactFirstName [optional]StringThe first name of the contact for the business or organization using the Toll-Free phone number.
BusinessContactLastName [optional]StringThe last name of the contact for the business or organization using the Toll-Free phone number.
BusinessContactEmail [optional]StringThe email address of the contact for the business or organization using the Toll-Free phone number.
BusinessContactPhone [optional]StringThe phone number of the contact for the business or organization using the Toll-Free phone number.
UseCaseCategories [optional]Array (String)Choose the use case that you believe best fits your customer's traffic pattern. This should be the use case that best fits the types of messages being sent by this Toll-Free phone number.
UseCaseSummary [optional]StringThe explanation on how messaging is used by the business or organization.
ProductionMessageSample [optional]StringAn example of the message content, e.g., "This is Chris, I'm here with your order. Reply STOP to opt out."
OptInImageUrls [optional]Array (String)Link to an image or document that shows the opt-in workflow where your users sign up for your SMS campaign. Multiple URLs are allowed. Any URL submitted must be reachable, resolvable, and accessible to the public.
OptInType [optional]StringDescribes how a user opts in to text messages.
MessageVolume [optional]StringThe monthly volume estimation of messages from the Toll-Free number.
AdditionalInformation [optional]StringAdditional info to help with the verification.
SkipMessagingUseCase [optional]BooleanPlease send this as true if you wish to skip the messaging use case screen in the UI, which asks the user to provide "UseCaseCategories", "UseCaseSummary", "ProductionMessageSample", "OptInImageUrls", "OptInType", "MessageVolume". Please note, requests to hide will only be honored if "UseCaseCategories", "UseCaseSummary", "ProductionMessageSample", "OptInImageUrls", "OptInType", and "MessageVolume" are pre-populated.

Note: Data validations will be performed on these fields. Please refer to our Toll-Free Verification Guide(link takes you to an external page) for detailed validation rules. Additionally, you may sign up for status change notifications for Toll-Free Verification via Twilio Event Streams(link takes you to an external page).

Initialize ComplianceInquiry API for Toll-Free VerificationLink to code sample: Initialize ComplianceInquiry API for Toll-Free Verification
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createComplianceTollfreeInquiry() {
11
const complianceTollfreeInquiry =
12
await client.trusthub.v1.complianceTollfreeInquiries.create({
13
notificationEmail: "dean@twilio.com",
14
tollfreePhoneNumber: "+800445566",
15
});
16
17
console.log(complianceTollfreeInquiry.inquiryId);
18
}
19
20
createComplianceTollfreeInquiry();

Output

1
{
2
"inquiry_id": "inq_aaaaaaaaaaaaaaaaaaaaaaaa",
3
"inquiry_session_token": "new.session.token",
4
"registration_id": "tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.tollfree.PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"url": "https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize"
6
}

A successful request will return a JSON response body with the following attributes:

NameDescription
registration_idA reference for your Toll-free verification resource in Twilio.
inquiry_idA reference for your Toll-free verification Inquiry in Twilio. This value will be used to initialize the client component.
inquiry_session_tokenAn ephemeral session token for your Compliance Inquiry in Twilio. This value will be used to initialize the client component. Expires in 1440 minutes from creation.

API Error Responses and their meaning

ErrorError CodeError Message
PN not provided400Phone number is required.
Notification email not provided400Notification email is required.
PN entered doesn't belong to the ISV account400Phone number doesn't belong to this ISV account.
PN entered is not a Toll-free number400Phone number is not a Toll-free number.
Verification is not eligible for re-submission i.e. is already in progress or rejected with a non-resubmittable error.400Verification for Number is not eligible for re-submission.
Account is a trial account400Trial account: AccountSid cannot be used for this operation
PN status is not "in-use"400Phone number is not valid.
This is a generic error. A common reason for this error is when you've reached the session limit. Please note that for a single inquiry_id, there's a limit that you can generate max 50 inquiry_session_tokens.500Internal Server Error

After initializing a ComplianceInquiry, you may embed the ComplianceInquiry UI in your website using the TwilioComplianceEmbed React client.

Install the package in your React project using your preferred package manager.

NPM:

npm install @twilio/twilio-compliance-embed

Yarn:

yarn add @twilio/twilio-compliance-embed

The ComplianceInquiry UI can be embedded into your site with the following code snippet:

1
import * as React from "react";
2
import { TwilioComplianceEmbed } from "@twilio/twilio-compliance-embed";
3
4
const ComplianceInquiry = () => {
5
return (
6
<TwilioComplianceEmbed
7
inquiryId='<your inquiry id from calling the Initialize ComplianceInquiry API>'
8
inquirySessionToken='<your inquiry session token from calling the Initialize ComplianceInquiry API>'
9
/>
10
);
11
};

The ComplianceInquiry UI may take a few seconds to load and render.

NameTypeDescription
inquiryId(Required) StringA valid inquiryId returned by calling the Initialize ComplianceInquiry API
inquirySessionToken(Required) StringA valid inquirySessionToken returned by calling the Initialize ComplianceInquiry API
onInquirySubmitted() => voidAn event handler that fires when the user has completed the ComplianceInquiry process. This event is fired when the user lands on the last screen
onComplete() => voidAn event handler that fires when the user has completed the ComplianceInquiry process. This event is fired when the user clicks the **Done** or **Exit** button on the last page.

Please note that this event is not guaranteed to be fired as the user could choose not to click the button on the last page. If you wish to track when a user has finished the flow and submitted the bundle, please use onInquirySubmitted instead.

onCancel() => voidAn event handler that fires when the user has canceled the ComplianceInquiry process
onError() => voidAn event handler that fires when an unexpected error occurs during the ComplianceInquiry process
onReady() => voidAn event handler that fires when the ComplianceInquiry UI has finished loading
widgetPadding{ top?: number; bottom?: number; left?: number; right?: number; }Allows customizing the internal padding inside the iframe. If this is not passed it will use the default values {top: 74, left: 24, right: 24, bottom: 24} Value should be an object with shape {top?: number; bottom?: number; left?: number; right?: number;}
1
import * as React from "react";
2
import { Spinner } from "@twilio-paste/core/spinner";
3
import { TwilioComplianceEmbed } from "@twilio/twilio-compliance-embed";
4
5
function MyComplianceInquiry() {
6
const [data, setData] = React.useState(null);
7
const [isLoading, setLoading] = React.useState(true);
8
9
React.useEffect(() => {
10
fetch("https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize", {
11
method: "POST",
12
})
13
.then((res) => res.json())
14
.then((data) => {
15
setData(data);
16
setLoading(false);
17
});
18
}, []);
19
20
return !isLoading ? (
21
<TwilioComplianceEmbed
22
inquiryId={data.inquiry_id}
23
sessionToken={data.inquiry_session_token}
24
onReady={() => {
25
console.log("Ready!");
26
}}
27
onInquirySubmitted={() => {
28
console.log("Registration complete");
29
}}
30
widgetPadding={{top: 0, left: 100, right: 100, bottom: 0}}
31
/>
32
) : (
33
<Spinner decorative={false} title="Loading" />
34
);
35
}
36
37
export default MyComplianceInquiry;

We currently do not provide native support for integrations with frontend frameworks other than React. However, we are releasing a hosted version of this product soon, so customers using non-React frameworks or older versions of React can also use the Compliance Embeddable. Please check back on this page for more details in the coming months.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.