- name
- telnyx-10dlc-go
- 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 Go SDK examples.
- metadata
- {"author":"telnyx","product":"10dlc","language":"go","generated_by":"telnyx-ext-skills-generator"}
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
# Telnyx 10Dlc - Go
## Installation
```bash
go get github.com/team-telnyx/telnyx-go
```
## Setup
```go
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
```
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`
```go
page, err := client.Messaging10dlc.Brand.List(context.TODO(), telnyx.Messaging10dlcBrandListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create Brand
This endpoint is used to create a new brand.
`POST /10dlc/brand` — Required: `entityType`, `displayName`, `country`, `email`, `vertical`
```go
telnyxBrand, err := client.Messaging10dlc.Brand.New(context.TODO(), telnyx.Messaging10dlcBrandNewParams{
Country: "US",
DisplayName: "ABC Mobile",
Email: "email",
EntityType: telnyx.EntityTypePrivateProfit,
Vertical: telnyx.VerticalTechnology,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxBrand.IdentityStatus)
```
## Get Brand
Retrieve a brand by `brandId`.
`GET /10dlc/brand/{brandId}`
```go
brand, err := client.Messaging10dlc.Brand.Get(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", brand)
```
## Update Brand
Update a brand's attributes by `brandId`.
`PUT /10dlc/brand/{brandId}` — Required: `entityType`, `displayName`, `country`, `email`, `vertical`
```go
telnyxBrand, err := client.Messaging10dlc.Brand.Update(
context.TODO(),
"brandId",
telnyx.Messaging10dlcBrandUpdateParams{
Country: "US",
DisplayName: "ABC Mobile",
Email: "email",
EntityType: telnyx.EntityTypePrivateProfit,
Vertical: telnyx.VerticalTechnology,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxBrand.IdentityStatus)
```
## Delete Brand
Delete Brand.
`DELETE /10dlc/brand/{brandId}`
```go
err := client.Messaging10dlc.Brand.Delete(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
```
## Resend brand 2FA email
`POST /10dlc/brand/{brandId}/2faEmail`
```go
err := client.Messaging10dlc.Brand.Resend2faEmail(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
```
## List External Vettings
Get list of valid external vetting record for a given brand
`GET /10dlc/brand/{brandId}/externalVetting`
```go
externalVettings, err := client.Messaging10dlc.Brand.ExternalVetting.List(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", externalVettings)
```
## Order Brand External Vetting
Order new external vetting for a brand
`POST /10dlc/brand/{brandId}/externalVetting` — Required: `evpId`, `vettingClass`
```go
response, err := client.Messaging10dlc.Brand.ExternalVetting.Order(
context.TODO(),
"brandId",
telnyx.Messaging10dlcBrandExternalVettingOrderParams{
EvpID: "evpId",
VettingClass: "vettingClass",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.CreateDate)
```
## 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`
```go
response, err := client.Messaging10dlc.Brand.ExternalVetting.Imports(
context.TODO(),
"brandId",
telnyx.Messaging10dlcBrandExternalVettingImportsParams{
EvpID: "evpId",
VettingID: "vettingId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.CreateDate)
```
## Revet Brand
This operation allows you to revet the brand.
`PUT /10dlc/brand/{brandId}/revet`
```go
telnyxBrand, err := client.Messaging10dlc.Brand.Revet(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxBrand.IdentityStatus)
```
## 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`
```go
response, err := client.Messaging10dlc.Brand.GetSMSOtpStatus(context.TODO(), "4b20019b-043a-78f8-0657-b3be3f4b4002")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.BrandID)
```
## 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`
```go
response, err := client.Messaging10dlc.Brand.TriggerSMSOtp(
context.TODO(),
"4b20019b-043a-78f8-0657-b3be3f4b4002",
telnyx.Messaging10dlcBrandTriggerSMSOtpParams{
PinSMS: "Your PIN is @OTP_PIN@",
SuccessSMS: "Verification successful!",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.BrandID)
```
## Verify Brand SMS OTP
Verify the SMS OTP (One-Time Password) for Sole Proprietor brand verification.
`PUT /10dlc/brand/{brandId}/smsOtp` — Required: `otpPin`
```go
err := client.Messaging10dlc.Brand.VerifySMSOtp(
context.TODO(),
"4b20019b-043a-78f8-0657-b3be3f4b4002",
telnyx.Messaging10dlcBrandVerifySMSOtpParams{
OtpPin: "123456",
},
)
if err != nil {
panic(err.Error())
}
```
## Get Brand Feedback By Id
Get feedback about a brand by ID.
`GET /10dlc/brand_feedback/{brandId}`
```go
response, err := client.Messaging10dlc.Brand.GetFeedback(context.TODO(), "brandId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.BrandID)
```
## Submit Campaign
Before creating a campaign, use the [Qualify By Usecase endpoint](https://developers.telnyx.com/api-reference/campaign/qualify-by-usecase) to ensure that the brand you want to assign a new campaign...
`POST /10dlc/campaignBuilder` — Required: `brandId`, `description`, `usecase`
```go
telnyxCampaignCsp, err := client.Messaging10dlc.CampaignBuilder.Submit(context.TODO(), telnyx.Messaging10dlcCampaignBuilderSubmitParams{
BrandID: "brandId",
Description: "description",
Usecase: "usecase",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxCampaignCsp.BrandID)
```
## 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}`
```go
response, err := client.Messaging10dlc.CampaignBuilder.Brand.QualifyByUsecase(
context.TODO(),
"usecase",
telnyx.Messaging10dlcCampaignBuilderBrandQualifyByUsecaseParams{
BrandID: "brandId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AnnualFee)
```
## List Campaigns
Retrieve a list of campaigns associated with a supplied `brandId`.
`GET /10dlc/campaign`
```go
page, err := client.Messaging10dlc.Campaign.List(context.TODO(), telnyx.Messaging10dlcCampaignListParams{
BrandID: "brandId",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Get campaign
Retrieve campaign details by `campaignId`.
`GET /10dlc/campaign/{campaignId}`
```go
telnyxCampaignCsp, err := client.Messaging10dlc.Campaign.Get(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxCampaignCsp.BrandID)
```
## Update campaign
Update a campaign's properties by `campaignId`.
`PUT /10dlc/campaign/{campaignId}`
```go
telnyxCampaignCsp, err := client.Messaging10dlc.Campaign.Update(
context.TODO(),
"campaignId",
telnyx.Messaging10dlcCampaignUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", telnyxCampaignCsp.BrandID)
```
## Deactivate campaign
Terminate a campaign.
`DELETE /10dlc/campaign/{campaignId}`
```go
response, err := client.Messaging10dlc.Campaign.Deactivate(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Time)
```
## 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`
```go
response, err := client.Messaging10dlc.Campaign.SubmitAppeal(
context.TODO(),
"5eb13888-32b7-4cab-95e6-d834dde21d64",
telnyx.Messaging10dlcCampaignSubmitAppealParams{
AppealReason: "The website has been updated to include the required privacy policy and terms of service.",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.AppealedAt)
```
## Get Campaign Mno Metadata
Get the campaign metadata for each MNO it was submitted to.
`GET /10dlc/campaign/{campaignId}/mnoMetadata`
```go
response, err := client.Messaging10dlc.Campaign.GetMnoMetadata(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Number10999)
```
## Get campaign operation status
Retrieve campaign's operation status at MNO level.
`GET /10dlc/campaign/{campaignId}/operationStatus`
```go
response, err := client.Messaging10dlc.Campaign.GetOperationStatus(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
```
## Get OSR campaign attributes
`GET /10dlc/campaign/{campaignId}/osr_attributes`
```go
response, err := client.Messaging10dlc.Campaign.Osr.GetAttributes(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
```
## Get Sharing Status
`GET /10dlc/campaign/{campaignId}/sharing`
```go
response, err := client.Messaging10dlc.Campaign.GetSharingStatus(context.TODO(), "campaignId")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.SharedByMe)
```
## Accept Shared Campaign
Manually accept a campaign shared with Telnyx
`POST /10dlc/campaign/acceptSharing/{campaignId}`
```go
Ver no GitHub