Create a messaging profile
POST/messaging_profiles
Create a messaging profile
Request
- application/json
Body
required
New Messaging Profile object
A user friendly name for the messaging profile.
Possible values: Value must match regular expression ^[A-Z]{2}$
Destinations to which the messaging profile is allowed to send. The elements in the list must be valid ISO 3166-1 alpha-2 country codes. If set to ["*"]
all destinations will be allowed.
Default value: true
Specifies whether the messaging profile is enabled or not.
The URL where webhooks related to this messaging profile will be sent.
The failover URL where webhooks related to this messaging profile will be sent if sending to the primary URL fails.
Possible values: [1
, 2
, 2010-04-01
]
Default value: 2
Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 2010-04-01 format.
number_pool_settings
object
nullable
Number Pool allows you to send messages from a pool of numbers of different types, assigning weights to each type. The pool consists of all the long code and toll free numbers assigned to the messaging profile.
To disable this feature, set the object field to null
.
Defines the probability weight for a Toll Free number to be selected when sending a message. The higher the weight the higher the probability. The sum of the weights for all number types does not necessarily need to add to 100. Weight must be a non-negative number, and when equal to zero it will remove the number type from the pool.
Defines the probability weight for a Long Code number to be selected when sending a message. The higher the weight the higher the probability. The sum of the weights for all number types does not necessarily need to add to 100. Weight must be a non-negative number, and when equal to zero it will remove the number type from the pool.
If set to true all unhealthy numbers will be automatically excluded from the pool. Health metrics per number are calculated on a regular basis, taking into account the deliverability rate and the amount of messages marked as spam by upstream carriers. Numbers with a deliverability rate below 25% or spam ratio over 75% will be considered unhealthy.
If set to true, Number Pool will try to choose the same sending number for all messages to a particular
recipient. If the sending number becomes unhealthy and skip_unhealthy
is set to true, a new
number will be chosen.
If set to true, Number Pool will try to choose a sending number with the same area code as the destination number. If there are no such numbers available, a nunber with a different area code will be chosen. Currently only NANP numbers are supported.
url_shortener_settings
object
nullable
The URL shortener feature allows automatic replacement of URLs that were generated using a public URL shortener service. Some examples include bit.do, bit.ly, goo.gl, ht.ly, is.gd, ow.ly, rebrand.ly, t.co, tiny.cc, and tinyurl.com. Such URLs are replaced with with links generated by Telnyx. The use of custom links can improve branding and message deliverability.
To disable this feature, set the object field to null
.
One of the domains provided by the Telnyx URL shortener service.
Optional prefix that can be used to identify your brand, and will appear in the Telnyx generated URLs after the domain name.
Use the link replacement tool only for links that are specifically blacklisted by Telnyx.
Receive webhooks for when your replaced links are clicked. Webhooks are sent to the webhooks on the messaging profile.
Possible values: Value must match regular expression ^[A-Za-z0-9 ]{1,11}$
The alphanumeric sender ID to use when sending to destinations that require an alphanumeric sender ID.
Possible values: Value must match regular expression ^[0-9]+(?:\.[0-9]+)?$
The maximum amount of money (in USD) that can be spent by this profile before midnight UTC.
Whether to enforce the value configured by daily_spend_limit
.
Responses
200: Successful response with details about a messaging profile.
- application/json
default: Unexpected error
- application/json
Request samples
curl -L 'https://api.telnyx.com/v2/messaging_profiles' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"name": "My name",
"enabled": true,
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"webhook_api_version": "2",
"number_pool_settings": {
"toll_free_weight": 10,
"long_code_weight": 1,
"skip_unhealthy": true,
"sticky_sender": false,
"geomatch": false
},
"url_shortener_settings": {
"domain": "example.ex",
"prefix": "",
"replace_blacklist_only": true,
"send_webhooks": false
},
"whitelisted_destinations": [
"US"
]
}'
Response samples
{
"data": {
"record_type": "messaging_profile",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Profile for Messages",
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"enabled": true,
"webhook_api_version": "2",
"whitelisted_destinations": [
"US"
],
"created_at": "2019-01-23T18:10:02.574Z",
"updated_at": "2019-01-23T18:10:02.574Z",
"number_pool_settings": {
"toll_free_weight": 10,
"long_code_weight": 2,
"skip_unhealthy": false,
"sticky_sender": true,
"geomatch": false
},
"url_shortener_settings": {
"domain": "example.ex",
"prefix": "cmpny",
"replace_blacklist_only": true,
"send_webhooks": false
},
"v1_secret": "rP1VamejkU2v0qIUxntqLW2c"
}
}
{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "string",
"parameter": "string"
},
"meta": {}
}
]
}