curl --request PUT \
--url https://api-0{data_center}.moengage.com/v1.0/custom-templates/push \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367",
"update_campaigns": false,
"ANDROID": {
"basic_details": {
"title": "Updated Basic Android Template",
"message": "Updated Basic Android Template",
"summary": "Updated Basic Android Template summary",
"image_url": "",
"default_click_action": "DEEPLINKING",
"default_click_action_value": "https://www.google.com"
},
"buttons": [
{
"btn_name": "btn1",
"click_action_type": "DEEPLINKING",
"click_action_name": "btn1",
"click_action_value": "https://www.google.com"
}
],
"advanced": {
"coupon_code": "",
"icon_type_in_notification": "url",
"large_icon_url": "https://www.google.com",
"auto_dismiss_notification": true,
"dismissal_time_multiplier": "minutes",
"dismissal_time_value": 5
}
},
"meta_info": {
"platform": [
"ANDROID"
],
"template_style": "BASIC",
"updated_by": "John.doe@yourbrand.com",
"template_name": "Basic Android Template 2",
"template_version": "2.0"
}
}
'import requests
url = "https://api-0{data_center}.moengage.com/v1.0/custom-templates/push"
payload = {
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367",
"update_campaigns": False,
"ANDROID": {
"basic_details": {
"title": "Updated Basic Android Template",
"message": "Updated Basic Android Template",
"summary": "Updated Basic Android Template summary",
"image_url": "",
"default_click_action": "DEEPLINKING",
"default_click_action_value": "https://www.google.com"
},
"buttons": [
{
"btn_name": "btn1",
"click_action_type": "DEEPLINKING",
"click_action_name": "btn1",
"click_action_value": "https://www.google.com"
}
],
"advanced": {
"coupon_code": "",
"icon_type_in_notification": "url",
"large_icon_url": "https://www.google.com",
"auto_dismiss_notification": True,
"dismissal_time_multiplier": "minutes",
"dismissal_time_value": 5
}
},
"meta_info": {
"platform": ["ANDROID"],
"template_style": "BASIC",
"updated_by": "John.doe@yourbrand.com",
"template_name": "Basic Android Template 2",
"template_version": "2.0"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_template_id: 'd05a44f0-a7cf-471a-bcb6-63054800a367',
update_campaigns: false,
ANDROID: {
basic_details: {
title: 'Updated Basic Android Template',
message: 'Updated Basic Android Template',
summary: 'Updated Basic Android Template summary',
image_url: '',
default_click_action: 'DEEPLINKING',
default_click_action_value: 'https://www.google.com'
},
buttons: [
{
btn_name: 'btn1',
click_action_type: 'DEEPLINKING',
click_action_name: 'btn1',
click_action_value: 'https://www.google.com'
}
],
advanced: {
coupon_code: '',
icon_type_in_notification: 'url',
large_icon_url: 'https://www.google.com',
auto_dismiss_notification: true,
dismissal_time_multiplier: 'minutes',
dismissal_time_value: 5
}
},
meta_info: {
platform: ['ANDROID'],
template_style: 'BASIC',
updated_by: 'John.doe@yourbrand.com',
template_name: 'Basic Android Template 2',
template_version: '2.0'
}
})
};
fetch('https://api-0{data_center}.moengage.com/v1.0/custom-templates/push', 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://api-0{data_center}.moengage.com/v1.0/custom-templates/push",
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([
'external_template_id' => 'd05a44f0-a7cf-471a-bcb6-63054800a367',
'update_campaigns' => false,
'ANDROID' => [
'basic_details' => [
'title' => 'Updated Basic Android Template',
'message' => 'Updated Basic Android Template',
'summary' => 'Updated Basic Android Template summary',
'image_url' => '',
'default_click_action' => 'DEEPLINKING',
'default_click_action_value' => 'https://www.google.com'
],
'buttons' => [
[
'btn_name' => 'btn1',
'click_action_type' => 'DEEPLINKING',
'click_action_name' => 'btn1',
'click_action_value' => 'https://www.google.com'
]
],
'advanced' => [
'coupon_code' => '',
'icon_type_in_notification' => 'url',
'large_icon_url' => 'https://www.google.com',
'auto_dismiss_notification' => true,
'dismissal_time_multiplier' => 'minutes',
'dismissal_time_value' => 5
]
],
'meta_info' => [
'platform' => [
'ANDROID'
],
'template_style' => 'BASIC',
'updated_by' => 'John.doe@yourbrand.com',
'template_name' => 'Basic Android Template 2',
'template_version' => '2.0'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api-0{data_center}.moengage.com/v1.0/custom-templates/push"
payload := strings.NewReader("{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api-0{data_center}.moengage.com/v1.0/custom-templates/push")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{data_center}.moengage.com/v1.0/custom-templates/push")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}"
response = http.request(request)
puts response.read_body{
"external_template_id": "eca024b7-a8ea-4f31-9154-5b80c85d18a9"
}{
"error": {
"code": "400 Bad Request",
"message": "Invalid template id",
"details": [
{
"code": "MissingValue",
"target": "9925c8",
"message": "9925c8 is invalid template id."
}
],
"request_id": "BTkUaYgU"
}
}{
"error": {
"code": "400 Bad Request",
"message": "Validation failed because of invalid request data",
"details": [
{
"code": "MissingValue",
"target": "template_name",
"message": "template_name value is required but value is passed empty."
}
],
"request_id": "jUxStmFn"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}Update Push Template
Updates an existing push notification template by creating a new version.
Rate Limit: 100 RPM (Requests Per Minute).
curl --request PUT \
--url https://api-0{data_center}.moengage.com/v1.0/custom-templates/push \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367",
"update_campaigns": false,
"ANDROID": {
"basic_details": {
"title": "Updated Basic Android Template",
"message": "Updated Basic Android Template",
"summary": "Updated Basic Android Template summary",
"image_url": "",
"default_click_action": "DEEPLINKING",
"default_click_action_value": "https://www.google.com"
},
"buttons": [
{
"btn_name": "btn1",
"click_action_type": "DEEPLINKING",
"click_action_name": "btn1",
"click_action_value": "https://www.google.com"
}
],
"advanced": {
"coupon_code": "",
"icon_type_in_notification": "url",
"large_icon_url": "https://www.google.com",
"auto_dismiss_notification": true,
"dismissal_time_multiplier": "minutes",
"dismissal_time_value": 5
}
},
"meta_info": {
"platform": [
"ANDROID"
],
"template_style": "BASIC",
"updated_by": "John.doe@yourbrand.com",
"template_name": "Basic Android Template 2",
"template_version": "2.0"
}
}
'import requests
url = "https://api-0{data_center}.moengage.com/v1.0/custom-templates/push"
payload = {
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367",
"update_campaigns": False,
"ANDROID": {
"basic_details": {
"title": "Updated Basic Android Template",
"message": "Updated Basic Android Template",
"summary": "Updated Basic Android Template summary",
"image_url": "",
"default_click_action": "DEEPLINKING",
"default_click_action_value": "https://www.google.com"
},
"buttons": [
{
"btn_name": "btn1",
"click_action_type": "DEEPLINKING",
"click_action_name": "btn1",
"click_action_value": "https://www.google.com"
}
],
"advanced": {
"coupon_code": "",
"icon_type_in_notification": "url",
"large_icon_url": "https://www.google.com",
"auto_dismiss_notification": True,
"dismissal_time_multiplier": "minutes",
"dismissal_time_value": 5
}
},
"meta_info": {
"platform": ["ANDROID"],
"template_style": "BASIC",
"updated_by": "John.doe@yourbrand.com",
"template_name": "Basic Android Template 2",
"template_version": "2.0"
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_template_id: 'd05a44f0-a7cf-471a-bcb6-63054800a367',
update_campaigns: false,
ANDROID: {
basic_details: {
title: 'Updated Basic Android Template',
message: 'Updated Basic Android Template',
summary: 'Updated Basic Android Template summary',
image_url: '',
default_click_action: 'DEEPLINKING',
default_click_action_value: 'https://www.google.com'
},
buttons: [
{
btn_name: 'btn1',
click_action_type: 'DEEPLINKING',
click_action_name: 'btn1',
click_action_value: 'https://www.google.com'
}
],
advanced: {
coupon_code: '',
icon_type_in_notification: 'url',
large_icon_url: 'https://www.google.com',
auto_dismiss_notification: true,
dismissal_time_multiplier: 'minutes',
dismissal_time_value: 5
}
},
meta_info: {
platform: ['ANDROID'],
template_style: 'BASIC',
updated_by: 'John.doe@yourbrand.com',
template_name: 'Basic Android Template 2',
template_version: '2.0'
}
})
};
fetch('https://api-0{data_center}.moengage.com/v1.0/custom-templates/push', 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://api-0{data_center}.moengage.com/v1.0/custom-templates/push",
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([
'external_template_id' => 'd05a44f0-a7cf-471a-bcb6-63054800a367',
'update_campaigns' => false,
'ANDROID' => [
'basic_details' => [
'title' => 'Updated Basic Android Template',
'message' => 'Updated Basic Android Template',
'summary' => 'Updated Basic Android Template summary',
'image_url' => '',
'default_click_action' => 'DEEPLINKING',
'default_click_action_value' => 'https://www.google.com'
],
'buttons' => [
[
'btn_name' => 'btn1',
'click_action_type' => 'DEEPLINKING',
'click_action_name' => 'btn1',
'click_action_value' => 'https://www.google.com'
]
],
'advanced' => [
'coupon_code' => '',
'icon_type_in_notification' => 'url',
'large_icon_url' => 'https://www.google.com',
'auto_dismiss_notification' => true,
'dismissal_time_multiplier' => 'minutes',
'dismissal_time_value' => 5
]
],
'meta_info' => [
'platform' => [
'ANDROID'
],
'template_style' => 'BASIC',
'updated_by' => 'John.doe@yourbrand.com',
'template_name' => 'Basic Android Template 2',
'template_version' => '2.0'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api-0{data_center}.moengage.com/v1.0/custom-templates/push"
payload := strings.NewReader("{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api-0{data_center}.moengage.com/v1.0/custom-templates/push")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{data_center}.moengage.com/v1.0/custom-templates/push")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_template_id\": \"d05a44f0-a7cf-471a-bcb6-63054800a367\",\n \"update_campaigns\": false,\n \"ANDROID\": {\n \"basic_details\": {\n \"title\": \"Updated Basic Android Template\",\n \"message\": \"Updated Basic Android Template\",\n \"summary\": \"Updated Basic Android Template summary\",\n \"image_url\": \"\",\n \"default_click_action\": \"DEEPLINKING\",\n \"default_click_action_value\": \"https://www.google.com\"\n },\n \"buttons\": [\n {\n \"btn_name\": \"btn1\",\n \"click_action_type\": \"DEEPLINKING\",\n \"click_action_name\": \"btn1\",\n \"click_action_value\": \"https://www.google.com\"\n }\n ],\n \"advanced\": {\n \"coupon_code\": \"\",\n \"icon_type_in_notification\": \"url\",\n \"large_icon_url\": \"https://www.google.com\",\n \"auto_dismiss_notification\": true,\n \"dismissal_time_multiplier\": \"minutes\",\n \"dismissal_time_value\": 5\n }\n },\n \"meta_info\": {\n \"platform\": [\n \"ANDROID\"\n ],\n \"template_style\": \"BASIC\",\n \"updated_by\": \"John.doe@yourbrand.com\",\n \"template_name\": \"Basic Android Template 2\",\n \"template_version\": \"2.0\"\n }\n}"
response = http.request(request)
puts response.read_body{
"external_template_id": "eca024b7-a8ea-4f31-9154-5b80c85d18a9"
}{
"error": {
"code": "400 Bad Request",
"message": "Invalid template id",
"details": [
{
"code": "MissingValue",
"target": "9925c8",
"message": "9925c8 is invalid template id."
}
],
"request_id": "BTkUaYgU"
}
}{
"error": {
"code": "400 Bad Request",
"message": "Validation failed because of invalid request data",
"details": [
{
"code": "MissingValue",
"target": "template_name",
"message": "template_name value is required but value is passed empty."
}
],
"request_id": "jUxStmFn"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}Authorizations
HTTP Basic Authentication using your Workspace ID as the username and API Key as the password.
Body
A JSON object containing the template ID to update, the updated platform payloads, and new metadata.
This field contains the unique identifier that is generated during the creation of the template.
This field contains information about the template being updated, such as the name, the template's platform, style, and the details of the user updating the template.
Show child attributes
Show child attributes
This field contains a flag that is used to update all the campaigns that are currently using the template being updated to the newer version(that is being updated in this request). The default value for this flag is false.
When the update_campaigns flag is true, all the campaigns running with this template will get updated to the latest version of the template, and when it is false, the new version of the template will be created, but there will be no change made to the template used in the existing campaigns.
This field contains the updated definition of the template for the Android platform.
Show child attributes
Show child attributes
This field contains the updated definition of the template for the iOS platform.
Show child attributes
Show child attributes
Response
This response is returned when the request is processed successfully.
This field contains the unique template id corresponding to a successful template updation request.
"eca024b7-a8ea-4f31-9154-5b80c85d18a9"
Was this page helpful?