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.
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-0d5e636e7809curl --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
Body
application/json
Response
Successful Response
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
});
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-0d5e636e7809curl --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"
}
}
]
}