List phone number campaigns
Returns phone-number-to-campaign assignments for the authenticated account. Apply the documented filters and pagination parameters to narrow the result set.
GET
/
10dlc
/
phone_number_campaigns
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const phoneNumberCampaign of client.messaging10dlc.phoneNumberCampaigns.list()) {
console.log(phoneNumberCampaign.campaignId);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.messaging_10dlc.phone_number_campaigns.list()
page = page.records[0]
print(page.campaign_id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Messaging10dlc.PhoneNumberCampaigns.List(context.TODO(), telnyx.Messaging10dlcPhoneNumberCampaignListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberCampaignListPage page = client.messaging10dlc().phoneNumberCampaigns().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.messaging_10dlc.phone_number_campaigns.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->messaging10dlc->phoneNumberCampaigns->list(
filter: [
'tcrBrandID' => 'BRANDID',
'tcrCampaignID' => 'CAMPID3',
'telnyxBrandID' => 'f3575e15-32ce-400e-a4c0-dd78800c20b0',
'telnyxCampaignID' => 'f3575e15-32ce-400e-a4c0-dd78800c20b0',
],
page: 0,
recordsPerPage: 0,
sort: 'assignmentStatus',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:phone-number-campaigns list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/10dlc/phone_number_campaigns \
--header 'Authorization: Bearer <token>'{
"records": [
{
"phoneNumber": "+18005550199",
"campaignId": "<string>",
"createdAt": "2021-03-08T17:57:48.801186",
"updatedAt": "2021-03-08T17:57:48.801186",
"brandId": "7ba705b7-22af-493f-addc-ac04b7ca071c",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMPA1",
"telnyxCampaignId": "3008dd9f-66d7-40e0-bf23-bf2d8d1a96ba",
"assignmentStatus": "ASSIGNED",
"tmobileNumberMappingStatus": "ADDED",
"nonTmobileNumberMappingStatus": "ADDED",
"failureReasons": "<string>"
}
],
"page": 123,
"totalRecords": 123
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "string",
"parameter": "string"
}
}
]
}Authorizations
Query Parameters
Specifies the sort order for results. If not given, results are sorted by createdAt in descending order. Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
Available options:
assignmentStatus, -assignmentStatus, createdAt, -createdAt, phoneNumber, -phoneNumber Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const phoneNumberCampaign of client.messaging10dlc.phoneNumberCampaigns.list()) {
console.log(phoneNumberCampaign.campaignId);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.messaging_10dlc.phone_number_campaigns.list()
page = page.records[0]
print(page.campaign_id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Messaging10dlc.PhoneNumberCampaigns.List(context.TODO(), telnyx.Messaging10dlcPhoneNumberCampaignListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListPage;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberCampaignListPage page = client.messaging10dlc().phoneNumberCampaigns().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.messaging_10dlc.phone_number_campaigns.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->messaging10dlc->phoneNumberCampaigns->list(
filter: [
'tcrBrandID' => 'BRANDID',
'tcrCampaignID' => 'CAMPID3',
'telnyxBrandID' => 'f3575e15-32ce-400e-a4c0-dd78800c20b0',
'telnyxCampaignID' => 'f3575e15-32ce-400e-a4c0-dd78800c20b0',
],
page: 0,
recordsPerPage: 0,
sort: 'assignmentStatus',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:phone-number-campaigns list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/10dlc/phone_number_campaigns \
--header 'Authorization: Bearer <token>'{
"records": [
{
"phoneNumber": "+18005550199",
"campaignId": "<string>",
"createdAt": "2021-03-08T17:57:48.801186",
"updatedAt": "2021-03-08T17:57:48.801186",
"brandId": "7ba705b7-22af-493f-addc-ac04b7ca071c",
"tcrBrandId": "BBRAND1",
"tcrCampaignId": "CCAMPA1",
"telnyxCampaignId": "3008dd9f-66d7-40e0-bf23-bf2d8d1a96ba",
"assignmentStatus": "ASSIGNED",
"tmobileNumberMappingStatus": "ADDED",
"nonTmobileNumberMappingStatus": "ADDED",
"failureReasons": "<string>"
}
],
"page": 123,
"totalRecords": 123
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "string",
"parameter": "string"
}
}
]
}