CreateEmailTemplate
Create an email template for sending emails later. Supports both rich text editor and drag-and-drop editor.
Request Information
- Request Method:
POST - Request Path:
/api/v1/email/EmailTemplate - Content-Type:
application/json
Request Parameters
| Parameter Name | Type | Required | Description | Example Value |
|---|---|---|---|---|
| Name | string | Yes | Template name | "Welcome Email Template" |
| Subject | string | Yes | Email subject | "Welcome to USpeedo" |
| Abstract | string | No | Template summary | "New user welcome email" |
| TriggerType | int | Yes | Trigger type: 1-Verification code/Notification, 2-Marketing email | 1 |
| Editor | int | Yes | Editor type: 1-Rich text editor, 2-Drag-and-drop editor | 1 |
| HtmlContent | string | Yes | HTML email content | "Email content" |
| JsonContent | string | No | JSON format content (for drag-and-drop editor) | - |
| MaterialMD5 | array | No | Material MD5 list | ["md5_1", "md5_2"] |
| VariableAttr | string | No | Template variable attributes | - |
| InTask | bool | No | Whether to create in task | false |
Notes
- TriggerType: 1 represents verification code/notification emails, 2 represents marketing emails
- Editor: 1 represents using rich text editor, 2 represents using drag-and-drop editor
- When using drag-and-drop editor, the
JsonContentfield must be provided MaterialMD5is used to associate material resources used in emails
Request Example
curl -X POST "https://api.uspeedo.com/api/v1/email/EmailTemplate" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'ACCESSKEY_ID:ACCESSKEY_SECRET' | base64)" \
-d '{
"Name": "Welcome Email Template",
"Subject": "Welcome to USpeedo",
"Abstract": "New user welcome email",
"TriggerType": 1,
"Editor": 1,
"HtmlContent": "<html><body><h1>Welcome</h1><p>Dear {name}, welcome to USpeedo!</p></body></html>"
}'
Response Format
Success Response
{
"RetCode": 0,
"Message": "success",
"TemplateId": "template_123456"
}
Response Field Description
| Field Name | Type | Description |
|---|---|---|
| RetCode | int | Return code, 0 indicates success |
| Message | string | Return message |
| TemplateId | string | Created template ID, used for subsequent email sending |
Error Response
{
"RetCode": 215392,
"Message": "Invalid parameter [Name]"
}