Bulk Phone Number Campaigns API

Phone number campaign bulk assignment API

Assign Messaging Profile To Campaign

This endpoint allows you to link all phone numbers associated with a Messaging Profile to a campaign. Please note: if you want to assign phone numbers to a campaign that you did not create with Telnyx 10DLC services, this endpoint allows that provided that you've shared the campaign with Telnyx. In this case, only provide the parameter, tcrCampaignId, and not campaignId. In all other cases (where the campaign you're assigning was created with Telnyx 10DLC services), only provide campaignId, not tcrCampaignId.

SecuritybearerAuth
Request
Request Body schema: application/json
required
campaignId
string (Campaignid)

The ID of the campaign you want to link to the specified messaging profile. If you supply this ID in the request, do not also include a tcrCampaignId.

messagingProfileId
required
string (Messagingprofileid)

The ID of the messaging profile that you want to link to the specified campaign.

tcrCampaignId
string (Tcrcampaignid)

The TCR ID of the shared campaign you want to link to the specified messaging profile (for campaigns not created using Telnyx 10DLC services only). If you supply this ID in the request, do not also include a campaignId.

Responses
202

Successful Response

Response Schema: application/json
campaignId
string (Campaignid)

The ID of the campaign you want to link to the specified messaging profile. If you supply this ID in the request, do not also include a tcrCampaignId.

messagingProfileId
required
string (Messagingprofileid)

The ID of the messaging profile that you want to link to the specified campaign.

taskId
required
string (Taskid)

The ID of the task associated with assigning a messaging profile to a campaign.

tcrCampaignId
string (Tcrcampaignid)

The TCR ID of the shared campaign you want to link to the specified messaging profile (for campaigns not created using Telnyx 10DLC services only). If you supply this ID in the request, do not also include a campaignId.

post/phoneNumberAssignmentByProfile
Request samples
application/json
{
  • "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j",
  • "messagingProfileId": "4001767e-ce0f-4cae-9d5f-0d5e636e7809",
  • "tcrCampaignId": "CWZTFH1"
}
Response samples
application/json
{
  • "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j",
  • "messagingProfileId": "4001767e-ce0f-4cae-9d5f-0d5e636e7809",
  • "taskId": "667a80f8-b0a9-49d0-b9ab-a7a1bcc45086",
  • "tcrCampaignId": "CWZTFH1"
}

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.

SecuritybearerAuth
Request
path Parameters
taskId
required
string (Taskid)
Responses
200

Successful Response

Response Schema: application/json
createdAt
string <date-time> (Createdat)
status
required
string (TaskStatus)

The status of the task associated with assigning a messaging profile to a campaign.

Enum: "pending" "processing" "completed" "failed"
taskId
required
string (Taskid)
updatedAt
string <date-time> (Updatedat)
get/phoneNumberAssignmentByProfile/{taskId}
Request samples
# install http://docs.python-requests.org/en/master/
import requests

url = 'https://api.telnyx.com/10dlc/phoneNumberAssignmentByProfile/{taskId}'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer API_TOKEN'
}
response = requests.request('get', url, headers=headers)
print(response.text)
Response samples
application/json
{
  • "createdAt": "2019-08-24T14:15:22Z",
  • "status": "pending",
  • "taskId": "string",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

Get Phone Number Status

Check the status of the individual phone number/campaign assignments associated with the supplied taskId.

SecuritybearerAuth
Request
path Parameters
taskId
required
string (Taskid)
query Parameters
recordsPerPage
any (Recordsperpage)
Default: 20
page
any (Page)
Default: 1
Responses
200

Successful Response

Response Schema: application/json
required
Array of objects (Records)
Array
phoneNumber
required
string (Phonenumber)

The phone number that the status is being checked for.

status
required
string (Status)

The status of the associated phone number assignment.

taskId
required
string (Taskid)

The ID of the task associated with the phone number.

get/phoneNumberAssignmentByProfile/{taskId}/phoneNumbers
Request samples
# install http://docs.python-requests.org/en/master/
import requests

url = 'https://api.telnyx.com/10dlc/phoneNumberAssignmentByProfile/{taskId}/phoneNumbers'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer API_TOKEN'
}
response = requests.request('get', url, headers=headers)
print(response.text)
Response samples
application/json
{
  • "records": [
    • {
      • "phoneNumber": "+12024567890",
      • "status": "pending",
      • "taskId": "667a80f8-b0a9-49d0-b9ab-a7a1bcc45086"
      }
    ]
}