curl --request POST \
--url https://api-{dc}.moengage.com/v2/email-templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"name": "End_Of_Season_Sale_Template",
"html": "<!DOCTYPE html><html><body><p>Content</p></body></html>",
"source": "Partner",
"subject": "End of Season Sale!",
"attachments": [
"https://app-cdn.moengage.com/assets/LogoThumbnail.jpg"
],
"sender_name": "Your Brand Name",
"updated_by": "[email protected]"
}
'{
"status": "success",
"data": {
"id": "63f4962d4d31f4c68d980a01",
"msg": "Custom email template saved"
}
}Create Email Template (V1)
This API creates an email template in MoEngage. You can use this API to upload templates created outside the MoEngage ecosystem to MoEngage and use them for campaign creation on the MoEngage dashboard.
curl --request POST \
--url https://api-{dc}.moengage.com/v2/email-templates \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"name": "End_Of_Season_Sale_Template",
"html": "<!DOCTYPE html><html><body><p>Content</p></body></html>",
"source": "Partner",
"subject": "End of Season Sale!",
"attachments": [
"https://app-cdn.moengage.com/assets/LogoThumbnail.jpg"
],
"sender_name": "Your Brand Name",
"updated_by": "[email protected]"
}
'{
"status": "success",
"data": {
"id": "63f4962d4d31f4c68d980a01",
"msg": "Custom email template saved"
}
}Rate Limit
The rate limits are at the workspace level, and a maximum of 1000 (sum of all the API requests per workspace) requests are allowed for a workspace per minute.承認
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 Data tile.
For more information on authentication and getting your credentials, refer here.
ヘッダー
ボディ
This field contains the name of the template and would be used for identifying the template. You can look for the template created using this API in the second step of campaign creation in the 'My Saved Templates' tab using this name.
Note:
- The name field can contain only alphanumeric and underscore characters.
- The length of this field can be between 5-50 characters.
5 - 50^[a-zA-Z0-9_]+$"End_Of_Season_Sale_Template"
This field contains the attachments to be included in the email.
Note:
- Only URLs can be added as part of Email attachments.
- A maximum of ten attachments are allowed.
- The URL should start with https and end with a valid extension. The following extensions are not allowed: .dmg, .exe, .xls, .ddl, .class, .obj, .int, .gnt, .o, .so, .lbr, and .net
- Individual attachments should be less than 6 MB, and the total size of the attachments should be less than 20 MB.
10This field contains information about who created the template.
Note: Only alphanumerics, spaces, and hyphens are allowed in this field. This field can contain the email ID of the creator as well. The email id should be in the right format and a valid one.