telnyx-10dlc-python

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 由Telnyx OpenAPI规范自动生成,请勿编辑。 -->

Telnyx 10Dlc - Python

Telnyx 10Dlc - Python

Installation

安装

bash
pip install telnyx
bash
pip install telnyx

Setup

初始化

python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
)
All examples below assume
client
is already initialized as shown above.
python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # 这是默认值,可省略
)
以下所有示例均假设
client
已按上述方式初始化完成。

List Brands

列出品牌

This endpoint is used to list all brands associated with your organization.
GET /10dlc/brand
python
page = client.messaging_10dlc.brand.list()
page = page.records[0]
print(page.identity_status)
该接口用于列出与您的组织关联的所有品牌。
GET /10dlc/brand
python
page = client.messaging_10dlc.brand.list()
page = page.records[0]
print(page.identity_status)

Create Brand

创建品牌

This endpoint is used to create a new brand.
POST /10dlc/brand
— Required:
entityType
,
displayName
,
country
,
email
,
vertical
Optional:
businessContactEmail
(string),
city
(string),
companyName
(string),
ein
(string),
firstName
(string),
ipAddress
(string),
isReseller
(boolean),
lastName
(string),
mobilePhone
(string),
mock
(boolean),
phone
(string),
postalCode
(string),
state
(string),
stockExchange
(object),
stockSymbol
(string),
street
(string),
webhookFailoverURL
(string),
webhookURL
(string),
website
(string)
python
telnyx_brand = client.messaging_10dlc.brand.create(
    country="US",
    display_name="ABC Mobile",
    email="email",
    entity_type="PRIVATE_PROFIT",
    vertical="TECHNOLOGY",
)
print(telnyx_brand.identity_status)
该接口用于创建新品牌。
POST /10dlc/brand
— 必填:
entityType
,
displayName
,
country
,
email
,
vertical
可选:
businessContactEmail
(字符串),
city
(字符串),
companyName
(字符串),
ein
(字符串),
firstName
(字符串),
ipAddress
(字符串),
isReseller
(布尔值),
lastName
(字符串),
mobilePhone
(字符串),
mock
(布尔值),
phone
(字符串),
postalCode
(字符串),
state
(字符串),
stockExchange
(对象),
stockSymbol
(字符串),
street
(字符串),
webhookFailoverURL
(字符串),
webhookURL
(字符串),
website
(字符串)
python
telnyx_brand = client.messaging_10dlc.brand.create(
    country="US",
    display_name="ABC Mobile",
    email="email",
    entity_type="PRIVATE_PROFIT",
    vertical="TECHNOLOGY",
)
print(telnyx_brand.identity_status)

Get Brand

获取品牌

Retrieve a brand by
brandId
.
GET /10dlc/brand/{brandId}
python
brand = client.messaging_10dlc.brand.retrieve(
    "brandId",
)
print(brand)
通过
brandId
检索品牌信息。
GET /10dlc/brand/{brandId}
python
brand = client.messaging_10dlc.brand.retrieve(
    "brandId",
)
print(brand)

Update Brand

更新品牌

Update a brand's attributes by
brandId
.
PUT /10dlc/brand/{brandId}
— Required:
entityType
,
displayName
,
country
,
email
,
vertical
Optional:
altBusinessId
(string),
altBusinessIdType
(enum),
businessContactEmail
(string),
city
(string),
companyName
(string),
ein
(string),
firstName
(string),
identityStatus
(enum),
ipAddress
(string),
isReseller
(boolean),
lastName
(string),
phone
(string),
postalCode
(string),
state
(string),
stockExchange
(object),
stockSymbol
(string),
street
(string),
webhookFailoverURL
(string),
webhookURL
(string),
website
(string)
python
telnyx_brand = client.messaging_10dlc.brand.update(
    brand_id="brandId",
    country="US",
    display_name="ABC Mobile",
    email="email",
    entity_type="PRIVATE_PROFIT",
    vertical="TECHNOLOGY",
)
print(telnyx_brand.identity_status)
通过
brandId
更新品牌属性。
PUT /10dlc/brand/{brandId}
— 必填:
entityType
,
displayName
,
country
,
email
,
vertical
可选:
altBusinessId
(字符串),
altBusinessIdType
(枚举),
businessContactEmail
(字符串),
city
(字符串),
companyName
(字符串),
ein
(字符串),
firstName
(字符串),
identityStatus
(枚举),
ipAddress
(字符串),
isReseller
(布尔值),
lastName
(字符串),
phone
(字符串),
postalCode
(字符串),
state
(字符串),
stockExchange
(对象),
stockSymbol
(字符串),
street
(字符串),
webhookFailoverURL
(字符串),
webhookURL
(字符串),
website
(字符串)
python
telnyx_brand = client.messaging_10dlc.brand.update(
    brand_id="brandId",
    country="US",
    display_name="ABC Mobile",
    email="email",
    entity_type="PRIVATE_PROFIT",
    vertical="TECHNOLOGY",
)
print(telnyx_brand.identity_status)

Delete Brand

删除品牌

Delete Brand.
DELETE /10dlc/brand/{brandId}
python
client.messaging_10dlc.brand.delete(
    "brandId",
)
删除品牌。
DELETE /10dlc/brand/{brandId}
python
client.messaging_10dlc.brand.delete(
    "brandId",
)

Resend brand 2FA email

重新发送品牌2FA邮件

POST /10dlc/brand/{brandId}/2faEmail
python
client.messaging_10dlc.brand.resend_2fa_email(
    "brandId",
)
POST /10dlc/brand/{brandId}/2faEmail
python
client.messaging_10dlc.brand.resend_2fa_email(
    "brandId",
)

List External Vettings

列出外部审核记录

Get list of valid external vetting record for a given brand
GET /10dlc/brand/{brandId}/externalVetting
python
external_vettings = client.messaging_10dlc.brand.external_vetting.list(
    "brandId",
)
print(external_vettings)
获取指定品牌的有效外部审核记录列表
GET /10dlc/brand/{brandId}/externalVetting
python
external_vettings = client.messaging_10dlc.brand.external_vetting.list(
    "brandId",
)
print(external_vettings)

Order Brand External Vetting

订购品牌外部审核

Order new external vetting for a brand
POST /10dlc/brand/{brandId}/externalVetting
— Required:
evpId
,
vettingClass
python
response = client.messaging_10dlc.brand.external_vetting.order(
    brand_id="brandId",
    evp_id="evpId",
    vetting_class="vettingClass",
)
print(response.create_date)
为品牌订购新的外部审核
POST /10dlc/brand/{brandId}/externalVetting
— 必填:
evpId
,
vettingClass
python
response = client.messaging_10dlc.brand.external_vetting.order(
    brand_id="brandId",
    evp_id="evpId",
    vetting_class="vettingClass",
)
print(response.create_date)

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
Optional:
vettingToken
(string)
python
response = client.messaging_10dlc.brand.external_vetting.imports(
    brand_id="brandId",
    evp_id="evpId",
    vetting_id="vettingId",
)
print(response.create_date)
该操作可用于从TCR认证的审核提供商导入外部审核记录。
PUT /10dlc/brand/{brandId}/externalVetting
— 必填:
evpId
,
vettingId
可选:
vettingToken
(字符串)
python
response = client.messaging_10dlc.brand.external_vetting.imports(
    brand_id="brandId",
    evp_id="evpId",
    vetting_id="vettingId",
)
print(response.create_date)

Revet Brand

重新审核品牌

This operation allows you to revet the brand.
PUT /10dlc/brand/{brandId}/revet
python
telnyx_brand = client.messaging_10dlc.brand.revet(
    "brandId",
)
print(telnyx_brand.identity_status)
该操作允许您重新审核品牌。
PUT /10dlc/brand/{brandId}/revet
python
telnyx_brand = client.messaging_10dlc.brand.revet(
    "brandId",
)
print(telnyx_brand.identity_status)

Get Brand SMS OTP Status by Brand ID

通过品牌ID获取品牌短信OTP状态

Query the status of an SMS OTP (One-Time Password) for Sole Proprietor brand verification using the Brand ID.
GET /10dlc/brand/{brandId}/smsOtp
python
response = client.messaging_10dlc.brand.retrieve_sms_otp_status(
    "4b20019b-043a-78f8-0657-b3be3f4b4002",
)
print(response.brand_id)
使用品牌ID查询个体经营者品牌验证的短信OTP(一次性密码)状态。
GET /10dlc/brand/{brandId}/smsOtp
python
response = client.messaging_10dlc.brand.retrieve_sms_otp_status(
    "4b20019b-043a-78f8-0657-b3be3f4b4002",
)
print(response.brand_id)

Trigger Brand SMS OTP

触发品牌短信OTP

Trigger or re-trigger an SMS OTP (One-Time Password) for Sole Proprietor brand verification.
POST /10dlc/brand/{brandId}/smsOtp
— Required:
pinSms
,
successSms
python
response = client.messaging_10dlc.brand.trigger_sms_otp(
    brand_id="4b20019b-043a-78f8-0657-b3be3f4b4002",
    pin_sms="Your PIN is @OTP_PIN@",
    success_sms="Verification successful!",
)
print(response.brand_id)
触发或重新触发个体经营者品牌验证的短信OTP(一次性密码)。
POST /10dlc/brand/{brandId}/smsOtp
— 必填:
pinSms
,
successSms
python
response = client.messaging_10dlc.brand.trigger_sms_otp(
    brand_id="4b20019b-043a-78f8-0657-b3be3f4b4002",
    pin_sms="Your PIN is @OTP_PIN@",
    success_sms="Verification successful!",
)
print(response.brand_id)

Verify Brand SMS OTP

验证品牌短信OTP

Verify the SMS OTP (One-Time Password) for Sole Proprietor brand verification.
PUT /10dlc/brand/{brandId}/smsOtp
— Required:
otpPin
python
client.messaging_10dlc.brand.verify_sms_otp(
    brand_id="4b20019b-043a-78f8-0657-b3be3f4b4002",
    otp_pin="123456",
)
验证个体经营者品牌验证的短信OTP(一次性密码)。
PUT /10dlc/brand/{brandId}/smsOtp
— 必填:
otpPin
python
client.messaging_10dlc.brand.verify_sms_otp(
    brand_id="4b20019b-043a-78f8-0657-b3be3f4b4002",
    otp_pin="123456",
)

Get Brand SMS OTP Status

获取品牌短信OTP状态

Query the status of an SMS OTP (One-Time Password) for Sole Proprietor brand verification.
GET /10dlc/brand/smsOtp/{referenceId}
python
response = client.messaging_10dlc.brand.get_sms_otp_by_reference(
    reference_id="OTP4B2001",
)
print(response.brand_id)
查询个体经营者品牌验证的短信OTP(一次性密码)状态。
GET /10dlc/brand/smsOtp/{referenceId}
python
response = client.messaging_10dlc.brand.get_sms_otp_by_reference(
    reference_id="OTP4B2001",
)
print(response.brand_id)

Get Brand Feedback By Id

通过ID获取品牌反馈

Get feedback about a brand by ID.
GET /10dlc/brand_feedback/{brandId}
python
response = client.messaging_10dlc.brand.get_feedback(
    "brandId",
)
print(response.brand_id)
通过ID获取品牌相关反馈。
GET /10dlc/brand_feedback/{brandId}
python
response = client.messaging_10dlc.brand.get_feedback(
    "brandId",
)
print(response.brand_id)

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
Optional:
ageGated
(boolean),
autoRenewal
(boolean),
directLending
(boolean),
embeddedLink
(boolean),
embeddedLinkSample
(string),
embeddedPhone
(boolean),
helpKeywords
(string),
helpMessage
(string),
messageFlow
(string),
mnoIds
(array[integer]),
numberPool
(boolean),
optinKeywords
(string),
optinMessage
(string),
optoutKeywords
(string),
optoutMessage
(string),
privacyPolicyLink
(string),
referenceId
(string),
resellerId
(string),
sample1
(string),
sample2
(string),
sample3
(string),
sample4
(string),
sample5
(string),
subUsecases
(array[string]),
subscriberHelp
(boolean),
subscriberOptin
(boolean),
subscriberOptout
(boolean),
tag
(array[string]),
termsAndConditions
(boolean),
termsAndConditionsLink
(string),
webhookFailoverURL
(string),
webhookURL
(string)
python
telnyx_campaign_csp = client.messaging_10dlc.campaign_builder.submit(
    brand_id="brandId",
    description="description",
    usecase="usecase",
)
print(telnyx_campaign_csp.brand_id)
创建活动前,请使用按用例资格验证接口确保您要分配新活动的品牌...
POST /10dlc/campaignBuilder
— 必填:
brandId
,
description
,
usecase
可选:
ageGated
(布尔值),
autoRenewal
(布尔值),
directLending
(布尔值),
embeddedLink
(布尔值),
embeddedLinkSample
(字符串),
embeddedPhone
(布尔值),
helpKeywords
(字符串),
helpMessage
(字符串),
messageFlow
(字符串),
mnoIds
(整数数组),
numberPool
(布尔值),
optinKeywords
(字符串),
optinMessage
(字符串),
optoutKeywords
(字符串),
optoutMessage
(字符串),
privacyPolicyLink
(字符串),
referenceId
(字符串),
resellerId
(字符串),
sample1
(字符串),
sample2
(字符串),
sample3
(字符串),
sample4
(字符串),
sample5
(字符串),
subUsecases
(字符串数组),
subscriberHelp
(布尔值),
subscriberOptin
(布尔值),
subscriberOptout
(布尔值),
tag
(字符串数组),
termsAndConditions
(布尔值),
termsAndConditionsLink
(字符串),
webhookFailoverURL
(字符串),
webhookURL
(字符串)
python
telnyx_campaign_csp = client.messaging_10dlc.campaign_builder.submit(
    brand_id="brandId",
    description="description",
    usecase="usecase",
)
print(telnyx_campaign_csp.brand_id)

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}
python
response = client.messaging_10dlc.campaign_builder.brand.qualify_by_usecase(
    usecase="usecase",
    brand_id="brandId",
)
print(response.annual_fee)
该接口可让您查看提供的品牌是否适合您所需的活动用例。
GET /10dlc/campaignBuilder/brand/{brandId}/usecase/{usecase}
python
response = client.messaging_10dlc.campaign_builder.brand.qualify_by_usecase(
    usecase="usecase",
    brand_id="brandId",
)
print(response.annual_fee)

List Campaigns

列出活动

Retrieve a list of campaigns associated with a supplied
brandId
.
GET /10dlc/campaign
python
page = client.messaging_10dlc.campaign.list(
    brand_id="brandId",
)
page = page.records[0]
print(page.age_gated)
检索与指定
brandId
关联的活动列表。
GET /10dlc/campaign
python
page = client.messaging_10dlc.campaign.list(
    brand_id="brandId",
)
page = page.records[0]
print(page.age_gated)

Get campaign

获取活动详情

Retrieve campaign details by
campaignId
.
GET /10dlc/campaign/{campaignId}
python
telnyx_campaign_csp = client.messaging_10dlc.campaign.retrieve(
    "campaignId",
)
print(telnyx_campaign_csp.brand_id)
通过
campaignId
检索活动详情。
GET /10dlc/campaign/{campaignId}
python
telnyx_campaign_csp = client.messaging_10dlc.campaign.retrieve(
    "campaignId",
)
print(telnyx_campaign_csp.brand_id)

Update campaign

更新活动

Update a campaign's properties by
campaignId
.
PUT /10dlc/campaign/{campaignId}
Optional:
autoRenewal
(boolean),
helpMessage
(string),
messageFlow
(string),
resellerId
(string),
sample1
(string),
sample2
(string),
sample3
(string),
sample4
(string),
sample5
(string),
webhookFailoverURL
(string),
webhookURL
(string)
python
telnyx_campaign_csp = client.messaging_10dlc.campaign.update(
    campaign_id="campaignId",
)
print(telnyx_campaign_csp.brand_id)
通过
campaignId
更新活动属性。
PUT /10dlc/campaign/{campaignId}
可选:
autoRenewal
(布尔值),
helpMessage
(字符串),
messageFlow
(字符串),
resellerId
(字符串),
sample1
(字符串),
sample2
(字符串),
sample3
(字符串),
sample4
(字符串),
sample5
(字符串),
webhookFailoverURL
(字符串),
webhookURL
(字符串)
python
telnyx_campaign_csp = client.messaging_10dlc.campaign.update(
    campaign_id="campaignId",
)
print(telnyx_campaign_csp.brand_id)

Deactivate campaign

停用活动

Terminate a campaign.
DELETE /10dlc/campaign/{campaignId}
python
response = client.messaging_10dlc.campaign.deactivate(
    "campaignId",
)
print(response.time)
终止活动。
DELETE /10dlc/campaign/{campaignId}
python
response = client.messaging_10dlc.campaign.deactivate(
    "campaignId",
)
print(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
python
response = client.messaging_10dlc.campaign.submit_appeal(
    campaign_id="5eb13888-32b7-4cab-95e6-d834dde21d64",
    appeal_reason="The website has been updated to include the required privacy policy and terms of service.",
)
print(response.appealed_at)
针对状态为TELNYX_FAILED或MNO_REJECTED的未通过本地活动提交申诉。
POST /10dlc/campaign/{campaignId}/appeal
— 必填:
appeal_reason
python
response = client.messaging_10dlc.campaign.submit_appeal(
    campaign_id="5eb13888-32b7-4cab-95e6-d834dde21d64",
    appeal_reason="The website has been updated to include the required privacy policy and terms of service.",
)
print(response.appealed_at)

Get Campaign Mno Metadata

获取活动MNO元数据

Get the campaign metadata for each MNO it was submitted to.
GET /10dlc/campaign/{campaignId}/mnoMetadata
python
response = client.messaging_10dlc.campaign.get_mno_metadata(
    "campaignId",
)
print(response._10999)
获取活动提交给各MNO的元数据。
GET /10dlc/campaign/{campaignId}/mnoMetadata
python
response = client.messaging_10dlc.campaign.get_mno_metadata(
    "campaignId",
)
print(response._10999)

Get campaign operation status

获取活动操作状态

Retrieve campaign's operation status at MNO level.
GET /10dlc/campaign/{campaignId}/operationStatus
python
response = client.messaging_10dlc.campaign.get_operation_status(
    "campaignId",
)
print(response)
检索活动在MNO层面的操作状态。
GET /10dlc/campaign/{campaignId}/operationStatus
python
response = client.messaging_10dlc.campaign.get_operation_status(
    "campaignId",
)
print(response)

Get OSR campaign attributes

获取OSR活动属性

GET /10dlc/campaign/{campaignId}/osr_attributes
python
response = client.messaging_10dlc.campaign.osr.get_attributes(
    "campaignId",
)
print(response)
GET /10dlc/campaign/{campaignId}/osr_attributes
python
response = client.messaging_10dlc.campaign.osr.get_attributes(
    "campaignId",
)
print(response)

Get Sharing Status

获取共享状态

GET /10dlc/campaign/{campaignId}/sharing
python
response = client.messaging_10dlc.campaign.get_sharing_status(
    "campaignId",
)
print(response.shared_by_me)
GET /10dlc/campaign/{campaignId}/sharing
python
response = client.messaging_10dlc.campaign.get_sharing_status(
    "campaignId",
)
print(response.shared_by_me)

Accept Shared Campaign

接受共享活动

Manually accept a campaign shared with Telnyx
POST /10dlc/campaign/acceptSharing/{campaignId}
python
response = client.messaging_10dlc.campaign.accept_sharing(
    "C26F1KLZN",
)
print(response)
手动接受与Telnyx共享的活动
POST /10dlc/campaign/acceptSharing/{campaignId}
python
response = client.messaging_10dlc.campaign.accept_sharing(
    "C26F1KLZN",
)
print(response)

Get Campaign Cost

获取活动成本

GET /10dlc/campaign/usecase_cost
python
response = client.messaging_10dlc.campaign.usecase.get_cost(
    usecase="usecase",
)
print(response.campaign_usecase)
GET /10dlc/campaign/usecase_cost
python
response = client.messaging_10dlc.campaign.usecase.get_cost(
    usecase="usecase",
)
print(response.campaign_usecase)

List Shared Campaigns

列出共享活动

Retrieve all partner campaigns you have shared to Telnyx in a paginated fashion.
GET /10dlc/partner_campaigns
python
page = client.messaging_10dlc.partner_campaigns.list()
page = page.records[0]
print(page.tcr_brand_id)
以分页方式检索您共享给Telnyx的所有合作伙伴活动。
GET /10dlc/partner_campaigns
python
page = client.messaging_10dlc.partner_campaigns.list()
page = page.records[0]
print(page.tcr_brand_id)

Get Single Shared Campaign

获取单个共享活动

Retrieve campaign details by
campaignId
.
GET /10dlc/partner_campaigns/{campaignId}
python
telnyx_downstream_campaign = client.messaging_10dlc.partner_campaigns.retrieve(
    "campaignId",
)
print(telnyx_downstream_campaign.tcr_brand_id)
通过
campaignId
检索活动详情。
GET /10dlc/partner_campaigns/{campaignId}
python
telnyx_downstream_campaign = client.messaging_10dlc.partner_campaigns.retrieve(
    "campaignId",
)
print(telnyx_downstream_campaign.tcr_brand_id)

Update Single Shared Campaign

更新单个共享活动

Update campaign details by
campaignId
.
PATCH /10dlc/partner_campaigns/{campaignId}
Optional:
webhookFailoverURL
(string),
webhookURL
(string)
python
telnyx_downstream_campaign = client.messaging_10dlc.partner_campaigns.update(
    campaign_id="campaignId",
)
print(telnyx_downstream_campaign.tcr_brand_id)
通过
campaignId
更新活动详情。
PATCH /10dlc/partner_campaigns/{campaignId}
可选:
webhookFailoverURL
(字符串),
webhookURL
(字符串)
python
telnyx_downstream_campaign = client.messaging_10dlc.partner_campaigns.update(
    campaign_id="campaignId",
)
print(telnyx_downstream_campaign.tcr_brand_id)

Get Sharing Status

获取共享状态

GET /10dlc/partnerCampaign/{campaignId}/sharing
python
response = client.messaging_10dlc.partner_campaigns.retrieve_sharing_status(
    "campaignId",
)
print(response)
GET /10dlc/partnerCampaign/{campaignId}/sharing
python
response = client.messaging_10dlc.partner_campaigns.retrieve_sharing_status(
    "campaignId",
)
print(response)

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
python
page = client.messaging_10dlc.partner_campaigns.list_shared_by_me()
page = page.records[0]
print(page.brand_id)
以分页方式获取您共享给Telnyx的所有合作伙伴活动
目前该接口仅返回Telnyx已接受的共享活动。
GET /10dlc/partnerCampaign/sharedByMe
python
page = client.messaging_10dlc.partner_campaigns.list_shared_by_me()
page = page.records[0]
print(page.brand_id)

List phone number campaigns

列出电话号码活动关联

GET /10dlc/phone_number_campaigns
python
page = client.messaging_10dlc.phone_number_campaigns.list()
page = page.records[0]
print(page.campaign_id)
GET /10dlc/phone_number_campaigns
python
page = client.messaging_10dlc.phone_number_campaigns.list()
page = page.records[0]
print(page.campaign_id)

Create New Phone Number Campaign

创建新的电话号码活动关联

POST /10dlc/phone_number_campaigns
— Required:
phoneNumber
,
campaignId
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.create(
    campaign_id="4b300178-131c-d902-d54e-72d90ba1620j",
    phone_number="+18005550199",
)
print(phone_number_campaign.campaign_id)
POST /10dlc/phone_number_campaigns
— 必填:
phoneNumber
,
campaignId
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.create(
    campaign_id="4b300178-131c-d902-d54e-72d90ba1620j",
    phone_number="+18005550199",
)
print(phone_number_campaign.campaign_id)

Get Single Phone Number Campaign

获取单个电话号码活动关联

Retrieve an individual phone number/campaign assignment by
phoneNumber
.
GET /10dlc/phone_number_campaigns/{phoneNumber}
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.retrieve(
    "phoneNumber",
)
print(phone_number_campaign.campaign_id)
通过
phoneNumber
检索单个电话号码/活动关联信息。
GET /10dlc/phone_number_campaigns/{phoneNumber}
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.retrieve(
    "phoneNumber",
)
print(phone_number_campaign.campaign_id)

Create New Phone Number Campaign

更新电话号码活动关联

PUT /10dlc/phone_number_campaigns/{phoneNumber}
— Required:
phoneNumber
,
campaignId
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.update(
    campaign_phone_number="phoneNumber",
    campaign_id="4b300178-131c-d902-d54e-72d90ba1620j",
    phone_number="+18005550199",
)
print(phone_number_campaign.campaign_id)
PUT /10dlc/phone_number_campaigns/{phoneNumber}
— 必填:
phoneNumber
,
campaignId
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.update(
    campaign_phone_number="phoneNumber",
    campaign_id="4b300178-131c-d902-d54e-72d90ba1620j",
    phone_number="+18005550199",
)
print(phone_number_campaign.campaign_id)

Delete Phone Number Campaign

删除电话号码活动关联

This endpoint allows you to remove a campaign assignment from the supplied
phoneNumber
.
DELETE /10dlc/phone_number_campaigns/{phoneNumber}
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.delete(
    "phoneNumber",
)
print(phone_number_campaign.campaign_id)
该接口允许您移除指定
phoneNumber
的活动关联。
DELETE /10dlc/phone_number_campaigns/{phoneNumber}
python
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.delete(
    "phoneNumber",
)
print(phone_number_campaign.campaign_id)

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
Optional:
campaignId
(string),
tcrCampaignId
(string)
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.assign(
    messaging_profile_id="4001767e-ce0f-4cae-9d5f-0d5e636e7809",
)
print(response.messaging_profile_id)
该接口允许您将消息配置文件关联的所有电话号码链接到某个活动。
POST /10dlc/phoneNumberAssignmentByProfile
— 必填:
messagingProfileId
可选:
campaignId
(字符串),
tcrCampaignId
(字符串)
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.assign(
    messaging_profile_id="4001767e-ce0f-4cae-9d5f-0d5e636e7809",
)
print(response.messaging_profile_id)

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}
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.retrieve_status(
    "taskId",
)
print(response.status)
通过
taskId
检查将消息配置文件下所有电话号码分配到活动的任务状态。
GET /10dlc/phoneNumberAssignmentByProfile/{taskId}
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.retrieve_status(
    "taskId",
)
print(response.status)

Get Phone Number Status

获取电话号码状态

Check the status of the individual phone number/campaign assignments associated with the supplied
taskId
.
GET /10dlc/phoneNumberAssignmentByProfile/{taskId}/phoneNumbers
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.list_phone_number_status(
    task_id="taskId",
)
print(response.records)

检查与指定
taskId
关联的单个电话号码/活动分配的状态。
GET /10dlc/phoneNumberAssignmentByProfile/{taskId}/phoneNumbers
python
response = client.messaging_10dlc.phone_number_assignment_by_profile.list_phone_number_status(
    task_id="taskId",
)
print(response.records)

Webhooks

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).
EventDescription
campaignStatusUpdate
Campaign Status Update
以下Webhook事件将发送到您配置的Webhook URL。 所有Webhook均包含
telnyx-timestamp
telnyx-signature-ed25519
头信息用于验证(兼容标准Webhooks)。
事件描述
campaignStatusUpdate
活动状态更新

Webhook payload fields

Webhook 负载字段

campaignStatusUpdate
FieldTypeDescription
brandId
stringBrand ID associated with the campaign.
campaignId
stringThe ID of the campaign.
createDate
stringUnix timestamp when campaign was created.
cspId
stringAlphanumeric identifier of the CSP associated with this campaign.
isTMobileRegistered
booleanIndicates whether the campaign is registered with T-Mobile.
type
enum
description
stringDescription of the event.
status
enumThe status of the campaign.
campaignStatusUpdate
字段类型描述
brandId
字符串与活动关联的品牌ID。
campaignId
字符串活动的ID。
createDate
字符串活动创建时的Unix时间戳。
cspId
字符串与该活动关联的CSP的字母数字标识符。
isTMobileRegistered
布尔值表示活动是否已在T-Mobile注册。
type
枚举
description
字符串事件的描述。
status
枚举活动的状态。