Skip to main content

Traffic Type

| cURL | Python | PHP | Node | Ruby | Portal |


cURL

Overview

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Managing Traffic Type Using the Telnyx API

Checking a TN's Current Traffic Type

To see what traffic a number is currently designated as via the API:


curl -X GET \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
"https://api.telnyx.com/v2/messaging_phone_numbers/{YOUR_MESSAGING_PHONE_NUMBER}"

Note: After pasting the above content, Kindly check and remove any new line added

Example Response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "P2P",
"messaging_product": "P2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": {}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Looking at the messaging_product will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an P2P number.

Requesting a traffic type change

You can confirm that you're number is eligible or changing messaging products by looking at eligible_messaging_products. In this case, the number is eligible for the P2P messaging product. So, we will be requesting a change from the A2P product to the P2P product.

curl -X PATCH \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--data '{"messaging_product":"P2P"}' \
"https://api.telnyx.com/v2/messaging_phone_numbers/{YOUR_MESSAGING_PHONE_NUMBER}"

Note: After pasting the above content, Kindly check and remove any new line added

Example response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "A2P",
"messaging_product": "A2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Note: that a few things have changed because of the messaging product change. The traffic_type is now P2P. This was what we intended to do. Note that we've also lost domestic two_way MMS support, but we've gained international_inbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.

Python

Overview

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Managing Traffic Type Using the Telnyx API

Checking a TN's Current Traffic Type

To see what traffic a number is currently designated as via the API:

import telnyx
telnyx.api_key = "API_KEY"

telnyx.MessagingPhoneNumbers.retrieve(
{
'phone_number': '+13125550001'
},

Note: After pasting the above content, Kindly check and remove any new line added

Example Response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "P2P",
"messaging_product": "P2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": {}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Looking at the messaging_product will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an P2P number.

Requesting a traffic type change

You can confirm that you're number is eligible or changing messaging products by looking at eligible_messaging_products. In this case, the number is eligible for the P2P messaging product. So, we will be requesting a change from the A2P product to the P2P product.

import telnyx
telnyx.api_key = "API_KEY"

res = telnyx.MessagingPhoneNumber.retrieve("+13125550001")
res.messaging_product = "P2P"

Note: After pasting the above content, Kindly check and remove any new line added

Example response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "A2P",
"messaging_product": "A2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Note: that a few things have changed because of the messaging product change. The traffic_type is now P2P. This was what we intended to do. Note that we've also lost domestic two_way MMS support, but we've gained international_inbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.

PHP

Overview

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Managing Traffic Type Using the Telnyx API

Checking a TN's current traffic type

To see what traffic a number is currently designated as via the API:

\Telnyx\Telnyx::setApiKey('YOUR_API_KEY_HERE');

$phoneNumber = \Telnyx\PhoneNumber::Retrieve("uuid");
$phoneNumber->messaging();

Note: After pasting the above content, Kindly check and remove any new line added

Example Response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "P2P",
"messaging_product": "P2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": {}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Looking at the messaging_product will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an P2P number.

Requesting a traffic type change

You can confirm that you're number is eligible or changing messaging products by looking at eligible_messaging_products. In this case, the number is eligible for the P2P messaging product. So, we will be requesting a change from the A2P product to the P2P product.

\Telnyx\Telnyx::setApiKey('YOUR_API_KEY_HERE');

$phoneNumber = \Telnyx\PhoneNumber::Retrieve("uuid");
$phoneNumber->update_messaging(["messaging_product" => "P2P"]);

Note: After pasting the above content, Kindly check and remove any new line added

Example response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "A2P",
"messaging_product": "A2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Note: that a few things have changed because of the messaging product change. The traffic_type is now P2P. This was what we intended to do. Note that we've also lost domestic two_way MMS support, but we've gained international_inbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.

Node

Overview

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Managing Traffic Type Using the Telnyx API

Checking a TN's Current Traffic Type

To see what traffic a number is currently designated as via the API:

telnyx.messagingPhoneNumbers.retrieve(
{
'phone_number': '+13125550001'
},
function(err, response) {
console.log(response);
}
);

Note: After pasting the above content, Kindly check and remove any new line added

Example Response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "P2P",
"messaging_product": "P2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": {}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Looking at the messaging_product will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an P2P number.

Requesting a traffic type change

You can confirm that you're number is eligible or changing messaging products by looking at eligible_messaging_products. In this case, the number is eligible for the P2P messaging product. So, we will be requesting a change from the A2P product to the P2P product.

curl -X PATCH \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--data '{"messaging_product":"P2P"}' \
"https://api.telnyx.com/v2/messaging_phone_numbers/{YOUR_MESSAGING_PHONE_NUMBER}"

Note: After pasting the above content, Kindly check and remove any new line added

Example response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "A2P",
"messaging_product": "A2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Note: that a few things have changed because of the messaging product change. The traffic_type is now P2P. This was what we intended to do. Note that we've also lost domestic two_way MMS support, but we've gained international_inbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.

Ruby

Overview

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Managing Traffic Type Using the Telnyx API

Checking a TN's Current Traffic Type

To see what traffic a number is currently designated as via the API:

require "telnyx"
Telnyx.api_key = "YOUR_API_KEY"

phone_number = Telnyx::PhoneNumber.retrieve("uuid")

Note: After pasting the above content, Kindly check and remove any new line added

Example Response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "P2P",
"messaging_product": "P2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": {}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Looking at the messaging_product will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an P2P number.

Requesting a traffic type change

You can confirm that you're number is eligible or changing messaging products by looking at eligible_messaging_products. In this case, the number is eligible for the P2P messaging product. So, we will be requesting a change from the A2P product to the P2P product.

require "telnyx"
Telnyx.api_key = "YOUR_API_KEY"

phone_number = Telnyx::PhoneNumber.retrieve("uuid")
phone_number.messaging_product = "P2P"

phone_number.save

Note: After pasting the above content, Kindly check and remove any new line added

Example response

{
"record_type": "messaging_phone_number",
"id": "1826003884872261711",
"phone_number": "+13125550001",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"messaging_profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"created_at": "2019-11-06T03:20:05.680Z",
"updated_at": "2019-11-06T03:20:05.680Z",
"country_code": "US",
"type": "longcode",
"traffic_type": "A2P",
"messaging_product": "A2P",
"health" : {
"message_count": 85,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.95,
"spam_ratio": 0.03
},
"eligible_messaging_products": ["A2P", "P2P"],
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Note: that a few things have changed because of the messaging product change. The traffic_type is now P2P. This was what we intended to do. Note that we've also lost domestic two_way MMS support, but we've gained international_inbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.

Portal

Overview of the traffic type feature

This feature allows a user to select if an eligible number will be routed to an end user as Application-to-Person (A2P) or Person-to-Person (P2P) traffic. Number eligibility is programatically determined by Telnyx based on the observed messaging use case over a specified period of time. All new numbers will initially be designated as A2P traffic until Telnyx has had sufficient time to monitor the traffic profile. If a number is deemed to be eligible for P2P traffic, users will have the option to update their number accordingly.

Features of P2P and A2P

Selecting a traffic type that aligns with the number's messaging use case will improve message deliverability. The P2P traffic type will also allow customers to send messages internationally — and at a different price than the A2P traffic type. Currently, MMS is only available with the the A2P Traffic Type.

Note: If you are sending a message internationally from an A2P enabled longcode, we will automatically fail over to alphanumeric routes using a generic SenderID.

Checking a TN's current traffic type

To see what messaging product a number is currently designated as in your Portal:

  1. Click on "Numbers" in the navigation menu on the left-hand side of the Telnyx Mission Control Portal.
  2. Find the number you want to check, and click on the Messaging Icon (SMS/Messaging).
  3. Depending on the current state of the number, there are a few things that you can see:
    • If the number is not currently messaging enabled (i.e., attached to a Messaging Profile), you'll see what the messaging product will be if the number were to be activated next to 'Traffic Type'.
    • If the number is currently messaging enabled, you will see the current messaging product next to 'Traffic Type'.

p2p messaging product

Requesting a traffic type change

If you would like to request a messaging product change via your Portal:

  1. Click on "Numbers" in the navigation menu on the left-hand side of the Telnyx Mission Control Portal.
  2. Find the number you want to request the change on, and click on the Messaging Icon (SMS/Messaging).
  3. If the radio buttons next 'Traffic Type' are grayed out, your TN is not currently eligible to change messaging products. If the buttons are not grayed out, simply check the other radio button and hit save and your number will be changed to the new messaging product type.

a2p messaging product

On this page