Send a test email
Overview
Send an email type to your own address.
Use this to see it in a real inbox.
You'll need the type. The test goes to the email address of the user behind the token.
The email is sent, with [Test] added to the front of the subject. Content you send is used for this test only and isn't saved; anything you leave out comes from the saved template. Merge fields are filled with their sample values.
Prerequisites
- A bearer token. See Authentication.
- The account's id (
company_id), with the email templates section turned on. - The email
type, from List email types. - An email address on your user.
Base URL
| Environment | URL |
|---|---|
| Production | https://production-api.shoutaboutus.com |
| Development | https://development-api.shoutaboutus.com |
Endpoint
POST /api/v1/account/white-label/email-templates/send-test
Authentication
Partner or Account token
company_idmust be inside your own account tree. A Partner token can use any account under the partner; an Account token only its own account.- An account outside your tree, or one that doesn't exist, is rejected with
422. - The email templates section must be turned on for the account's partner (
email_templates_enabledin Get branding). When it's off, every email template call for that account returns403withThe email template section is disabled for this account. - Types managed centrally by the platform return
403(This template is managed centrally and cannot be edited here.). - The test always goes to your own email address; if your user has none you get
400.
Rate limit
60 requests per minute, counted per user (the token’s user). See Rate limits.
Request parameters
None.
Request body
The test always goes to your own email address, with [Test] added to the front of the subject. Region fields are base64-encoded HTML.
Only the merge fields returned by List an email's merge fields for that type are accepted (the example decodes to <p>Hello [customerName]</p>, valid for user_welcome); any other token returns 422 Unknown variables for this template: [token].
| Field | Type | Required | Description |
|---|---|---|---|
company_id | integer | Yes | The account. Must exist and be inside your account tree. |
type | string | Yes | The email type, from List email types. |
header | string | No | The header region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out: the saved version is used. |
body | string | No | The body region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out: the saved version is used. |
footer | string | No | The footer region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out: the saved version is used. |
signature | string | No | The signature region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out: the saved version is used. |
subject_override | string | No | The subject, as plain text (not base64), up to 255 characters. Merge fields allowed. Left out: the saved subject is used. |
template_mode | string | No | regions (header, body, footer and signature) or html (one full-HTML body in custom_html). Left out: the saved mode is used. |
custom_html | string | No | The full-HTML body for html mode, base64-encoded, up to 400,000 characters. Left out: the saved version is used. |
show_logo | boolean | No | Show (true) or hide (false) the logo for this test only. Left out: the saved setting is used. |
Request payload
{
"company_id": 5994,
"type": "user_welcome",
"body": "PHA+SGVsbG8gW2N1c3RvbWVyTmFtZV08L3A+",
"show_logo": true
}Response body
The payload is inside data.
| Field | Type | Description |
|---|---|---|
status | string | success. |
message | string | Test email sent to <your address>. |
Response payload
{
"data": {
"status": "success",
"message": "Test email sent to [email protected]"
}
}Examples
Success payload
See Response payload.
Error payload
400 Your user has no email address
{
"message": "Your account has no email address to send a test to.",
"status": "error",
"errors": []
}403 Email templates section is off
{
"message": "The email template section is disabled for this account.",
"status": "error",
"errors": []
}403 Type managed centrally
{
"message": "This template is managed centrally and cannot be edited here.",
"status": "error",
"errors": []
}422 Unknown merge field
{
"message": "Unknown variables for this template: [recipientName]",
"errors": {
"body": [
"Unknown variables for this template: [recipientName]"
]
}
}422 template_mode isn't allowed
{
"message": "The selected template mode is invalid.",
"errors": {
"template_mode": [
"The selected template mode is invalid."
]
}
}429 Too many requests
{
"message": "Too Many Attempts."
}| Status | Meaning |
|---|---|
200 | The test email was sent. |
400 | Your user has no email address. |
401 | The token is missing, expired or invalid. |
403 | The email templates section is off for this account, or the type is managed centrally. |
422 | A field is invalid, a region uses a merge field that isn't valid for this type, or the account is outside your tree. |
429 | More than 60 requests in a minute from this user. |
500 | Unexpected server error. |
Example request
curl --request POST \
--url "https://production-api.shoutaboutus.com/api/v1/account/white-label/email-templates/send-test" \
--header 'Authorization: Bearer <bearer-token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"company_id": 5994, "type": "user_welcome", "body": "PHA+SGVsbG8gW2N1c3RvbWVyTmFtZV08L3A+", "show_logo": true}'Updated 17 days ago
