Get started with Secondary Customer Profiles Compliance Embed
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.
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:
- From their servers, the ISV calls the Twilio ComplianceInquiry Initialize API resource. This returns a session token and session ID.
- In their web app, the ISV creates a React component or JavaScript instance that renders a form in an
iframetag. This form connects to the compliance inquiry in Twilio through the ID and token. - The end customer completes and submits their compliance request through the ISV web app.
- 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.
Before you begin, complete the following tasks:
- Create a paid Twilio account, if needed. You can't use a trial account.
- Get an approved Trust Hub Primary Customer Profile in the Twilio Console with a Business Identity of ISV or Reseller.
- Add Persona to the allow list on your firewall. To manage compliance, Twilio uses this service.
- Create a Content Security Policy (CSP) for your web app as another layer of security.
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.
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.
1curl -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
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}
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.
- If the existing ComplianceInquiry hasn't completed or failed, the API resumes it and returns the same
inquiry_idwith a newinquiry_session_token. - If it has completed or failed, the API creates a new ComplianceInquiry and returns a new
inquiry_id. Initialize the SDK with theinquiry_idandinquiry_session_tokenfrom 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.
To check the status of a SCP request, make a GET request and retrieve the SCP.
GET https://trusthub.twilio.com/v1/CustomerProfiles/{Sid}
1curl -X GET "https://trusthub.twilio.com/v1/CustomerProfiles/BU00000000000000000000000000000000" \2-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
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": 1860121}22]23}
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 value | Registration progress | Can resume? | Can resubmit? |
|---|---|---|---|
DRAFT | Started, but not submitted for review. | Yes | No |
PENDING or PENDING_REVIEW | Submitted. | No | No |
IN_REVIEW | Submitted and Twilio, TCR, or both are reviewing the registration. | No | No |
APPROVED or TWILIO_APPROVED | Passed review. | No | No |
REJECTED or TWILIO_REJECTED | Failed review for a correctable reason. | No | Yes |
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.
1curl -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
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.
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 status | Cause |
|---|---|
400 | The request didn't have a PrimaryProfileSid. |
400 | The request omitted the NotificationEmail parameter and no Primary Customer Profile exists. |
400 | On resume, the Secondary Customer Profile isn't in DRAFT or TWILIO_REJECTED status, so your customer can't edit it. |
401 | On resume, the CustomerId doesn't belong to the account in your API credentials. |
404 | A resource referenced in the request doesn't exist. |
409 | The request conflicts with an existing ComplianceInquiry. |
500 | You reached the session limit of 25 session tokens for one inquiry_id or an unexpected error occurred. |
After you initialize the ComplianceInquiry, embed the form in your app using the Twilio React SDK or the Twilio JavaScript SDK.