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

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://development-api.shoutaboutus.com

Endpoint

POST /api/v1/account/white-label/email-templates/send-test

Authentication

Partner or Account token

  • company_id must 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_enabled in Get branding). When it's off, every email template call for that account returns 403 with The 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].

FieldTypeRequiredDescription
company_idintegerYesThe account. Must exist and be inside your account tree.
typestringYesThe email type, from List email types.
headerstringNoThe 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.
bodystringNoThe 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.
footerstringNoThe 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.
signaturestringNoThe 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_overridestringNoThe subject, as plain text (not base64), up to 255 characters. Merge fields allowed. Left out: the saved subject is used.
template_modestringNoregions (header, body, footer and signature) or html (one full-HTML body in custom_html). Left out: the saved mode is used.
custom_htmlstringNoThe full-HTML body for html mode, base64-encoded, up to 400,000 characters. Left out: the saved version is used.
show_logobooleanNoShow (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.

FieldTypeDescription
statusstringsuccess.
messagestringTest 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."
}
StatusMeaning
200The test email was sent.
400Your user has no email address.
401The token is missing, expired or invalid.
403The email templates section is off for this account, or the type is managed centrally.
422A field is invalid, a region uses a merge field that isn't valid for this type, or the account is outside your tree.
429More than 60 requests in a minute from this user.
500Unexpected 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}'

Did this page help you?