Traffic Type
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.
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 "x-api-token: YOUR_TELNYX_API_TOKEN" \
--header "x-api-user: YOUR_TELNYX_API_USER" \
"https://api.telnyx.com/messaging/numbers/{YOUR_PHONE_NUMBER}"
Note: After pasting the above content, Kindly check and remove any new line added
Example Response
{
"num": "+13125550001",
"user_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"last_updated": 1522097596060,
"country_code": null,
"campaign_id": null,
"num_country": "USA",
"traffic_type": "A2P",
"num_type": "tollfree",
"sms": {
"enabled": true,
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
},
"mms": {
"enabled": true,
"domestic_two_way": true,
"international_inbound": false,
"international_outbound": false
}
}
Note: After pasting the above content, Kindly check and remove any new line added
Looking at the traffic_type
will tell you what messaging product the number is currently registered on. In the above example, the phone number is registered as an A2P
number.
Requesting a Traffic Type Change
How to verify a TN is eligible for a traffic change, and how to request the change if it's eligible via the API:
curl -X GET \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-token: YOUR_TELNYX_API_TOKEN" \
--header "x-api-user: YOUR_TELNYX_API_USER" \
"https://api.telnyx.com/messaging/{YOUR_PHONE_NUMBER}/health"
Note: After pasting the above content, Kindly check and remove any new line added
Example Response
{
"data": {
"record_type": "number_health",
"phone_number": "+13125550001",
"message_count": 564,
"number_type": "long_code",
"organization_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.94,
"spam_ratio": 0,
"available_products": [
"A2P",
"P2P"
]
}
}
Note: After pasting the above content, Kindly check and remove any new line added
In this case, both messaging products are available for this number, so our requested product change is allowed.
Next we need to make the request to change the messaging product. 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 "x-api-token: YOUR_TELNYX_API_TOKEN" \
--header "x-api-user: YOUR_TELNYX_API_USER" \
--data '{"msg_product":"P2P"}' \
"https://api.telnyx.com/messaging/numbers/{YOUR_PHONE_NUMBER}"
Note: After pasting the above content, Kindly check and remove any new line added
Example Response
{
"num": "+13125550001",
"user_id": "a9b37e61-32bc-4a03-bf90-080c3b55db6f",
"profile_id": "16fd2706-8baf-433b-82eb-8c7fada847da",
"last_updated": 1522097596060,
"country_code": null,
"campaign_id": null,
"num_country": "USA",
"traffic_type": "P2P",
"num_type": "tollfree",
"sms": {
"enabled": true,
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": null
}
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 nowP2P
. This was what we intended to do. Note that we've also lost domestic twoway MMS support, but we've gained internationalinbound and international_outbound support for SMS. Changing messaging products may also affect the price per message sent/received.