Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Toll-Free Verification Compliance Embeddable Onboarding Guide


(information)

Info


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. Your team can use this embed to allow your end customers to submit toll-free verification requests through self-service. Twilio manages the questions in the UI, but there is no Twilio branding visible. Your team can customize the UI to match your design standards, including color palette and typeface.

The TFV Compliance Embeddable supports your end customers to resume incomplete verification submissions, and previously rejected verifications can be edited and resubmitted directly within the embeddable experience. This eliminates the need for manual intervention through the API or Console when handling rejected submissions. Additionally, parameters included in the upcoming Feb 17th program policy changes around Business Registration Number and CampaignVerify Token for Political messaging are supported.

Toll-Free Verification form embedded in ISV's website with Twilio-managed features.

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)


To follow these steps, you must have a Trust Hub Primary Customer Profile for a business with the business identity set to ISV/Reseller. See Create a Trust Hub Primary Customer Profile to learn more.


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 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.


Resume and resubmission behavior

resume-and-resubmission-behavior page anchor

The Initialize API supports both new submissions and resumption of existing inquiries. When you call the API for a toll-free number with an existing incomplete or rejected inquiry, the API returns the same inquiry_id with a new inquiry_session_token. Previously entered data is retained and pre-populated in the form.

For rejected verifications eligible for resubmission, calling the Initialize API allows your end customer to edit their submission and correct any issues. The embeddable displays the previous data, enabling targeted corrections rather than requiring complete re-entry.

If a verification is already in progress, approved, or rejected with an error that cannot be resubmitted, the API returns an error response. See the Error responses table for details.

Request Parameters

request-parameters page anchor

Add the following --data-urlencode parameters to the request body:

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 or color. To request a customized Theme, follow the instructions in the 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.
DoingBusinessAs [optional]StringTrade name, sub-entity, or downstream business name if different from the registered business name.
BusinessType [optional]StringThe type of business entity. Valid values are PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, and GOVERNMENT.
BusinessRegistrationNumber [optional]StringA legally recognized business registration number such as an EIN. Required for all business types except SOLE_PROPRIETOR.
BusinessRegistrationAuthority [optional]StringThe authority that issued the business registration. For US businesses, this is typically EIN. Required for all business types except SOLE_PROPRIETOR.
BusinessRegistrationCountry [optional]StringThe ISO country code where the business is registered. Required for all business types except SOLE_PROPRIETOR.
BusinessRegistrationPhoneNumber [optional]StringThe phone number associated with the business registration in E.164 format.
OptInConfirmationMessage [optional]StringThe confirmation message sent to users when they opt in to receive messages.
OptInKeywords [optional]Array (String)Keywords that users can text to opt in, such as START or YES.
HelpMessageSample [optional]StringA sample help response provided to users who text HELP.
PrivacyPolicyUrl [optional]StringThe URL to the business privacy policy.
TermsAndConditionsUrl [optional]StringThe URL to the business terms and conditions.
AgeGatedContent [optional]BooleanSet to true if the messaging content is age-restricted.
VettingProvider [optional]StringThe vetting provider used for enhanced verification. Currently supports CAMPAIGN_VERIFY.
VettingId [optional]StringThe unique vetting token from the vetting provider. The token is case-sensitive and must match the format provided by the vetting provider exactly.
AdditionalInformation [optional]StringAdditional info to help with the verification.
SkipMessagingUseCase [optional]BooleanSend 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". 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. Refer to our Toll-Free Verification Guide for detailed validation rules. Additionally, you may sign up for status change notifications for Toll-Free Verification via Twilio Event Streams.

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
businessName: "Twilio",
14
businessRegistrationAuthority: "EIN",
15
businessRegistrationCountry: "US",
16
businessRegistrationNumber: "12-3456789",
17
businessType: "PRIVATE_PROFIT",
18
businessWebsite: "https://www.twilio.com",
19
notificationEmail: "dean@twilio.com",
20
tollfreePhoneNumber: "+800445566",
21
});
22
23
console.log(complianceTollfreeInquiry.inquiryId);
24
}
25
26
createComplianceTollfreeInquiry();

Response

Note about this response
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. For a single inquiry_id, there's a limit that you can generate max 50 inquiry_session_tokens.500Internal Server Error
Use case categories
use-case-categories page anchor

Valid values for the UseCaseCategories parameter include:

  • TWO_FACTOR_AUTHENTICATION
  • ACCOUNT_NOTIFICATIONS
  • CUSTOMER_CARE
  • DELIVERY_NOTIFICATIONS
  • FRAUD_ALERT_MESSAGING
  • HIGHER_EDUCATION
  • MARKETING
  • POLLING_AND_VOTING
  • PUBLIC_SERVICE_ANNOUNCEMENT
  • SECURITY_ALERT
  • POLITICAL_ELECTION_CAMPAIGNS

Multiple categories can be provided if applicable to your use case.


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.

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, 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. Check back on this page for more details in the coming months.


Frequently asked questions

frequently-asked-questions page anchor

How long does the session token last? The inquiry_session_token expires 1440 minutes (24 hours) after creation. If the token expires, call the Initialize API again to get a new token. The inquiry_id remains the same for existing inquiries.

What happens if an end customer closes their browser during submission? The data entered up to that point is saved. When they return and you call the Initialize API for the same toll-free number, they can resume from where they left off.

Can I customize the look and feel of the embeddable? Yes. Request a custom theme through the FAQ instructions(link takes you to an external page) and use the returned ThemeSetId in your Initialize API calls.

What business registration authority should US businesses use? US businesses should use EIN (Employer Identification Number) as the BusinessRegistrationAuthority. The BusinessRegistrationNumber should be the 9-digit EIN, optionally formatted with a hyphen (for example, 12-3456789 or 123456789).