BrazeEx.Api.TemplatesEmailTemplates (braze_ex v1.0.22)
API calls for all endpoints tagged TemplatesEmailTemplates
.
Link to this section Summary
Functions
Create Email Template
Use this endpoint to create email templates on the Braze dashboard.
See Email Template Information
Use this endpoint to get information on your email templates.
List Available Email Templates
Use this endpoint to get a list of available templates in your Braze account.
Update Email Template
Use this endpoint to update email templates on the Braze dashboard.
Link to this section Functions
templates_email_create_post(connection, opts \\ [])
@spec templates_email_create_post( Tesla.Env.client(), keyword() ) :: {:ok, nil} | {:error, Tesla.Env.t()}
create-email-template
Create Email Template
Use this endpoint to create email templates on the Braze dashboard.
These templates will be available on the Templates & Media page. The response from this endpoint will include a field for email_template_id
, which can be used to update the template in subsequent API calls.
Users’ email subscription status can be updated and retrieved via Braze using a RESTful API. You can use the API to set up bi-directional sync between Braze and other email systems or your own database. All API requests are made over HTTPS.
prerequisites
Prerequisites
To use this endpoint, you'll need an API key with the templates.email.create
permission.
rate-limit
Rate limit
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
request-parameters
Request parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
template_name | Required | String | Name of your email template. |
subject | Required | String | Email template subject line. |
body | Required | String | Email template body that may include HTML. |
plaintext_body | Optional | String | A plaintext version of the email template body. |
preheader | Optional | String | Email preheader used to generate previews in some clients. |
tags | Optional | String | Tags must already exist. |
should_inline_css | Optional | Boolean | Enables or disables the inline_css feature per template. If not provided, Braze will use the default setting for the app group. One of true or false is expected. |
possible-errors
Possible errors
The following table lists possible returned errors and their associated troubleshooting steps, if applicable.
Error | Troubleshooting |
---|---|
Template name is required | Enter a template name. |
Tags must be an array | Tags must be formatted as an array of strings, for example ["marketing", "promotional", "transactional"] . |
All tags must be strings | Make sure your tags are encapsulated in quotes ("" ). |
Some tags could not be found | To add a tag when creating an email template, the tag must already exist in Braze. |
Email must have valid Content Block names | The email contains Content Blocks that don't exist in this environment. |
Invalid value for should_inline_css . One of true or false was expected | This parameter only accepts boolean values (true or false). Make sure the value for should_inline_css is not encapsulated in quotes ("" ), which causes the value to be sent as a string instead. |
parameters
Parameters
connection
(BrazeEx.Connection): Connection to serveropts
(keyword): Optional parameters:"Content-Type"
(String.t)::Authorization
(String.t)::body
(String.t):
returns
Returns
{:ok, nil}
on success{:error, Tesla.Env.t}
on failure
templates_email_info_get(connection, opts \\ [])
@spec templates_email_info_get( Tesla.Env.client(), keyword() ) :: {:ok, nil} | {:error, Tesla.Env.t()}
see-email-template-information
See Email Template Information
Use this endpoint to get information on your email templates.
Important: Templates built using the drag-and-drop editor are not accepted.
prerequisites
Prerequisites
To use this endpoint, you'll need an API key with the templates.email.info
permission.
rate-limit
Rate limit
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
response
Response
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
"email_template_id": (string) Your email template's API Identifier,
"template_name": (string) The name of your email template,
"description": (string) The email template description,
"subject": (string) The email template subject line,
"preheader": (optional, string) The email preheader used to generate previews in some clients),
"body": (optional, string) The email template body that may include HTML,
"plaintext_body": (optional, string) A plaintext version of the email template body,
"should_inline_css": (optional, boolean) Whether there is inline CSS in the body of the template - defaults to the css inlining value for the workspace,
"tags": (string) Tag names,
"created_at": (string) The time the email was created at in ISO 8601,
"updated_at": (string) The time the email was updated in ISO 8601
}
Images in this response will show in the body
variable as HTML.
parameters
Parameters
connection
(BrazeEx.Connection): Connection to serveropts
(keyword): Optional parameters:Authorization
(String.t)::email_template_id
(String.t): (Required) String See email template's API identifier.
returns
Returns
{:ok, nil}
on success{:error, Tesla.Env.t}
on failure
templates_email_list_get(connection, opts \\ [])
@spec templates_email_list_get( Tesla.Env.client(), keyword() ) :: {:ok, nil} | {:error, Tesla.Env.t()}
list-available-email-templates
List Available Email Templates
Use this endpoint to get a list of available templates in your Braze account.
prerequisites
Prerequisites
To use this endpoint, you'll need an API key with the templates.email.list
permission.
rate-limit
Rate limit
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
response
Response
Important: Templates built using the drag-and-drop editor are not provided in this response.
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
"count": number of templates returned
"templates": [template with the following properties]:
"email_template_id": (string) your email template's API Identifier,
"template_name": (string) the name of your email template,
"created_at": (string, in ISO 8601),
"updated_at": (string, in ISO 8601),
"tags": (array of strings) tags appended to the template
}
parameters
Parameters
connection
(BrazeEx.Connection): Connection to serveropts
(keyword): Optional parameters:Authorization
(String.t)::modified_after
(String.t): (Optional) String in ISO 8601 Retrieve only templates updated at or after the given time.:modified_before
(String.t): (Optional) String in ISO 8601 Retrieve only templates updated at or before the given time.:limit
(integer()): (Optional) Positive Number Maximum number of templates to retrieve. Default to 100 if not provided, with a maximum acceptable value of 1000.:offset
(integer()): (Optional) Positive Number Number of templates to skip before returning rest of the templates that fit the search criteria.
returns
Returns
{:ok, nil}
on success{:error, Tesla.Env.t}
on failure
templates_email_update_post(connection, opts \\ [])
@spec templates_email_update_post( Tesla.Env.client(), keyword() ) :: {:ok, nil} | {:error, Tesla.Env.t()}
update-email-template
Update Email Template
Use this endpoint to update email templates on the Braze dashboard.
You can access an email template’s email_template_id
by navigating to it on the Templates & Media page. The Create email template endpoint will also return an email_template_id
reference.
All fields other than the email_template_id
are optional, but you must specify at least one field to update.
prerequisites
Prerequisites
To use this endpoint, you'll need an API key with the templates.email.update
permission.
rate-limit
Rate limit
We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in API rate limits.
request-parameters
Request parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
email_template_id | Required | String | Your email template's API identifier. |
template_name | Optional | String | Name of your email template. |
subject | Optional | String | Email template subject line. |
body | Optional | String | Email template body that may include HTML. |
plaintext_body | Optional | String | A plaintext version of the email template body. |
preheader | Optional | String | Email preheader used to generate previews in some clients. |
tags | Optional | String | Tags must already exist. |
should_inline_css | Optional | Boolean | Enables or disables the inline_css feature per template. If not provided, Braze will use the default setting for the AppGroup. One of true or false is expected. |
troubleshooting
Troubleshooting
The following table lists possible returned errors and their associated troubleshooting steps, if applicable.
Error | Troubleshooting |
---|---|
Template name is required | |
Tags must be an array | Tags must be formatted as an array of strings, for example ["marketing", "promotional", "transactional"] . |
All tags must be strings | Make sure your tags are encapsulated in quotes ("" ). |
Some tags could not be found | To add a tag when creating an email template, the tag must already exist in Braze. |
Invalid value for should_inline_css . One of true or false was expected | This parameter only accepts boolean values (true or false). Make sure the value for should_inline_css is not encapsulated in quotes ("" ), which causes the value to be sent as a string instead. |
parameters
Parameters
connection
(BrazeEx.Connection): Connection to serveropts
(keyword): Optional parameters:"Content-Type"
(String.t)::Authorization
(String.t)::body
(String.t):
returns
Returns
{:ok, nil}
on success{:error, Tesla.Env.t}
on failure