Skip to main content
POST
/
10dlc
/
phoneNumberAssignmentByProfile
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.messaging10dlc.phoneNumberAssignmentByProfile.assign({
  messagingProfileId: '4001767e-ce0f-4cae-9d5f-0d5e636e7809',
});

console.log(response.messagingProfileId);
import os
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.messaging_10dlc.phone_number_assignment_by_profile.assign(
messaging_profile_id="4001767e-ce0f-4cae-9d5f-0d5e636e7809",
)
print(response.messaging_profile_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"),
)
response, err := client.Messaging10dlc.PhoneNumberAssignmentByProfile.Assign(context.TODO(), telnyx.Messaging10dlcPhoneNumberAssignmentByProfileAssignParams{
MessagingProfileID: "4001767e-ce0f-4cae-9d5f-0d5e636e7809",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.MessagingProfileID)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileAssignParams;
import com.telnyx.sdk.models.messaging10dlc.phonenumberassignmentbyprofile.PhoneNumberAssignmentByProfileAssignResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

PhoneNumberAssignmentByProfileAssignParams params = PhoneNumberAssignmentByProfileAssignParams.builder()
.messagingProfileId("4001767e-ce0f-4cae-9d5f-0d5e636e7809")
.build();
PhoneNumberAssignmentByProfileAssignResponse response = client.messaging10dlc().phoneNumberAssignmentByProfile().assign(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.messaging_10dlc.phone_number_assignment_by_profile.assign(
messaging_profile_id: "4001767e-ce0f-4cae-9d5f-0d5e636e7809"
)

puts(response)
<?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 {
$response = $client->messaging10dlc->phoneNumberAssignmentByProfile->assign(
messagingProfileID: '4001767e-ce0f-4cae-9d5f-0d5e636e7809',
campaignID: '4b300178-131c-d902-d54e-72d90ba1620j',
tcrCampaignID: 'CWZTFH1',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx messaging-10dlc:phone-number-assignment-by-profile assign \
--api-key 'My API Key' \
--messaging-profile-id 4001767e-ce0f-4cae-9d5f-0d5e636e7809
curl --request POST \
--url https://api.telnyx.com/v2/10dlc/phoneNumberAssignmentByProfile \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messagingProfileId": "4001767e-ce0f-4cae-9d5f-0d5e636e7809",
"tcrCampaignId": "CWZTFH1",
"campaignId": "4b300178-131c-d902-d54e-72d90ba1620j"
}
'
{
  "messagingProfileId": "4001767e-ce0f-4cae-9d5f-0d5e636e7809",
  "taskId": "667a80f8-b0a9-49d0-b9ab-a7a1bcc45086",
  "tcrCampaignId": "CWZTFH1",
  "campaignId": "4b300178-131c-d902-d54e-72d90ba1620j"
}
{
"message": "<string>"
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
messagingProfileId
string
required

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

Example:

"4001767e-ce0f-4cae-9d5f-0d5e636e7809"

tcrCampaignId
string

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.

Example:

"CWZTFH1"

campaignId
string

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.

Example:

"4b300178-131c-d902-d54e-72d90ba1620j"

Response

Successful Response

messagingProfileId
string
required

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

Example:

"4001767e-ce0f-4cae-9d5f-0d5e636e7809"

taskId
string
required

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

Example:

"667a80f8-b0a9-49d0-b9ab-a7a1bcc45086"

tcrCampaignId
string

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.

Example:

"CWZTFH1"

campaignId
string

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.

Example:

"4b300178-131c-d902-d54e-72d90ba1620j"