Skip to main content
PUT
/
templates
/
{id}
Update template metadata
curl --request PUT \
  --url https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id} \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --header 'appid: <appid>' \
  --data '
{
  "name": "<string>",
  "templateCategory": "<string>",
  "label": "<string>",
  "alternativeText": "<string>",
  "tags": [
    "<string>"
  ],
  "status": "<string>",
  "variableSchema": [
    {}
  ],
  "config": {}
}
'
import requests

url = "https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}"

payload = {
"name": "<string>",
"templateCategory": "<string>",
"label": "<string>",
"alternativeText": "<string>",
"tags": ["<string>"],
"status": "<string>",
"variableSchema": [{}],
"config": {}
}
headers = {
"appid": "<appid>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {appid: '<appid>', apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
templateCategory: '<string>',
label: '<string>',
alternativeText: '<string>',
tags: ['<string>'],
status: '<string>',
variableSchema: [{}],
config: {}
})
};

fetch('https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'templateCategory' => '<string>',
'label' => '<string>',
'alternativeText' => '<string>',
'tags' => [
'<string>'
],
'status' => '<string>',
'variableSchema' => [
[

]
],
'config' => [

]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>",
"appid: <appid>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"templateCategory\": \"<string>\",\n \"label\": \"<string>\",\n \"alternativeText\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"status\": \"<string>\",\n \"variableSchema\": [\n {}\n ],\n \"config\": {}\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("appid", "<appid>")
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}")
.header("appid", "<appid>")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"templateCategory\": \"<string>\",\n \"label\": \"<string>\",\n \"alternativeText\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"status\": \"<string>\",\n \"variableSchema\": [\n {}\n ],\n \"config\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{appId}.api-{region}.cometchat.io/v3/campaigns/templates/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["appid"] = '<appid>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"templateCategory\": \"<string>\",\n \"label\": \"<string>\",\n \"alternativeText\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"status\": \"<string>\",\n \"variableSchema\": [\n {}\n ],\n \"config\": {}\n}"

response = http.request(request)
puts response.read_body

Authorizations

apikey
string
header
required

Your CometChat REST API Key.

Headers

appid
string
required

Tenant application ID

Path Parameters

id
string
required

Body

application/json
name
string
templateCategory
string
label
string

Display label shown on notification

alternativeText
string

Plain-text fallback when push is suppressed or rich content cannot render. Sendbird-parity field.

tags
string[]

First-class tags for filtering/segmentation

status
string
variableSchema
object[]
config
object

Response

Template updated