Initialize Whatsapp phone number verification
POST
/
whatsapp
/
business_accounts
/
{id}
/
phone_numbers
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.whatsapp.businessAccounts.phoneNumbers.initializeVerification('id', {
display_name: 'display_name',
phone_number: 'phone_number',
});import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.whatsapp.business_accounts.phone_numbers.initialize_verification(
id="id",
display_name="display_name",
phone_number="phone_number",
)package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Whatsapp.BusinessAccounts.PhoneNumbers.InitializeVerification(
context.TODO(),
"id",
telnyx.WhatsappBusinessAccountPhoneNumberInitializeVerificationParams{
DisplayName: "display_name",
PhoneNumber: "phone_number",
},
)
if err != nil {
panic(err.Error())
}
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsapp.businessaccounts.phonenumbers.PhoneNumberInitializeVerificationParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberInitializeVerificationParams params = PhoneNumberInitializeVerificationParams.builder()
.id("id")
.displayName("display_name")
.phoneNumber("phone_number")
.build();
client.whatsapp().businessAccounts().phoneNumbers().initializeVerification(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
result = telnyx.whatsapp.business_accounts.phone_numbers.initialize_verification(
"id",
display_name: "display_name",
phone_number: "phone_number"
)
puts(result)<?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 {
$result = $client
->whatsapp
->businessAccounts
->phoneNumbers
->initializeVerification(
'id',
displayName: 'display_name',
phoneNumber: 'phone_number',
language: 'language',
verificationMethod: 'sms',
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp:business-accounts:phone-numbers initialize-verification \
--api-key 'My API Key' \
--id id \
--display-name display_name \
--phone-number phone_numbercurl --request POST \
--url https://api.telnyx.com/v2/whatsapp/business_accounts/{id}/phone_numbers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"display_name": "<string>",
"verification_method": "sms",
"language": "en_US"
}
'{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Whatsapp Business Account ID
Body
application/json
Response
Verification initiated
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
});
await client.whatsapp.businessAccounts.phoneNumbers.initializeVerification('id', {
display_name: 'display_name',
phone_number: 'phone_number',
});import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.whatsapp.business_accounts.phone_numbers.initialize_verification(
id="id",
display_name="display_name",
phone_number="phone_number",
)package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Whatsapp.BusinessAccounts.PhoneNumbers.InitializeVerification(
context.TODO(),
"id",
telnyx.WhatsappBusinessAccountPhoneNumberInitializeVerificationParams{
DisplayName: "display_name",
PhoneNumber: "phone_number",
},
)
if err != nil {
panic(err.Error())
}
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsapp.businessaccounts.phonenumbers.PhoneNumberInitializeVerificationParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PhoneNumberInitializeVerificationParams params = PhoneNumberInitializeVerificationParams.builder()
.id("id")
.displayName("display_name")
.phoneNumber("phone_number")
.build();
client.whatsapp().businessAccounts().phoneNumbers().initializeVerification(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
result = telnyx.whatsapp.business_accounts.phone_numbers.initialize_verification(
"id",
display_name: "display_name",
phone_number: "phone_number"
)
puts(result)<?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 {
$result = $client
->whatsapp
->businessAccounts
->phoneNumbers
->initializeVerification(
'id',
displayName: 'display_name',
phoneNumber: 'phone_number',
language: 'language',
verificationMethod: 'sms',
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp:business-accounts:phone-numbers initialize-verification \
--api-key 'My API Key' \
--id id \
--display-name display_name \
--phone-number phone_numbercurl --request POST \
--url https://api.telnyx.com/v2/whatsapp/business_accounts/{id}/phone_numbers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>",
"display_name": "<string>",
"verification_method": "sms",
"language": "en_US"
}
'{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}