A2P 10DLC Compliance Embeddable Onboarding Guide
Info
With global regulatory requirements frequently changing across jurisdictions, navigating compliance is an expensive, ongoing challenge. Complex requirements lead to customer confusion and registration drop-offs, while maintaining internal compliance tooling consumes significant engineering resources. The Compliance Embeddable helps address these challenges by shifting the development and regulatory management burden away from your team, allowing you to scale onboarding effortlessly.
The Compliance Embeddable is a white-label, self-service solution designed to integrate seamlessly into an Independent Software Vendor's (ISV) existing portal or web application. It empowers your end customers to independently manage their registrations and verifications requests while Twilio manages the underlying registration workflow infrastructure.
No Twilio Branding: Twilio manages the UI logic and regulatory question flows behind the scenes, but the entire experience can be fully customized to match your platform's exact design, typography, and color palette. Request Theme: https://forms.gle/tvSuXpvwJE9aPj9B9
Minimize Manual Data Entry: When initializing the Compliance Inquiry, Twilio allows ISVs to pre-fill their customer data for an expedited registration experience.
Test With a Mock Brand: Set isTest to true when you initialize a brand inquiry to create a mock brand. A mock brand lets you test the full registration flow end to end without submitting real data to The Campaign Registry (TCR). Mock brands are auto-rejected without verification and can't be used for phone number purchases.
Skip Secondary Vetting: Set skipAutomaticSecVet to true to skip the message volume questions in the registration UI.
Pre-Submission Accuracy Check: Before submitting a campaign, your end customers can use the Check Campaign accuracy check on the Review and Submit screen to catch potential errors and improve their chances of carrier approval.
The Compliance Embeddable requires two integrations:
- Server-side integration: Call Twilio's API to initialize a Compliance Inquiry and retrieve a session token and inquiry ID.
- Client-side integration: Embed the UI in an iframe, and include the session token and inquiry ID as URL parameters.
All calls must be authenticated using Twilio's REST API credentials with Basic Auth, where the account SID is either your primary Twilio Account SID or a subaccount SID. The Account SID given in the credentials is the account that the registration will be associated with after completion of the ComplianceInquiry.
Learn more about the Compliance Embeddable in the Compliance Embeddable FAQ
Before you begin, you must have a Trust Hub Primary Customer Profile for a business whose Business Identity is set to ISV or Reseller. See Create a Trust Hub Primary Customer Profile to learn more.
Only ISV accounts with approved Trust Hub profiles can access the Compliance Embeddable API. Trial accounts are not eligible to use this API.
A2P 10DLC registration is a two-step process that requires both Brand Registration and Campaign Registration. The Compliance Embeddable supports this flow through two separate form submissions:
- Brand Registration: First, you initialize a brand inquiry to collect business information. This registers the brand with The Campaign Registry (TCR).
- Campaign Registration: After the brand is approved, you initialize a campaign inquiry to register specific messaging campaigns under that brand.
The Compliance Embeddable supports both steps by separately calling the Initialize Inquiry API in your workflow twice:
- Once to initialize the brand registration inquiry
- A second time to initialize the campaign registration inquiry after the initial brand approval
A brand or campaign registration moves through the following states. What you can do with a registration, including whether the Compliance Embeddable will let you resume or resubmit it, depends on its current state:
- Draft: The registration has been started but not yet submitted for review. You can resume a draft registration to pick up where your end customer left off.
- In progress: The registration has been submitted and is under review by Twilio or The Campaign Registry (TCR). It can't be resumed or resubmitted while in this state.
- Approved: The registration passed review. It can't be resubmitted.
- Rejected: The registration failed review for a correctable reason. You can resubmit a rejected registration with corrected information.
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.
The Compliance Embeddable supports three flows: starting a new registration, resuming a draft registration, and resubmitting a rejected registration. If a registration is already in progress, approved, or rejected with an error that can't be resubmitted, the API returns an error response. See the Error responses table for details.
To initialize a ComplianceInquiry for A2P 10DLC Brand registration, make an HTTPS request to the following API:
POST https://trusthub.twilio.com/v1/A2PBrandRegistrations
If you provide data for optional fields, they're pre-filled in any of your users' subsequent forms.
The body must use the application/json content type.
| Field | Field type | Field Specifics | Description |
|---|---|---|---|
brandType [required] | Enum | Allowed Values: STANDARD, SOLE_PROPRIETOR | A SOLE_PROPRIETOR is an unregistered individual with strict messaging limits and no EIN, while a STANDARD Business is a legally registered entity with an EIN that unlocks high-volume, high-throughput messaging capabilities. |
friendlyName [required] | String | Max length: 255 | A descriptive name for this brand or campaign registration inquiry. |
notificationEmail [required] | String | Email regex. Max length: 500 | The email address to which all notifications for the status of the registration will be sent. |
themeSetId [optional] | String | Max length: 255 | Theme ID for customized UI styling. To request a customized Theme, follow the instructions in our FAQ. |
businessName [optional] | String | Max length: 255 | The name of the business or organization using the phone number. |
businessRegistrationAuthority [opt] | String | Allowed Values: TBD | The authority that issued the business registration. For US businesses, this is typically EIN. Required for all business types except SOLE_PROPRIETOR. |
businessRegistrationNumber [opt] | String | Max length: 21 | A legally recognized business registration number such as an EIN. Required for all business types except SOLE_PROPRIETOR. |
businessIndustry [optional] | Enum | Allowed Values: AGRICULTURE, AUTOMOTIVE, BANKING, COMMUNICATION, CONSTRUCTION, CONSUMER, EDUCATION, ELECTRONICS, ENERGY, ENGINEERING, FAST_MOVING_CONSUMER_GOODS, FINANCIAL, FINTECH, FOOD_AND_BEVERAGE, GAMBLING, GOVERNMENT, HEALTHCARE, HOSPITALITY, INSURANCE, JEWELRY, LEGAL, MANUFACTURING, MEDIA, NOT_FOR_PROFIT, OIL_AND_GAS, ONLINE, PROFESSIONAL_SERVICES, RAW_MATERIALS, REAL_ESTATE, RELIGION, RETAIL, TECHNOLOGY, TELECOMMUNICATIONS, TRANSPORTATION, TRAVEL | |
businessWebsite [optional] | String | URL regex (https://). Max length: 255 | The website of the business or organization using the phone number. |
brandType [required] | Enum | Allowed Values: PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, SOLE_PROPRIETOR, GOVERNMENT | |
brandExternalVettingToken [opt] | String | Max length: 10 | The unique vetting token from the vetting provider. The token is case sensitive and must match the format provided by the vetting provider exactly. |
businessStockSymbol [optional] | String | Max length: 10 | The unique publicly traded company or organization stock or ticker symbol |
businessIndustry [optional] | Enum | Allowed Values: AMEX, AMX, ASX, B3, BME, BSE, FRA, ICEX, JPX, JSE, KRX, LON, NASDAQ, NONE, NYSE, NSE, OMX, OTHER, SEHK, SGX, SSE, STO, SWX, SZSE, TSX, TWSE, VSE | |
businessTaxExemptStatus [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true will mark the business as excempt from local government taxes. |
businessStreetAddress [optional] | String | Max length: 100 | The address of the business or organization using the phone number. |
businessStreetAddress2 [optional] | String | Max length: 100 | The second row of the street address of the business or organization using the phone number. |
businessCity [optional] | String | Max length: 100 | The city of the business or organization using the phone number. |
businessStateProvinceRegion [opt] | String | Max length: 20 | The state/province or region of the business or organization using the phone number. |
businessPostalCode [optional] | String | Max length: 10 | The postal code of the business or organization using the phone number. |
businessCountry [optional] | String | Max length: 2 | The ISO country code of the business or organization using the phone number. |
businessContactFirstName [opt] | String | Max length: 100 | The first name of the contact for the business or organization using the phone number. |
businessContactLastName [opt] | String | Max length: 100 | The last name of the contact for the business or organization using the phone number. |
businessContactEmail [optional] | String | Email regex. Max length: 100 | The email address of the contact for the business or organization using the phone number. |
businessContactPhone [optional] | String | E.164 regex. Max length: 20 | The phone number of the contact for the business or organization using the phone number. |
authorizedContactVerificationEmail [opt] | String | Email regex. Max length: 255 | The first and last name of the designated representative for the business or organization. |
authorizedContactMobilePhoneNumberE164 [opt] | String | E.164 regex. Max length: 20 | The phone number of the designated representative for the business or organization. |
isTest [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true will mark the bundle as a test bundle. The test bundle will be auto-rejected without verification and cannot be used for phone number purchases. If this field is not provided, by default the bundle will NOT be created as a test bundle |
skipAutomaticSecVet [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true skips the message volume questions in UI |
1curl -X POST https://trusthub.twilio.com/v1/A2PBrandRegistrations \2-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token \3-H "Content-Type: application/json" \4-d '{5"brandType": "STANDARD",6"customerProfileId": "BU1213242784782",7"friendlyName": "Acme Corp",8"themeSetId": "theme_abc123",9"notificationEmail": "notify@example.com",10"businessName": "Acme Corp",11"businessRegistrationAuthority": "EIN",12"businessRegistrationNumber": "123456789",13"businessIndustry": "TECHNOLOGY",14"businessWebsite": "https://acme.com",15"businessType": "PRIVATE_PROFIT",16"businessStockSymbol": "TWLO",17"businessStockExchange": "NYSE",18"businessTaxExemptStatus": false,19"businessStreetAddress": "123 Main St",20"businessStreetAddress2": "Suite 100",21"businessCity": "San Francisco",22"businessStateProvinceRegion": "CA",23"businessPostalCode": "94105",24"businessCountry": "US",25"businessContactFirstName": "Jane",26"businessContactLastName": "Doe",27"businessContactEmail": "jane@acme.com",28"businessContactPhone": "+14155551234",29"authorizedContactVerificationEmail": "verification@example.com",30"authorizedContactMobilePhoneNumberE164": "+14333045678",31"brandExternalVettingToken": "cv|10dlctcr|...",32"isTest": true,33"skipAutomaticSecVet": true34}'
Output
1{2"id": "tri1.us1.account.AC238276e6.registration.BU6469a51f",3"sessionId": "inq_XXXXXXXXXXXXXXXXXXXXXXXX",4"sessionToken": "eyJhbGciOiJIUzI1NiIs..."5}
Use the same EmbeddedSessions endpoint whether you're resuming a draft brand registration or resubmitting one that was rejected. When resubmitting a rejected brand, the embedded UI shows your end customer a user-friendly rejection reason and walks them through correcting it.
POST https://trusthub.twilio.com/v1/A2PBrandRegistrations/{id}/EmbeddedSessions
The value for id is tri1.us1.account.(AccountSID).registration.(BrandBundleSID)
To look up a brand's rejection state and reason directly through the API instead of through the embedded UI, see the Brand Registration API docs.
- To retrieve a list of all A2P 10DLC registrations, including their Bundle SIDs, make an HTTPS request to the following API:
GET https://messaging.twilio.com/v1/a2p/BrandRegistrations
You can also find the brand by using the Bundle SID (BU###) returned in the Initialize ComplianceInquiry response, by passing it as the A2PProfileBundleSid query parameter:
1curl -X GET "https://messaging.twilio.com/v1/a2p/BrandRegistrations?A2PProfileBundleSid=[BU_SID]" \2-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
To learn more about query parameters for filtering results, see the Brand Registration API docs.
Set skipAutomaticSecVet to true to skip the secondary vet questions in the registration UI.
What is Secondary Vet? Secondary vet is the step in brand registration that determines how a given brand is vetted. It is not just a volume question: it controls several downstream outcomes for the brand:
- Brand type: Determines whether the brand is registered as Standard or Low Volume Standard.
- Fee: Determines the registration fee charged for the brand.
- Volume thresholds: Determines the message volume thresholds applied to the brand (e.g., the 6,000 segment/day and 2,000/day T-Mobile limits).
Before you skip: Secondary vet may be required for certain industries or campaign types, independent of this setting. If you set skipAutomaticSecVet to true, you are responsible for ensuring your end-to-end registration flow still assigns the correct brand type, fee, and volume threshold for the brand. Skipping the question does not remove these requirements, it only removes the prompt.
| Setting Brand Type | Embed Action | Outcome |
|---|---|---|
| SOLE_PROPRIETOR | No EIN requested | Automatically assigned to Low Volume |
| STANDARD | EIN requested | User manually selects Low Volume or Standard in the embed flow |
| STANDARD | ISV skips the Embed Volume page (skipAutomaticSecVet = true) | Automatically submitted as Low Volume Standard |
To initialize a ComplianceInquiry for A2P 10DLC Campaign registration, make an HTTPS request to the following API:
POST https://trusthub.twilio.com/v1/A2PCampaignRegistrations
If you provide data for optional fields, they're pre-filled in any of your users' subsequent forms.
The body must use the application/json content type.
| Field | Field type | Field Specifics | Description | |
|---|---|---|---|---|
a2pBrandRegistrationSid [required] | String | BN SID | The Brand Registration SID from the approved brand registration. | |
messagingServiceSid [required] | String | MG SID | The Messaging Service SID to associate with this campaign. Best Practice is to create and save the MG SID: because a campaign's Bundle SID is removed once the campaign is created, you need the Messaging Service SID to resume, resubmit, or check the status of the campaign afterward. | |
themeSetId [optional] | String | Max length: 255 | Theme ID for customized UI styling. To request a customized Theme, follow the instructions in our FAQ. | |
useCaseCategories [optional] | Enum | Allowed Values: 2FA, ACCOUNT_NOTIFICATION, AGENTS_FRANCHISES, CARRIER_EXEMPT, CHARITY, CUSTOMER_CARE, DELIVERY_NOTIFICATION, EMERGENCY, FRAUD_ALERT, HIGHER_EDUCATION, K12_EDUCATION, MARKETING, MIXED, POLITICAL, POLLING_VOTING, PROXY, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, SOCIAL, SWEEPSTAKE | The category that best describes the use case for this campaign. | |
useCaseDescription [optional] | String | Min Length: 40 Max length: 4096 | Detailed description of the campaign's messaging use case. | |
useCaseSampleMessage1 [optional] | String | Min Length: 40 Max length: 1024 | First sample message demonstrating typical message content for this campaign. | |
useCaseSampleMessage2 [optional] | String | Min Length: 40 Max length: 1024 | Second sample message demonstrating typical message content for this campaign. | |
useCaseSampleMessage3 [optional] | String | Min Length: 40 Max length: 1024 | Third sample message demonstrating typical message content for this campaign. | |
useCaseSampleMessage4 [optional] | String | Min Length: 40 Max length: 1024 | Fourth sample message demonstrating typical message content for this campaign. | |
useCaseSampleMessage5 [optional] | String | Min Length: 40 Max length: 1024 | Fifth sample message demonstrating typical message content for this campaign. | |
useCaseCategories [optional] | Enum | Allowed Values: VERBAL, WEB_FORM, PAPER_FORM, VIA_TEXT, MOBILE_QR_CODE | The method by which end users opt-in to receive messages. | |
useCaseOptInDescription [optional] | String | Min Length: 40 Max length: 2048 | Description of how end users opt-in to receive messages from this campaign. | |
hasEmbeddedLinks [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true indicates that messages will include embedded links. | |
hasEmbeddedPhone [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true indicates that messages will include embedded phone numbers. | |
embeddedUrlSample [optional] | String | URL regex (https://). Max length: 255 | Sample URLs that will be embedded in messages. | |
directLending [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true indicates this campaign involves direct lending or loan arrangements. | |
ageGated [optional] | Boolean | Allowed Values: TRUE, FALSE | A value of true indicates this campaign has age restrictions. | |
privacyPolicyUrl [optional] | String | URL regex (https://). Max length: 2048 | URL to the privacy policy applicable to this messaging campaign. | |
termsAndConditionsUrl [optional] | String | URL regex (https://). Max length: 2048 | URL to the terms and conditions applicable to this messaging campaign. | |
optInKeywords [optional] | String | Max length: 255 | Keywords that users can send to opt-in to messages. | |
optInMessageSample [optional] | Array of Strings | Min Length: 20 Max length: 1024 | Sample message sent to users after they opt-in. | |
optOutKeywords [optional] | Array of Strings | Max length: 255 | Keywords that users can send to opt-out of messages. | |
optOutMessageSample [optional] | String | Min Length: 20 Max length: 1024 | Sample message sent to users after they opt-out. | |
helpKeywords [optional] | Array of Strings | Max length: 255 | Keywords that users can send to request help. | |
helpMessageSample [optional] | String | Min Length: 20 Max length: 1024 | Sample message sent to users when they request help. |
a2pBrandRegistrationSid and messagingServiceSid are required. The remaining fields are optional and, if provided, pre-fill your end customer's form.
1curl -X POST https://trusthub.twilio.com/v1/A2PCampaignRegistrations \2-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token \3-H "Content-Type: application/json" \4-d '{5"a2pBrandRegistrationSid": "BN01cab0515ca623fc3d3bc9ee0879b50f",6"messagingServiceSid": "MG12345678901234567890123456789000",7"themeSetId": "theme_abc123",8"useCaseCategories": ["ACCOUNT_NOTIFICATIONS", "CUSTOMER_CARE"],9"useCaseDescription": "Order status updates and customer support responses",10"useCaseSampleMessage1": "Hi Jane, your order #4821 has shipped and will arrive by Thursday. Track at acme.com/track/4821",11"useCaseSampleMessage2": "Hi Jane, your order #4821 has shipped and will arrive by Thursday. Track at acme.com/track/4821",12"useCaseSampleMessage3": "Hi Jane, your order #4821 has shipped and will arrive by Thursday. Track at acme.com/track/4821",13"useCaseSampleMessage4": "Hi Jane, your order #4821 has shipped and will arrive by Thursday. Track at acme.com/track/4821",14"useCaseSampleMessage5": "Hi Jane, your order #4821 has shipped and will arrive by Thursday. Track at acme.com/track/4821",15"useCaseOptInTypes": ["WEB_FORM"],16"useCaseOptInDescription": "End users opt-in by visiting www.acme.com and adding their phone number. They then check a box agreeing to receive text messages from Acme, Inc. Additionally, end users can also opt-in by texting START to (111) 555-3333 to opt in. Terms and Conditions at www.acme.com/tc. Privacy Policy at www.acme.com/privacy.",17"hasEmbeddedLinks": false,18"hasEmbeddedPhone": false,19"embeddedUrlSample": "https://acme.com/privacy",20"directLending": false,21"ageGated": false,22"privacyPolicyUrl": "https://acme.com/privacy",23"termsAndConditionsUrl": "https://acme.com/terms",24"optInKeywords": ["START", "SUBSCRIBE"],25"optInMessageSample": "For help, visit acme.com/support or call 1-800-555-0123. Reply STOP to opt out.",26"optOutKeywords": ["START", "SUBSCRIBE"],27"optOutMessageSample": "For help, visit acme.com/support or call 1-800-555-0123. Reply STOP to opt out.",28"helpKeywords": ["START", "SUBSCRIBE"],29"helpMessageSample": "For help, visit acme.com/support or call 1-800-555-0123. Reply STOP to opt out."30}'
Output
1{2"id": "tri1.us1.account.AC238276e6.registration.BU6469a51f",3"sessionId": "inq_XXXXXXXXXXXXXXXXXXXXXXXX",4"sessionToken": "eyJhbGciOiJIUzI1NiIs..."5}
Campaign registrations can be resumed while still in draft, or resubmitted after a rejection. Which endpoint you use depends on the campaign's state: once a campaign is created, Twilio removes its Bundle SID, so you can no longer reference it that way.
If your end customer hasn't finished submitting the campaign yet, resume the draft using its Bundle SID:
POST https://trusthub.twilio.com/v1/A2PCampaignRegistrations/tri1.us1.account.{AccountSID}.registration.{BundleSID}/EmbeddedSessions
Once a campaign is created, its Bundle SID is removed, so you can't use the format above to resubmit a rejected campaign. Instead, use the campaign's Messaging Service SID:
POST https://trusthub.twilio.com/v1/A2PCampaignRegistrations/{MessagingServiceSid}/EmbeddedSessions
The embedded UI shows your end customer a user-friendly rejection reason and walks them through resubmission. To check the rejection reason yourself before resubmitting, see Check campaign status and rejection reason below. This is also why messagingServiceSid is a required field when you initialize a campaign registration: save it so you can resume, resubmit, or check on the campaign later.
Use the campaign's Messaging Service SID to fetch its current status and, if it was rejected, the reason:
GET https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/Compliance/Usa2p
This endpoint returns the following details for the campaign associated with that Messaging Service:
sidcampaign_status(for example,IN_PROGRESS,VERIFIED, orFAILED)failure_reason(if any)
| Status Code | Reason | Trigger |
|---|---|---|
| 400 | "Campaign prefill fields are not allowed" | Request includes prefill fields (keywords, description, sample messages, etc.) but the caller is NOT an API customer (missing/wrong T-Edge or T-Actor headers). |
| 400 | Validation failure | Any prefill field fails validation, for example useCaseDescription too short/long, invalid useCaseCategories values, keywords exceed max joined length, URLs don't start with https://, invalid useCaseOptInTypes, message samples outside length bounds. |
| 400 | "useCaseCategories contains values not qualified for this brand" | API customer provides useCaseCategories that aren't in the brand's qualified use-case list. |
| 400 | "A campaign already exists for messaging service MGsid" | A messagingServiceSid was provided but that messaging service already has a registered campaign. |
| 400 | Downstream 404 mapped to 400 | A downstream service returns 404 (for example, brand registration not found). The error handler maps both 400 and 404 from ClientException to a 400 response. |
| 403 | Feature not enabled | The API_A2P_EMBEDDABLE_V2_ENABLED feature flag is not enabled for the account (and the account is not a OneConsole account). Message: "A2P Embeddable V2 is not enabled for this account". |
| 401 | Downstream unauthorized | A downstream service returns a 401 (propagated through handleCampaignInitializationError). |
| 500 | Campaign existence check failure | The call to verify no campaign exists for the messaging service fails with a non-400/non-404 error. |
| 500 | Too many Persona sessions | PersonaTooManySessionsException. Persona rate-limits session creation. |
| 500 | Any other unexpected exception | Generic catch-all in handleCampaignInitializationError. |
Track your A2P registration status automatically with Twilio Event Streams. You can now get instant webhook notifications for any changes to your Brands, Campaigns, or 10DLC numbers without having to manually poll APIs or refresh the console. To learn more, see the Event Streams docs.
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 in your site using following code snippet:
1import * as React from "react";2import { TwilioComplianceEmbed } from "@twilio/twilio-compliance-embed";34const ComplianceInquiry = () => {5return (6<TwilioComplianceEmbed7inquiryId='<your inquiry ID from calling the Initialize ComplianceInquiry API>'8inquirySessionToken='<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.
| Name | Type | Description |
|---|---|---|
inquiryId | (Required) String | A valid inquiryId returned by calling the Initialize ComplianceInquiry API. |
inquirySessionToken | (Required) String | A valid inquirySessionToken returned by calling the Initialize ComplianceInquiry API. |
onInquirySubmitted | () => void | An 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 | () => void | An event handler that fires when a user completes the ComplianceInquiry process. This event is fired when the user clicks the Done or Exit button on the last page. Note: 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 | () => void | An event handler that fires when the user has canceled the ComplianceInquiry process. |
onError | () => void | An event handler that fires when an unexpected error occurs during the ComplianceInquiry process. |
onReady | () => void | An 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 you omit the property, the component applies the default padding: {top: 74, left: 24, right: 24, bottom: 24}. The value should be an object with the following structure: {top?: number; bottom?: number; left?: number; right?: number;} |
1import * as React from "react";2import { Spinner } from "@twilio-paste/core/spinner";3import { TwilioComplianceEmbed } from "@twilio/twilio-compliance-embed";45function MyComplianceInquiry() {6const [data, setData] = React.useState(null);7const [isLoading, setLoading] = React.useState(true);89React.useEffect(() => {10fetch("https://trusthub.twilio.com/v1/ComplianceInquiries/Tollfree/Initialize", {11method: "POST",12})13.then((res) => res.json())14.then((data) => {15setData(data);16setLoading(false);17});18}, []);1920return !isLoading ? (21<TwilioComplianceEmbed22inquiryId={data.inquiry_id}23sessionToken={data.inquiry_session_token}24onReady={() => {25console.log("Ready!");26}}27onInquirySubmitted={() => {28console.log("Registration complete");29}}30widgetPadding={{top: 0, left: 100, right: 100, bottom: 0}}31/>32) : (33<Spinner decorative={false} title="Loading" />34);35}3637export default MyComplianceInquiry;
A React and JS SDK is available for teams who want to integrate registration directly into their own framework instead of using the hosted page.
The SDK is not yet publicly released. If you want to integrate outside of the hosted page, contact us for access.