Create OSM Template
curl --request POST \
--url https://api-{dc}.moengage.com/v1.0/custom-templates/osm \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"basic_details": {
"payload": "<html><body><h1>Your HTML Content Here</h1></body></html>",
"template_type": "BANNER"
},
"meta_info": {
"created_by": "testuser@moengage.com",
"template_id": "123123123",
"template_name": "Test",
"template_version": "1"
}
}
'{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367"
}{
"error": {
"code": "400 Bad Request",
"message": "Duplicate - template_id and template_version",
"details": [
{
"code": "InvalidValue",
"target": "Duplicate - template_id and template_version",
"message": "template_id:13343440 template_version:1 is already present."
}
],
"request_id": "xZLmJvUi"
}
}{
"title": "Authentication required",
"description": "MOE-APPKEY missing in Authentication Header"
}{
"title": "Unsupported media type",
"description": "Content type is not supported"
}{
"response_id": "OUUkHvcn",
"type": "custom_template",
"error": {
"code": "Too Many Requests",
"message": "API rate limit breached. Current limit: n/m mins"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}Create OSM Template
This API creates a new On-Site Messaging (OSM) template. You can use this API to upload templates created outside the MoEngage ecosystem to MoEngage and use them for campaign creation.
POST
/
custom-templates
/
osm
Create OSM Template
curl --request POST \
--url https://api-{dc}.moengage.com/v1.0/custom-templates/osm \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"basic_details": {
"payload": "<html><body><h1>Your HTML Content Here</h1></body></html>",
"template_type": "BANNER"
},
"meta_info": {
"created_by": "testuser@moengage.com",
"template_id": "123123123",
"template_name": "Test",
"template_version": "1"
}
}
'{
"external_template_id": "d05a44f0-a7cf-471a-bcb6-63054800a367"
}{
"error": {
"code": "400 Bad Request",
"message": "Duplicate - template_id and template_version",
"details": [
{
"code": "InvalidValue",
"target": "Duplicate - template_id and template_version",
"message": "template_id:13343440 template_version:1 is already present."
}
],
"request_id": "xZLmJvUi"
}
}{
"title": "Authentication required",
"description": "MOE-APPKEY missing in Authentication Header"
}{
"title": "Unsupported media type",
"description": "Content type is not supported"
}{
"response_id": "OUUkHvcn",
"type": "custom_template",
"error": {
"code": "Too Many Requests",
"message": "API rate limit breached. Current limit: n/m mins"
}
}{
"title": "Internal Server Error",
"message": "An unexpected error was encountered while processing this request. Please contact MoEngage Team"
}API templates cannot be used in the Drag and Drop Editor in the MoEngage Dashboard. They are only supported for the Custom HTML Editor.
Rate Limit
The rate limit is 100 RPM. You can upload a maximum of 100 templates per minute.Authorizations
Authentication is done via Basic Auth. This requires a base64-encoded string of your credentials in the format 'username:password'.
- Username: Use your MoEngage workspace ID (also known as the App ID). You can find it in the MoEngage dashboard at Settings > Account > APIs > Workspace ID (earlier app id).
- Password: Use your API Key, which you can find within the Campaign report/Business events/Custom templates/Catalog API/Inform Report tile.
For more information on authentication and getting your credentials, refer here.
Body
application/json
The details of the OSM template to be created.
Response
Template created successfully.
The unique ID assigned to the newly created template by MoEngage. This ID is used for subsequent updates or searches.
Was this page helpful?