BrazeEx.Api.TemplatesEmailTemplates (braze_ex v1.0.3)

API calls for all endpoints tagged TemplatesEmailTemplates.

Link to this section Summary

Functions

Create Email Template

Use the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

See Email Template Information

Use 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 the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

Link to this section Functions

Link to this function

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 the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

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.

Use the endpoints below to create email templates on the Braze dashboard. These templates will be available on the Templates and 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.

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

ParameterRequiredData TypeDescription
template_nameRequiredStringName of your email template.
subjectRequiredStringEmail template subject line.
bodyRequiredStringEmail template body that may include HTML.
plaintext_bodyOptionalStringA plaintext version of the email template body.
preheaderOptionalStringEmail preheader used to generate previews in some clients.
tagsOptionalStringTags must already exist.
should_inline_cssOptionalBooleanEnables 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.

ErrorTroubleshooting

| 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. | | 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 server
  • opts (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
Link to this function

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 to get information on your email templates.

Use the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

Important: Templates built using the Drag & Drop Editor are not accepted.

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) 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 App Group,
"tags": (string) tag names,
"created_at": (string, in ISO 8601),
"updated_at": (string, in ISO 8601)
}

Images in this response will show in the body variable as HTML.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

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.

Use the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

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 & Drop Editor are not provided in this response.

{
"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 server
  • opts (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
Link to this function

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 the Template REST APIs to programmatically manage the email templates that you have stored on the Braze dashboard, on the Templates & Media page. Braze provides two endpoints for creating and updating your email templates.

Use the endpoints below 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 and Media page. The email template creation API endpoint will also return an email_template_id reference.<br><br>All fields other than the email_template_id are optional, but you must specify at least one field to update.

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

ParameterRequiredData TypeDescription
email_template_idRequiredStringYour email template's API identifier.
template_nameOptionalStringName of your email template.
subjectOptionalStringEmail template subject line.
bodyOptionalStringEmail template body that may include HTML.
plaintext_bodyOptionalStringA plaintext version of the email template body.
preheaderOptionalStringEmail preheader used to generate previews in some clients.
tagsOptionalStringTags must already exist.
should_inline_cssOptionalBooleanEnables 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.

possible-errors

Possible errors

The following table lists possible returned errors and their associated troubleshooting steps, if applicable.

ErrorTroubleshooting

| 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 server
  • opts (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