Choose who sends an email
Overview
Choose whether we send an email type directly, or deliver its content to your webhook so your system sends it.
Use webhook delivery when you want emails to come from your own mail system.
You'll need the type and the method.
The method is saved. webhook needs a type that supports it (supports_webhook in List email types) and an active webhook subscription.
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. - For
webhook: an active webhook subscription.
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/delivery-method
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.).
Rate limit
This endpoint has no rate limit.
Request parameters
None.
Request body
| 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. |
delivery_method | string | Yes | direct (we send it) or webhook (we send its content to your webhook). webhook fails validation when the type doesn't support webhook delivery, or when the account has no active webhook subscription. |
webhook_subscription_id | integer | No | The webhook subscription to deliver to, when delivery_method is webhook. Must be active and belong to your partner. Left out: any active subscription must exist. |
Request payload
{
"company_id": 5994,
"type": "user_welcome",
"delivery_method": "webhook",
"webhook_subscription_id": 18
}Response body
The payload is inside data.
| Field | Type | Description |
|---|---|---|
status | string | success. |
message | string | Template updated. |
Response payload
{
"data": {
"status": "success",
"message": "Template updated."
}
}Examples
Success payload
See Response payload.
Error payload
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 Type doesn't support webhook delivery
{
"message": "This email type does not support webhook delivery.",
"errors": {
"delivery_method": [
"This email type does not support webhook delivery."
]
}
}422 No active webhook subscription
{
"message": "No active webhook subscription is configured for this account. Add and activate a webhook subscription before switching this email to webhook delivery.",
"errors": {
"delivery_method": [
"No active webhook subscription is configured for this account. Add and activate a webhook subscription before switching this email to webhook delivery."
]
}
}422 delivery_method isn't allowed
{
"message": "The selected delivery method is invalid.",
"errors": {
"delivery_method": [
"The selected delivery method is invalid."
]
}
}| Status | Meaning |
|---|---|
200 | Saved. |
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 | delivery_method isn't direct or webhook, the type doesn't support webhook delivery, there's no active webhook subscription, or the account is outside your tree. |
500 | Unexpected server error. |
Example request
curl --request POST \
--url "https://production-api.shoutaboutus.com/api/v1/account/white-label/email-templates/delivery-method" \
--header 'Authorization: Bearer <bearer-token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"company_id": 5994, "type": "user_welcome", "delivery_method": "webhook", "webhook_subscription_id": 18}'Updated 17 days ago
Did this page help you?
