Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Get started with Secondary Customer Profiles Compliance Embed


(new)

Compliance Embed in Public Beta

Compliance Embed is currently available for this program as a Public Beta product and the information contained in this document is subject to change. This means that some features are not yet implemented and others may be changed before the product is declared as Generally Available. Public Beta products are not covered by a Twilio SLA.

To use the Compliance Embeddable API, request access(link takes you to an external page).

To allow the end customers of an Independent Software Vendor (ISV) to comply with regulations, Twilio provides the Compliance Embed solution. The Compliance Embed provides an unbranded, self-service solution designed to integrate seamlessly into an ISV-hosted web app.

To create this self-service experience, ISVs complete the following activities:

  1. From their servers, the ISV calls the Twilio ComplianceInquiry Initialize API resource. This returns a session token and session ID.
  2. In their web app, the ISV creates a React component or JavaScript instance that renders a form in an iframe tag. This form connects to the compliance inquiry in Twilio through the ID and token.
  3. The end customer completes and submits their compliance request through the ISV web app.
  4. If it succeeds, the end customer can send messages. If it fails, the end customer can, in most cases, resubmit their request through the ISV's web app.

Prerequisites

prerequisites page anchor

Before you begin, complete the following tasks:

  1. Create a paid Twilio account(link takes you to an external page), if needed. You can't use a trial account.
  2. Get an approved Trust Hub Primary Customer Profile in the Twilio Console(link takes you to an external page) with a Business Identity of ISV or Reseller.
  3. Add Persona(link takes you to an external page) to the allow list on your firewall. To manage compliance, Twilio uses this service.
  4. Create a Content Security Policy (CSP)(link takes you to an external page) for your web app as another layer of security.

Authenticate with Twilio API

api-auth page anchor

You must authenticate all requests using Twilio's REST API credentials with HTTP Basic Auth.

  • Use your account SID as the username and your token as the password.
  • The account SID can be either your primary Twilio Account SID or a subaccount SID.

After your ComplianceInquiry completes, the Secondary Customer Profile (SCP) registration ID contains the Account SID that you provided in your credentials. This binds this SCP to that Account.


Initialize one Secondary Customer Profile ComplianceInquiry

init page anchor

To initialize a ComplianceInquiry for one SCP, make an HTTPS POST request with the SID of the Primary Customer Profile in your parent Twilio account.

GET https://trusthub.twilio.com/v1/ComplianceInquiries/Customers/Initialize

A successful request returns an HTTP 201 Created response with a JSON response body.

Initialize an SCP ComplianceInquiryLink to code sample: Initialize an SCP ComplianceInquiry
1
curl -X POST "https://trusthub.twilio.com/v1/ComplianceInquiries/Customers/Initialize" \
2
--data-urlencode "PrimaryProfileSid=BU00000000000000000000000000000000" \
3
--data-urlencode "NotificationEmail=receive-notices@example.com" \
4
--data-urlencode "ThemeSetId=THXXXXX" \
5
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Response

Note about this response
1
{
2
"inquiry_id": "inq_aaaaaaaaaaaaaaaaaaaaaaaa",
3
"inquiry_session_token": "new.session.token",
4
"customer_id": "tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.customer.BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"url": "https://trusthub.twilio.com/v1/ComplianceInquiries/Customers/tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.customer.BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Initialize"
6
}

How to read the Registration ID

reg-id page anchor

The value of the id property contains two SIDs: tri1.us1.account.{$TWILIO_ACCOUNT_SID}.registration.{$TF_PHONE_NUMBER_SID}.

If the id property returns a value of tri1.us1.account.ACaa..aa.registration.PNnn..nn, this means this registration links to both the Account SID ACaa..aa and the Toll-Free Phone Number SID PNnn..nn.

When you check the status of this registration, search for an a2p_profile_bundle_sid that matches BUbb..bb.

ComplianceInquiry results

complianceinquiry-results page anchor
  • If the existing ComplianceInquiry hasn't completed or failed, the API resumes it and returns the same inquiry_id with a new inquiry_session_token.
  • If it has completed or failed, the API creates a new ComplianceInquiry and returns a new inquiry_id. Initialize the SDK with the inquiry_id and inquiry_session_token from the current response.
  • If a rejected verification can be resubmitted, your end customer can edit their submission and correct any issues. The embeddable displays the previous data, enabling targeted corrections rather than requiring complete re-entry.
  • When a verification is in progress, approved, or rejected with an error that can't be resubmitted, the API responds with an error.

Review status of SCP

check page anchor

To check the status of a SCP request, make a GET request and retrieve the SCP.

GET https://trusthub.twilio.com/v1/CustomerProfiles/{Sid}
1
curl -X GET "https://trusthub.twilio.com/v1/CustomerProfiles/BU00000000000000000000000000000000" \
2
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Response

Note about this response
1
{
2
"sid": "BU00000000000000000000000000000000",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"policy_sid": "RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"friendly_name": "friendly_name",
6
"status": "draft",
7
"valid_until": null,
8
"email": "email",
9
"status_callback": "http://www.example.com",
10
"date_created": "2019-07-30T22:29:24Z",
11
"date_updated": "2019-07-31T01:09:00Z",
12
"url": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
13
"links": {
14
"customer_profiles_entity_assignments": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/EntityAssignments",
15
"customer_profiles_evaluations": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Evaluations",
16
"customer_profiles_channel_endpoint_assignment": "https://trusthub.twilio.com/v1/CustomerProfiles/BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelEndpointAssignments"
17
},
18
"errors": [
19
{
20
"code": 18601
21
}
22
]
23
}

Registration process status

registration-process-status page anchor

A brand or campaign registration moves through the following statuses. In certain statuses, you can resubmit a failed registration or resume an in-progress registration.

What you can do with a registration, including whether the Compliance Embed will let you resume or resubmit it, depends on its current status:

Status valueRegistration progressCan resume?Can resubmit?
DRAFTStarted, but not submitted for review.YesNo
PENDING or PENDING_REVIEWSubmitted.NoNo
IN_REVIEWSubmitted and Twilio, TCR, or both are reviewing the registration.NoNo
APPROVED or TWILIO_APPROVEDPassed review.NoNo
REJECTED or TWILIO_REJECTEDFailed review for a correctable reason.NoYes

Resume or resubmit one SCP ComplianceInquiry

resume page anchor

To resume an existing ComplianceInquiry, make an HTTPS POST request to the following API. Pass the CustomerId from the ComplianceInquiry initialization as a body parameter.

1
curl -X POST "https://trusthub.twilio.com/v1/ComplianceInquiries/Customers/tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.customer.BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Initialize" \
2
--data-urlencode "PrimaryProfileSid=BU00000000000000000000000000000000" \
3
--data-urlencode "ThemeSetId=THXXXXX" \
4
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Response

Note about this response
1
{
2
"inquiry_id": "inq_aaaaaaaaaaaaaaaaaaaaaaaa",
3
"inquiry_session_token": "new.session.token",
4
"customer_id": "tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.customer.BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"url": "https://trusthub.twilio.com/v1/ComplianceInquiries/Customers/tri1.us1.trusthub.ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.customer.BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Initialize"
6
}

A successful request returns a 200 OK with the same attributes as the initialize request.


Error responses

errors page anchor

All resources in this guide can return the following errors. Most error responses include an HTTP status code and a message, but not a Twilio error code.

HTTP statusCause
400The request didn't have a PrimaryProfileSid.
400The request omitted the NotificationEmail parameter and no Primary Customer Profile exists.
400On resume, the Secondary Customer Profile isn't in DRAFT or TWILIO_REJECTED status, so your customer can't edit it.
401On resume, the CustomerId doesn't belong to the account in your API credentials.
404A resource referenced in the request doesn't exist.
409The request conflicts with an existing ComplianceInquiry.
500You reached the session limit of 25 session tokens for one inquiry_id or an unexpected error occurred.

Embed the Compliance form in your app

embed-the-compliance-form-in-your-app page anchor

After you initialize the ComplianceInquiry, embed the form in your app using the Twilio React SDK or the Twilio JavaScript SDK.