Skip to content

Email Template

A prepared email message that can be used to bootstrap a campaign or transactional email.

Endpoints

Method URL
GET /email_template/<template>
POST /email_template
PUT /email_template/<template>
DELETE /email_template/<template>

GET /email_template/<template>

Payload: No payload.

Returns: The template.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  https://app.duo.pt/email_template/{template_id}

Response:

{
  "success": true,
  "data": {
    "email_template": {
      "id": 1,
      "owner": 1,
      "name": "Monthly Newsletter",
      "message": "<html><body>Hi {{name}}</body></html>",
      "shared_with_children": false,
      "tags": "",
      "block_editor_type": "",
      "block_editor_content": null
    }
  }
}

POST /email_template

Parameter Type Description
name string Template name
message string Message HTML code
block_editor_type string "" (no editor) or "unlayer"
block_editor_content string (optional) JSON string with message source for the block editor
shared_with_children boolean Allow hierarchical child users to use this template

Returns: The new template.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  -d "name=My+Template&message=<html><body>Hi+{{name}}</body></html>&block_editor_type=" \
  https://app.duo.pt/email_template

Response:

{
  "success": true,
  "data": {
    "email_template": {
      "id": 1,
      "owner": 1,
      "name": "Monthly Newsletter",
      "message": "<html><body>Hi {{name}}</body></html>",
      "shared_with_children": false,
      "tags": null,
      "block_editor_type": "",
      "block_editor_content": null
    },
    "success": true
  }
}

PUT /email_template/<template>

Same payload as POST.

Returns: The edited template.

Example:

curl -u "username:api_key" -H "Accept: application/json" -X PUT \
  -d "name=Updated+Template&message=<html><body>Updated</body></html>&block_editor_type=" \
  https://app.duo.pt/email_template/{template_id}

Response:

{
  "success": true,
  "data": {
    "email_template": {
      "id": 1,
      "owner": 1,
      "name": "Monthly Newsletter",
      "message": "<html><body>Hi {{name}}</body></html>",
      "shared_with_children": false,
      "tags": "",
      "block_editor_type": "",
      "block_editor_content": null
    },
    "success": true
  }
}

DELETE /email_template/<template>

Payload: No payload.

Returns: The deleted template.

Example:

curl -u "username:api_key" -H "Accept: application/json" -X DELETE \
  https://app.duo.pt/email_template/{template_id}

Response:

{
  "success": true,
  "data": {
    "template": {
      "id": 1,
      "owner": 1,
      "name": "Monthly Newsletter",
      "message": "<html><body>Hi {{name}}</body></html>",
      "shared_with_children": false,
      "tags": "",
      "block_editor_type": "",
      "block_editor_content": null
    }
  }
}