Update the messaging profile and/or messaging product of a phone number
Updates the messaging product, messaging profile, or both for the specified phone number.
PATCH
/
phone_numbers
/
{id}
/
messaging
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messaging = await client.phoneNumbers.messaging.update('id');
console.log(messaging.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
messaging = client.phone_numbers.messaging.update(
id="id",
)
print(messaging.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messaging, err := client.PhoneNumbers.Messaging.Update(
context.TODO(),
"id",
telnyx.PhoneNumberMessagingUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.messaging.MessagingUpdateParams;
import com.telnyx.sdk.models.phonenumbers.messaging.MessagingUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessagingUpdateResponse messaging = client.phoneNumbers().messaging().update("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
messaging = telnyx.phone_numbers.messaging.update("id")
puts(messaging)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$messaging = $client->phoneNumbers->messaging->update(
'id',
messagingProduct: 'P2P',
messagingProfileID: 'dd50eba1-a0c0-4563-9925-b25e842a7cb6',
tags: ['string'],
);
var_dump($messaging);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:messaging update \
--api-key 'My API Key' \
--id idcurl --request PATCH \
--url https://api.telnyx.com/v2/phone_numbers/{id}/messaging \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messaging_profile_id": "dd50eba1-a0c0-4563-9925-b25e842a7cb6",
"messaging_product": "P2P"
}
'{
"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": "tollfree",
"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
}
}
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "/data/attributes/phone_number",
"parameter": "string"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
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.
Configure the messaging profile this phone number is assigned to:
- Omit this field or set its value to
nullto 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
Configure the messaging product for this number:
- Omit this field or set its value to
nullto keep the current value. - Set this field to a quoted product ID to set this phone number to that product
Example:
"P2P"
Tags to set on this phone number.
Response
Successful response with details about a phone number including messaging settings.
Show child attributes
Show child attributes
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": "tollfree",
"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
}
}
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messaging = await client.phoneNumbers.messaging.update('id');
console.log(messaging.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
messaging = client.phone_numbers.messaging.update(
id="id",
)
print(messaging.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messaging, err := client.PhoneNumbers.Messaging.Update(
context.TODO(),
"id",
telnyx.PhoneNumberMessagingUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.messaging.MessagingUpdateParams;
import com.telnyx.sdk.models.phonenumbers.messaging.MessagingUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessagingUpdateResponse messaging = client.phoneNumbers().messaging().update("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
messaging = telnyx.phone_numbers.messaging.update("id")
puts(messaging)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$messaging = $client->phoneNumbers->messaging->update(
'id',
messagingProduct: 'P2P',
messagingProfileID: 'dd50eba1-a0c0-4563-9925-b25e842a7cb6',
tags: ['string'],
);
var_dump($messaging);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:messaging update \
--api-key 'My API Key' \
--id idcurl --request PATCH \
--url https://api.telnyx.com/v2/phone_numbers/{id}/messaging \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messaging_profile_id": "dd50eba1-a0c0-4563-9925-b25e842a7cb6",
"messaging_product": "P2P"
}
'{
"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": "tollfree",
"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
}
}
}{
"errors": [
{
"code": "string",
"title": "string",
"detail": "string",
"source": {
"pointer": "/data/attributes/phone_number",
"parameter": "string"
}
}
]
}