Get Single Phone Number Campaign
Retrieve an individual phone number/campaign assignment by phoneNumber.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const phoneNumberCampaign = await client.messaging10dlc.phoneNumberCampaigns.retrieve(
'phoneNumber',
);
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
)
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.retrieve(
"phoneNumber",
)
print(phone_number_campaign.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"),
)
phoneNumberCampaign, err := client.Messaging10dlc.PhoneNumberCampaigns.Get(context.TODO(), "phoneNumber")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumberCampaign.CampaignID)
}
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.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().retrieve("phoneNumber");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
phone_number_campaign = telnyx.messaging_10dlc.phone_number_campaigns.retrieve("phoneNumber")
puts(phone_number_campaign)<?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 {
$phoneNumberCampaign = $client
->messaging10dlc
->phoneNumberCampaigns
->retrieve('phoneNumber');
var_dump($phoneNumberCampaign);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:phone-number-campaigns retrieve \
--api-key 'My API Key' \
--phone-number phoneNumbercurl --request GET \
--url https://api.telnyx.com/v2/10dlc/phone_number_campaigns/{phoneNumber} \
--header 'Authorization: Bearer <token>'{
"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>"
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "string",
"parameter": "string"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier of the phone number.
Response
Successful Response
"+18005550199"
For shared campaigns, this is the TCR campaign ID, otherwise it is the campaign ID
"2021-03-08T17:57:48.801186"
"2021-03-08T17:57:48.801186"
Brand ID. Empty if the number is associated to a shared campaign.
"7ba705b7-22af-493f-addc-ac04b7ca071c"
TCR's alphanumeric ID for the brand.
"BBRAND1"
TCR's alphanumeric ID for the campaign.
"CCAMPA1"
Campaign ID. Empty if the number is associated to a shared campaign.
"3008dd9f-66d7-40e0-bf23-bf2d8d1a96ba"
The assignment status of the number.
FAILED_ASSIGNMENT, PENDING_ASSIGNMENT, ASSIGNED, PENDING_UNASSIGNMENT, FAILED_UNASSIGNMENT "ASSIGNED"
The T-Mobile assignment status of the number.
"ADDED"
The assignment status of the number towards other carriers.
"ADDED"
Extra info about a failure to assign/unassign a number. Relevant only if the assignmentStatus is either FAILED_ASSIGNMENT or FAILED_UNASSIGNMENT
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const phoneNumberCampaign = await client.messaging10dlc.phoneNumberCampaigns.retrieve(
'phoneNumber',
);
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
)
phone_number_campaign = client.messaging_10dlc.phone_number_campaigns.retrieve(
"phoneNumber",
)
print(phone_number_campaign.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"),
)
phoneNumberCampaign, err := client.Messaging10dlc.PhoneNumberCampaigns.Get(context.TODO(), "phoneNumber")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumberCampaign.CampaignID)
}
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.PhoneNumberCampaign;
import com.telnyx.sdk.models.messaging10dlc.phonenumbercampaigns.PhoneNumberCampaignRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberCampaign phoneNumberCampaign = client.messaging10dlc().phoneNumberCampaigns().retrieve("phoneNumber");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
phone_number_campaign = telnyx.messaging_10dlc.phone_number_campaigns.retrieve("phoneNumber")
puts(phone_number_campaign)<?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 {
$phoneNumberCampaign = $client
->messaging10dlc
->phoneNumberCampaigns
->retrieve('phoneNumber');
var_dump($phoneNumberCampaign);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messaging-10dlc:phone-number-campaigns retrieve \
--api-key 'My API Key' \
--phone-number phoneNumbercurl --request GET \
--url https://api.telnyx.com/v2/10dlc/phone_number_campaigns/{phoneNumber} \
--header 'Authorization: Bearer <token>'{
"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>"
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "string",
"parameter": "string"
}
}
]
}