Email customizations allow an add-on to let admins of a space customize the emails it sends. Creating an email customizations via this endpoint adds it to the list of customizable emails in the admin section under Customize -> Emails. Every time an add-on wants to send an email, it should load the customized copy from Cobot.
Cobot internally uses Mustache placeholders, and add-ons should do the same. Mustache libraries are available for most programming languages.
List email customizations
GET https://:subdomain.cobot.me/api/email_customizations
Returns a list of email customizations of the space (across all add-ons).
- Authentication required
- yes, additionally user must be a space admin
- Scope required
- read_email_customizations
Example
GET https://co-up.cobot.me/api/email_customizations
Response:
[
{
"id": "330d885219e7b872de299fd7ac08406f",
"name": "Custom Confirmation Email",
"description": "Is sent when the confirmation is custom.",
"subject": "Custom Confirmation for {{space}}",
"subject_placeholders": { "space": "Demo Space" },
"body": "<p>Hi,<br>we just confirmed something custom for {{name}}.</p>",
"body_placeholders": { "name": "Jenny Ence" }
}
]
Show single email customization
GET https://co-up.cobot.me/api/email_customizations/:id
Returns a single email customization.
- Authentication required
- yes, additionally user must be a space admin
- Scope required
- read_email_customizations
Example
GET https://co-up.cobot.me/api/email_customizations/330d885219e7b872de299fd7ac08406f
Response:
{
"id": "330d885219e7b872de299fd7ac08406f",
"name": "Custom Confirmation Email",
"description": "Is sent when the confirmation is custom.",
"subject": "Custom Confirmation for {{space}}",
"subject_placeholders": { "space": "Demo Space" },
"body": "<p>Hi,<br>we just confirmed something custom for {{name}}.</p>",
"body_placeholders": { "name": "Jenny Ence" }
}
The name and description are shown on the customize email page on Cobot to explain what the email does.
Subject and body represent the copy of the email. Both can contain Mustache {{placeholders}} that should be replaced with content by the add-on. The subject should be plain text, the body HTML (we use a WYSIWYG editor to customize the email body).
The subject/body placeholder fields are used on the customization page to display what placeholders are available. The values are used to show a preview of the email.
Create email customization
POST https://co-up.cobot.me/api/email_customizations
Creates an email customization.
- Authentication required
- yes, additionally user must be a space admin
- Scope required
- write_email_customizations
Example
POST https://co-up.cobot.me/api/email_customizations
Body:
{
"name": "Custom Confirmation Email",
"description": "Is sent when the confirmation is custom.",
"subject": "Custom Confirmation for {{space}}",
"subject_placeholders": { "space": "Demo Space" },
"body": "<p>Hi,<br>we just confirmed something custom for {{name}}.</p>",
"body_placeholders": { "name": "Jenny Ence" }
}
Response:
{
"id": "330d885219e7b872de299fd7ac08406f",
"name": "Custom Confirmation Email",
"description": "Is sent when the confirmation is custom.",
"subject": "Custom Confirmation for {{space}}",
"subject_placeholders": { "space": "Demo Space" },
"body": "<p>Hi,<br>we just confirmed something custom for {{name}}.</p>",
"body_placeholders": { "name": "Jenny Ence" }
}
Delete email customization
DELETE https://co-up.cobot.me/api/email_customizations/:id
Deletes an email customization.
- Authentication required
- yes, additionally user must be a space admin
- Scope required
- write_email_customizations
Example
DELETE https://co-up.cobot.me/api/email_customizations/330d885219e7b872de299fd7ac08406f
Response is empty and HTTP status is 204.