Update a Whatsapp message template
PATCH
/
whatsapp
/
message_templates
/
{id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const whatsappMessageTemplate = await client.whatsappMessageTemplates.update('id');
console.log(whatsappMessageTemplate.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
)
whatsapp_message_template = client.whatsapp_message_templates.update(
id="id",
)
print(whatsapp_message_template.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"),
)
whatsappMessageTemplate, err := client.WhatsappMessageTemplates.Update(
context.TODO(),
"id",
telnyx.WhatsappMessageTemplateUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", whatsappMessageTemplate.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsappmessagetemplates.WhatsappMessageTemplateUpdateParams;
import com.telnyx.sdk.models.whatsappmessagetemplates.WhatsappMessageTemplateUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
WhatsappMessageTemplateUpdateResponse whatsappMessageTemplate = client.whatsappMessageTemplates().update("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
whatsapp_message_template = telnyx.whatsapp_message_templates.update("id")
puts(whatsapp_message_template)<?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 {
$whatsappMessageTemplate = $client->whatsappMessageTemplates->update(
'id',
category: 'MARKETING',
components: [
[
'format' => 'TEXT',
'type' => 'HEADER',
'example' => ['headerHandle' => ['string'], 'headerText' => ['string']],
'text' => 'text',
],
],
);
var_dump($whatsappMessageTemplate);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp-message-templates update \
--api-key 'My API Key' \
--id idcurl --request PATCH \
--url https://api.telnyx.com/v2/whatsapp/message_templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"type": "HEADER",
"text": "<string>",
"example": {
"header_text": [
"<string>"
],
"header_handle": [
"<string>"
]
}
}
]
}
'{
"data": {
"id": "<string>",
"record_type": "whatsapp_message_template",
"template_id": "<string>",
"name": "<string>",
"language": "<string>",
"status": "<string>",
"rejection_reason": "<string>",
"components": [
{}
],
"whatsapp_business_account": {
"id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"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 message template ID
Body
application/json
Available options:
MARKETING, UTILITY, AUTHENTICATION Updated template components. Same structure as the create request.
A template component. Additional Meta component types not listed here are also accepted.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Show child attributes
Show child attributes
Response
Updated template
Show child attributes
Show child attributes
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 whatsappMessageTemplate = await client.whatsappMessageTemplates.update('id');
console.log(whatsappMessageTemplate.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
)
whatsapp_message_template = client.whatsapp_message_templates.update(
id="id",
)
print(whatsapp_message_template.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"),
)
whatsappMessageTemplate, err := client.WhatsappMessageTemplates.Update(
context.TODO(),
"id",
telnyx.WhatsappMessageTemplateUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", whatsappMessageTemplate.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.whatsappmessagetemplates.WhatsappMessageTemplateUpdateParams;
import com.telnyx.sdk.models.whatsappmessagetemplates.WhatsappMessageTemplateUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
WhatsappMessageTemplateUpdateResponse whatsappMessageTemplate = client.whatsappMessageTemplates().update("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
whatsapp_message_template = telnyx.whatsapp_message_templates.update("id")
puts(whatsapp_message_template)<?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 {
$whatsappMessageTemplate = $client->whatsappMessageTemplates->update(
'id',
category: 'MARKETING',
components: [
[
'format' => 'TEXT',
'type' => 'HEADER',
'example' => ['headerHandle' => ['string'], 'headerText' => ['string']],
'text' => 'text',
],
],
);
var_dump($whatsappMessageTemplate);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx whatsapp-message-templates update \
--api-key 'My API Key' \
--id idcurl --request PATCH \
--url https://api.telnyx.com/v2/whatsapp/message_templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"type": "HEADER",
"text": "<string>",
"example": {
"header_text": [
"<string>"
],
"header_handle": [
"<string>"
]
}
}
]
}
'{
"data": {
"id": "<string>",
"record_type": "whatsapp_message_template",
"template_id": "<string>",
"name": "<string>",
"language": "<string>",
"status": "<string>",
"rejection_reason": "<string>",
"components": [
{}
],
"whatsapp_business_account": {
"id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}