Update Connection ID for a WhatsApp Calling BYON number
Set or clear the connection ID for a WhatsApp Calling BYON (Bring Your Own Number) phone number: the connection that inbound WhatsApp calls to the number are delivered to.
The update is processed asynchronously. A 202 response means the request was accepted, not that the routing changed. Check the result with GET /whatsapp/phone_numbers/{id}/calling_routing, which can return the previous value immediately after an update. An update for a number that is not a WhatsApp Calling number in the account returns 404.
The connection must belong to the same account and must not be a WhatsApp connection. Send connection_id: null to clear the routing; omitting connection_id is rejected. Numbers active on Telnyx are rejected, because they route through their own connection assignment.
Sub-users need update permission on connections, and read permission to check the result with GET.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.whatsapp.phoneNumbers.callingRouting.patchAll('id', {
connection_id: '1234567890',
});
console.log(response.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
)
response = client.whatsapp.phone_numbers.calling_routing.patch_all(
id="id",
connection_id="1234567890",
)
print(response.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"),
)
response, err := client.Whatsapp.PhoneNumbers.CallingRouting.PatchAll(
context.TODO(),
"id",
telnyx.WhatsappPhoneNumberCallingRoutingPatchAllParams{
ConnectionID: "1234567890",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsapp.phoneNumbers.callingRouting.CallingRoutingPatchAllParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallingRoutingPatchAllParams params = CallingRoutingPatchAllParams.builder()
.connectionId("1234567890")
.build();
var response = client.whatsapp().phoneNumbers().callingRouting().patchAll("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.whatsapp.phone_numbers.calling_routing.patch_all("id", connection_id: "1234567890")
puts(response)<?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 {
$response = $client->whatsapp->phoneNumbers->callingRouting->patchAll(
'id',
connection_id: '1234567890',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp:phone-numbers:calling-routing patch-all \
--api-key 'My API Key' \
--id +13125550100 \
--connection-id 1234567890curl --request PATCH \
--url https://api.telnyx.com/v2/whatsapp/phone_numbers/{id}/calling_routing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connection_id": "1234567890"
}
'{
"data": {
"record_type": "whatsapp_calling_routing",
"phone_number": "+13125550100",
"connection_id": "1234567890"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The BYON phone number in E.164 format. The leading + is optional.
Body
ID of the connection to deliver inbound WhatsApp calls to: a positive integer up to 9223372036854775807, sent as a decimal string or an integer. Send a string to keep large IDs exact. Non-null values are returned as strings. null clears the routing.
"1234567890"
Response
Update accepted for processing. The body echoes the requested routing; it does not confirm that the routing was applied.
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.whatsapp.phoneNumbers.callingRouting.patchAll('id', {
connection_id: '1234567890',
});
console.log(response.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
)
response = client.whatsapp.phone_numbers.calling_routing.patch_all(
id="id",
connection_id="1234567890",
)
print(response.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"),
)
response, err := client.Whatsapp.PhoneNumbers.CallingRouting.PatchAll(
context.TODO(),
"id",
telnyx.WhatsappPhoneNumberCallingRoutingPatchAllParams{
ConnectionID: "1234567890",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsapp.phoneNumbers.callingRouting.CallingRoutingPatchAllParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallingRoutingPatchAllParams params = CallingRoutingPatchAllParams.builder()
.connectionId("1234567890")
.build();
var response = client.whatsapp().phoneNumbers().callingRouting().patchAll("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.whatsapp.phone_numbers.calling_routing.patch_all("id", connection_id: "1234567890")
puts(response)<?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 {
$response = $client->whatsapp->phoneNumbers->callingRouting->patchAll(
'id',
connection_id: '1234567890',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp:phone-numbers:calling-routing patch-all \
--api-key 'My API Key' \
--id +13125550100 \
--connection-id 1234567890curl --request PATCH \
--url https://api.telnyx.com/v2/whatsapp/phone_numbers/{id}/calling_routing \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connection_id": "1234567890"
}
'{
"data": {
"record_type": "whatsapp_calling_routing",
"phone_number": "+13125550100",
"connection_id": "1234567890"
}
}