| name | telnyx-10dlc-java |
| description | Register brands and campaigns for 10DLC (10-digit long code) A2P messaging compliance in the US. Manage campaign assignments to phone numbers. This skill provides Java SDK examples. |
| metadata | {"author":"telnyx","product":"10dlc","language":"java","generated_by":"telnyx-ext-skills-generator"} |
Telnyx 10Dlc - Java
Installation
// See https://github.com/team-telnyx/telnyx-java for Maven/Gradle setup
Setup
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
All examples below assume client is already initialized as shown above.
List Brands
This endpoint is used to list all brands associated with your organization.
GET /10dlc/brand
import com.telnyx.sdk.models.messaging10dlc.brand.BrandListPage;
import com.telnyx.sdk.models.messaging10dlc.brand.BrandListParams;
BrandListPage page = client.messaging10dlc().brand().list();
Create Brand
This endpoint is used to create a new brand.
POST /10dlc/brand — Required: entityType, displayName, country, email, vertical
import com.telnyx.sdk.models.messaging10dlc.brand.BrandCreateParams;
import com.telnyx.sdk.models.messaging10dlc.brand.EntityType;
import com.telnyx.sdk.models.messaging10dlc.brand.TelnyxBrand;
import com.telnyx.sdk.models.messaging10dlc.brand.Vertical;
BrandCreateParams params = BrandCreateParams.builder()
.country("US")
.displayName("ABC Mobile")
.email("email")
.entityType(EntityType.PRIVATE_PROFIT)
.vertical(Vertical.TECHNOLOGY)
.build();
TelnyxBrand telnyxBrand = client.messaging10dlc().brand().create(params);
Get Brand
Retrieve a brand by brandId.
GET /10dlc/brand/{brandId}
import com.telnyx.sdk.models.messaging10dlc.brand.BrandRetrieveParams;
import com.telnyx.sdk.models.messaging10dlc.brand.BrandRetrieveResponse;
BrandRetrieveResponse brand = client.messaging10dlc().brand().retrieve("brandId");
Update Brand
Update a brand's attributes by brandId.
PUT /10dlc/brand/{brandId} — Required: entityType, displayName, country, email, vertical
import com.telnyx.sdk.models.messaging10dlc.brand.BrandUpdateParams;
import com.telnyx.sdk.models.messaging10dlc.brand.EntityType;
import com.telnyx.sdk.models.messaging10dlc.brand.TelnyxBrand;
import com.telnyx.sdk.models.messaging10dlc.brand.Vertical;
BrandUpdateParams params = BrandUpdateParams.builder()
.brandId("brandId")
.country("US")
.displayName("ABC Mobile")
.email("email")
.entityType(EntityType.PRIVATE_PROFIT)
.vertical(Vertical.TECHNOLOGY)
.build();
TelnyxBrand telnyxBrand = client.messaging10dlc().brand().update(params);
Delete Brand
Delete Brand.
DELETE /10dlc/brand/{brandId}
import com.telnyx.sdk.models.messaging10dlc.brand.BrandDeleteParams;
client.messaging10dlc().brand().delete("brandId");
Resend brand 2FA email
POST /10dlc/brand/{brandId}/2faEmail
import com.telnyx.sdk.models.messaging10dlc.brand.BrandResend2faEmailParams;
client.messaging10dlc().brand().resend2faEmail("brandId");
List External Vettings
Get list of valid external vetting record for a given brand
GET /10dlc/brand/{brandId}/externalVetting
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingListParams;
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingListResponse;
List<ExternalVettingListResponse> externalVettings = client.messaging10dlc().brand().externalVetting().list("brandId");
Order Brand External Vetting
Order new external vetting for a brand
POST /10dlc/brand/{brandId}/externalVetting — Required: evpId, vettingClass
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingOrderParams;
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingOrderResponse;
ExternalVettingOrderParams params = ExternalVettingOrderParams.builder()
.brandId("brandId")
.evpId("evpId")
.vettingClass("vettingClass")
.build();
ExternalVettingOrderResponse response = client.messaging10dlc().brand().externalVetting().order(params);
Import External Vetting Record
This operation can be used to import an external vetting record from a TCR-approved
vetting provider.
PUT /10dlc/brand/{brandId}/externalVetting — Required: evpId, vettingId
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingImportsParams;
import com.telnyx.sdk.models.messaging10dlc.brand.externalvetting.ExternalVettingImportsResponse;
ExternalVettingImportsParams params = ExternalVettingImportsParams.builder()
.brandId("brandId")
.evpId("evpId")
.vettingId("vettingId")
.build();
ExternalVettingImportsResponse response = client.messaging10dlc().brand().externalVetting().imports(params);
Revet Brand
This operation allows you to revet the brand.
PUT /10dlc/brand/{brandId}/revet
import com.telnyx.sdk.models.messaging10dlc.brand.BrandRevetParams;
import com.telnyx.sdk.models.messaging10dlc.brand.TelnyxBrand;
TelnyxBrand telnyxBrand = client.messaging10dlc().brand().revet("brandId");
Get Brand SMS OTP Status by Brand ID
Query the status of an SMS OTP (One-Time Password) for Sole Proprietor brand verification using the Brand ID.
GET /10dlc/brand/{brandId}/smsOtp
import com.telnyx.sdk.models.messaging10dlc.brand.BrandRetrieveSmsOtpStatusParams;
import com.telnyx.sdk.models.messaging10dlc.brand.BrandRetrieveSmsOtpStatusResponse;
BrandRetrieveSmsOtpStatusResponse response = client.messaging10dlc().brand().retrieveSmsOtpStatus("4b20019b-043a-78f8-0657-b3be3f4b4002");
Trigger Brand SMS OTP
Trigger or re-trigger an SMS OTP (One-Time Password) for Sole Proprietor brand verification.
POST /10dlc/brand/{brandId}/smsOtp — Required: pinSms, successSms
import com.telnyx.sdk.models.messaging10dlc.brand.BrandTriggerSmsOtpParams;
import com.telnyx.sdk.models.messaging10dlc.brand.BrandTriggerSmsOtpResponse;
BrandTriggerSmsOtpParams params = BrandTriggerSmsOtpParams.builder()
.brandId("4b20019b-043a-78f8-0657-b3be3f4b4002")
.pinSms("Your PIN is @OTP_PIN@")
.successSms("Verification successful!")
.build();
BrandTriggerSmsOtpResponse response = client.messaging10dlc().brand().triggerSmsOtp(params);
Verify Brand SMS OTP
Verify the SMS OTP (One-Time Password) for Sole Proprietor brand verification.
PUT /10dlc/brand/{brandId}/smsOtp — Required: otpPin
import com.telnyx.sdk.models.messaging10dlc.brand.BrandVerifySmsOtpParams;
BrandVerifySmsOtpParams params = BrandVerifySmsOtpParams.builder()
.brandId("4b20019b-043a-78f8-0657-b3be3f4b4002")
.otpPin("123456")
.build();
client.messaging10dlc().brand().verifySmsOtp(params);
Get Brand Feedback By Id
Get feedback about a brand by ID.
GET /10dlc/brand_feedback/{brandId}
import com.telnyx.sdk.models.messaging10dlc.brand.BrandGetFeedbackParams;
import com.telnyx.sdk.models.messaging10dlc.brand.BrandGetFeedbackResponse;
BrandGetFeedbackResponse response = client.messaging10dlc().brand().getFeedback("brandId");
Submit Campaign
Before creating a campaign, use the Qualify By Usecase endpoint to ensure that the brand you want to assign a new campaign...
POST /10dlc/campaignBuilder — Required: brandId, description, usecase
import com.telnyx.sdk.models.messaging10dlc.campaign.TelnyxCampaignCsp;
import com.telnyx.sdk.models.messaging10dlc.campaignbuilder.CampaignBuilderSubmitParams;
CampaignBuilderSubmitParams params = CampaignBuilderSubmitParams.builder()
.brandId("brandId")
.description("description")
.usecase("usecase")
.build();
TelnyxCampaignCsp telnyxCampaignCsp = client.messaging10dlc().campaignBuilder().submit(params);
Qualify By Usecase
This endpoint allows you to see whether or not the supplied brand is suitable for your desired campaign use case.
GET /10dlc/campaignBuilder/brand/{brandId}/usecase/{usecase}
import com.telnyx.sdk.models.messaging10dlc.campaignbuilder.brand.BrandQualifyByUsecaseParams;
import com.telnyx.sdk.models.messaging10dlc.campaignbuilder.brand.BrandQualifyByUsecaseResponse;
BrandQualifyByUsecaseParams params = BrandQualifyByUsecaseParams.builder()
.brandId("brandId")
.usecase("usecase")
.build();
BrandQualifyByUsecaseResponse response = client.messaging10dlc().campaignBuilder().brand().qualifyByUsecase(params);
List Campaigns
Retrieve a list of campaigns associated with a supplied brandId.
GET /10dlc/campaign
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignListParams;
CampaignListParams params = CampaignListParams.builder()
.brandId("brandId")
.build();
CampaignListPage page = client.messaging10dlc().campaign().list(params);
Get campaign
Retrieve campaign details by campaignId.
GET /10dlc/campaign/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignRetrieveParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.TelnyxCampaignCsp;
TelnyxCampaignCsp telnyxCampaignCsp = client.messaging10dlc().campaign().retrieve("campaignId");
Update campaign
Update a campaign's properties by campaignId.
PUT /10dlc/campaign/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignUpdateParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.TelnyxCampaignCsp;
TelnyxCampaignCsp telnyxCampaignCsp = client.messaging10dlc().campaign().update("campaignId");
Deactivate campaign
Terminate a campaign.
DELETE /10dlc/campaign/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignDeactivateParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignDeactivateResponse;
CampaignDeactivateResponse response = client.messaging10dlc().campaign().deactivate("campaignId");
Submit campaign appeal for manual review
Submits an appeal for rejected native campaigns in TELNYX_FAILED or MNO_REJECTED status.
POST /10dlc/campaign/{campaignId}/appeal — Required: appeal_reason
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignSubmitAppealParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignSubmitAppealResponse;
CampaignSubmitAppealParams params = CampaignSubmitAppealParams.builder()
.campaignId("5eb13888-32b7-4cab-95e6-d834dde21d64")
.appealReason("The website has been updated to include the required privacy policy and terms of service.")
.build();
CampaignSubmitAppealResponse response = client.messaging10dlc().campaign().submitAppeal(params);
Get Campaign Mno Metadata
Get the campaign metadata for each MNO it was submitted to.
GET /10dlc/campaign/{campaignId}/mnoMetadata
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetMnoMetadataParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetMnoMetadataResponse;
CampaignGetMnoMetadataResponse response = client.messaging10dlc().campaign().getMnoMetadata("campaignId");
Get campaign operation status
Retrieve campaign's operation status at MNO level.
GET /10dlc/campaign/{campaignId}/operationStatus
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetOperationStatusParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetOperationStatusResponse;
CampaignGetOperationStatusResponse response = client.messaging10dlc().campaign().getOperationStatus("campaignId");
Get OSR campaign attributes
GET /10dlc/campaign/{campaignId}/osr_attributes
import com.telnyx.sdk.models.messaging10dlc.campaign.osr.OsrGetAttributesParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.osr.OsrGetAttributesResponse;
OsrGetAttributesResponse response = client.messaging10dlc().campaign().osr().getAttributes("campaignId");
Get Sharing Status
GET /10dlc/campaign/{campaignId}/sharing
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetSharingStatusParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignGetSharingStatusResponse;
CampaignGetSharingStatusResponse response = client.messaging10dlc().campaign().getSharingStatus("campaignId");
Accept Shared Campaign
Manually accept a campaign shared with Telnyx
POST /10dlc/campaign/acceptSharing/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignAcceptSharingParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.CampaignAcceptSharingResponse;
CampaignAcceptSharingResponse response = client.messaging10dlc().campaign().acceptSharing("C26F1KLZN");
Get Campaign Cost
GET /10dlc/campaign/usecase_cost
import com.telnyx.sdk.models.messaging10dlc.campaign.usecase.UsecaseGetCostParams;
import com.telnyx.sdk.models.messaging10dlc.campaign.usecase.UsecaseGetCostResponse;
UsecaseGetCostParams params = UsecaseGetCostParams.builder()
.usecase("usecase")
.build();
UsecaseGetCostResponse response = client.messaging10dlc().campaign().usecase().getCost(params);
List Shared Campaigns
Retrieve all partner campaigns you have shared to Telnyx in a paginated fashion.
GET /10dlc/partner_campaigns
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignListParams;
PartnerCampaignListPage page = client.messaging10dlc().partnerCampaigns().list();
Get Single Shared Campaign
Retrieve campaign details by campaignId.
GET /10dlc/partner_campaigns/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignRetrieveParams;
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.TelnyxDownstreamCampaign;
TelnyxDownstreamCampaign telnyxDownstreamCampaign = client.messaging10dlc().partnerCampaigns().retrieve("campaignId");
Update Single Shared Campaign
Update campaign details by campaignId.
PATCH /10dlc/partner_campaigns/{campaignId}
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignUpdateParams;
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.TelnyxDownstreamCampaign;
TelnyxDownstreamCampaign telnyxDownstreamCampaign = client.messaging10dlc().partnerCampaigns().update("campaignId");
Get Sharing Status
GET /10dlc/partnerCampaign/{campaignId}/sharing
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignRetrieveSharingStatusParams;
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignRetrieveSharingStatusResponse;
PartnerCampaignRetrieveSharingStatusResponse response = client.messaging10dlc().partnerCampaigns().retrieveSharingStatus("campaignId");
List shared partner campaigns
Get all partner campaigns you have shared to Telnyx in a paginated fashion
This endpoint is currently limited to only returning shared campaigns that Telnyx
has accepted.
GET /10dlc/partnerCampaign/sharedByMe
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignListSharedByMePage;
import com.telnyx.sdk.models.messaging10dlc.partnercampaigns.PartnerCampaignListSharedByMeParams;
PartnerCampaignListSharedByMePage page = client.messaging10dlc().partnerCampaigns().listSharedByMe();
List phone number campaigns
GET /10dlc/phone_number_campaigns
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListParams;
PhoneNumberCampaignListPage page = client.messaging10dlc().phoneNumberCampaigns().list();
Create New Phone Number Campaign
POST /10dlc/phone_number_campaigns — Required: phoneNumber, campaignId
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignCreate;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignCreateParams;
PhoneNumberCampaignCreate params = PhoneNumberCampaignCreate.builder()
.campaignId("4b300178-131c-d902-d54e-72d90ba1620j")
.phoneNumber("+18005550199")
.build();
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().create(params);
Get Single Phone Number Campaign
Retrieve an individual phone number/campaign assignment by phoneNumber.
GET /10dlc/phone_number_campaigns/{phoneNumber}
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignRetrieveParams;
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().retrieve("phoneNumber");
Create New Phone Number Campaign
PUT /10dlc/phone_number_campaigns/{phoneNumber} — Required: phoneNumber, campaignId
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignCreate;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignUpdateParams;
PhoneNumberCampaignUpdateParams params = PhoneNumberCampaignUpdateParams.builder()
.campaignPhoneNumber("phoneNumber")
.phoneNumberCampaignCreate(PhoneNumberCampaignCreate.builder()
.campaignId("4b300178-131c-d902-d54e-72d90ba1620j")
.phoneNumber("+18005550199")
.build())
.build();
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().update(params);
Delete Phone Number Campaign
This endpoint allows you to remove a campaign assignment from the supplied phoneNumber.
DELETE /10dlc/phone_number_campaigns/{phoneNumber}
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignDeleteParams;
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().delete("phoneNumber");
Assign Messaging Profile To Campaign
This endpoint allows you to link all phone numbers associated with a Messaging Profile to a campaign.
POST /10dlc/phoneNumberAssignmentByProfile — Required: messagingProfileId
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileAssignParams;
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileAssignResponse;
PhoneNumberAssignmentByProfileAssignParams params = PhoneNumberAssignmentByProfileAssignParams.builder()
.messagingProfileId("4001767e-ce0f-4cae-9d5f-0d5e636e7809")
.build();
PhoneNumberAssignmentByProfileAssignResponse response = client.messaging10dlc().phoneNumberAssignmentByProfile().assign(params);
Get Assignment Task Status
Check the status of the task associated with assigning all phone numbers on a messaging profile to a campaign by taskId.
GET /10dlc/phoneNumberAssignmentByProfile/{taskId}
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileRetrieveStatusParams;
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileRetrieveStatusResponse;
PhoneNumberAssignmentByProfileRetrieveStatusResponse response = client.messaging10dlc().phoneNumberAssignmentByProfile().retrieveStatus("taskId");
Get Phone Number Status
Check the status of the individual phone number/campaign assignments associated with the supplied taskId.
GET /10dlc/phoneNumberAssignmentByProfile/{taskId}/phoneNumbers
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileListPhoneNumberStatusParams;
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileListPhoneNumberStatusResponse;
PhoneNumberAssignmentByProfileListPhoneNumberStatusResponse response = client.messaging10dlc().phoneNumberAssignmentByProfile().listPhoneNumberStatus("taskId");
Webhooks
The following webhook events are sent to your configured webhook URL.
All webhooks include telnyx-timestamp and telnyx-signature-ed25519 headers for verification (Standard Webhooks compatible).
| Event | Description |
|---|
campaignStatusUpdate | Campaign Status Update |