Skip to main content
PATCH
/
phone_numbers
/
{id}
/
messaging
JavaScript
import Telnyx from 'telnyx';

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

const messaging = await client.phoneNumbers.messaging.update('id');

console.log(messaging.data);
{
  "data": {
    "record_type": "messaging_settings",
    "id": "1293384261075731499",
    "phone_number": "+18005550001",
    "messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "created_at": "2019-01-23T18:10:02.574Z",
    "updated_at": "2019-01-23T18:10:02.574Z",
    "country_code": "US",
    "type": "toll-free",
    "health": {
      "message_count": 122,
      "inbound_outbound_ratio": 0.43,
      "success_ratio": 0.94,
      "spam_ratio": 0.06
    },
    "eligible_messaging_products": [
      "A2P"
    ],
    "traffic_type": "A2P",
    "messaging_product": "A2P",
    "features": {
      "sms": {
        "domestic_two_way": true,
        "international_inbound": true,
        "international_outbound": true
      },
      "mms": null
    }
  }
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

The phone number to update.

Body

application/json

The new configuration to set for this phone number.

To avoid modifying a value, either omit the field or set its value to null.

messaging_profile_id
string

Configure the messaging profile this phone number is assigned to:

  • Omit this field or set its value to null to keep the current value.
  • Set this field to "" to unassign the number from its messaging profile
  • Set this field to a quoted UUID of a messaging profile to assign this number to that messaging profile
messaging_product
string

Configure the messaging product for this number:

  • Omit this field or set its value to null to keep the current value.
  • Set this field to a quoted product ID to set this phone number to that product
Example:

"P2P"

Response

Successful response with details about a phone number including messaging settings.

data
object
Example:
{
"record_type": "messaging_settings",
"id": "1293384261075731499",
"phone_number": "+18005550001",
"messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2019-01-23T18:10:02.574Z",
"updated_at": "2019-01-23T18:10:02.574Z",
"country_code": "US",
"type": "toll-free",
"health": {
"message_count": 122,
"inbound_outbound_ratio": 0.43,
"success_ratio": 0.94,
"spam_ratio": 0.06
},
"eligible_messaging_products": ["A2P"],
"traffic_type": "A2P",
"messaging_product": "A2P",
"features": {
"sms": {
"domestic_two_way": true,
"international_inbound": true,
"international_outbound": true
},
"mms": null
}
}