Skip to main content
POST
/
messaging_profiles
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const messagingProfile = await client.messagingProfiles.create({
  name: 'My name',
  whitelisted_destinations: ['US'],
});

console.log(messagingProfile.data);
{
  "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",
    "health_webhook_url": null,
    "mms_fall_back_to_sms": false,
    "mms_transcoding": false,
    "daily_spend_limit": "100.00",
    "daily_spend_limit_enabled": false,
    "redaction_enabled": false,
    "redaction_level": 2,
    "mobile_only": false
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

New Messaging Profile object

name
string
required

A user friendly name for the messaging profile.

whitelisted_destinations
string[]
required

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.

ISO 3166-1 alpha-2 country code.

enabled
boolean
default:true

Specifies whether the messaging profile is enabled or not.

webhook_url
string<url> | null
default:""

The URL where webhooks related to this messaging profile will be sent.

webhook_failover_url
string<url> | null
default:""

The failover URL where webhooks related to this messaging profile will be sent if sending to the primary URL fails.

webhook_api_version
enum<string>
default:2

Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 2010-04-01 format.

Available options:
1,
2,
2010-04-01
number_pool_settings
object | null

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.

Example:
{
"toll_free_weight": 10,
"long_code_weight": 1,
"skip_unhealthy": true,
"sticky_sender": false,
"geomatch": false
}
url_shortener_settings
object | null

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.

Example:
{
"domain": "example.ex",
"prefix": "",
"replace_blacklist_only": true,
"send_webhooks": false
}
alpha_sender
string | null

The alphanumeric sender ID to use when sending to destinations that require an alphanumeric sender ID.

daily_spend_limit
string

The maximum amount of money (in USD) that can be spent by this profile before midnight UTC.

daily_spend_limit_enabled
boolean

Whether to enforce the value configured by daily_spend_limit.

mms_fall_back_to_sms
boolean
default:false

enables SMS fallback for MMS messages.

mms_transcoding
boolean
default:false

enables automated resizing of MMS media.

mobile_only
boolean
default:false

Send messages only to mobile phone numbers.

Response

Successful response with details about a messaging profile.

data
object
Example:
{
"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",
"health_webhook_url": null,
"mms_fall_back_to_sms": false,
"mms_transcoding": false,
"daily_spend_limit": "100.00",
"daily_spend_limit_enabled": false,
"redaction_enabled": false,
"redaction_level": 2,
"mobile_only": false
}