BrazeEx.Api.TemplatesContentBlocks (braze_ex v1.0.22)

API calls for all endpoints tagged TemplatesContentBlocks.

Link to this section Summary

Functions

Create Content Block

Use this endpoint to create a Content Block.

See Content Block Information

Use this endpoint to call information for your existing Content Blocks.

List Available Content Blocks

Use this endpoint to list your existing Content Blocks information.

Update Content Block

Use this endpoint to update a Content Block.

Link to this section Functions

Link to this function

content_blocks_create_post(connection, opts \\ [])

@spec content_blocks_create_post(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

create-content-block

Create Content Block

Use this endpoint to create a Content Block.

prerequisites

Prerequisites

To use this endpoint, you'll need an API key with the content_blocks.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

ParameterRequiredData TypeDescription
nameRequiredStringName of the content block. Must be less than 100 characters.
descriptionOptionalStringDescription of the content block. Must be less than 250 characters.
contentRequiredStringHTML or text content within the Content Block.
stateOptionalStringChoose active or draft. Defaults to active if not specified.
tagsOptionalArray of stringsTags must already exist.

response

Response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
"content_block_id": (string) Your newly generated block id,
"liquid_tag": (string) The generated block tag from the Content Block name,
"created_at": (string) The time the Content Block was created in ISO 8601,
"message": "success"
}

troubleshooting

Troubleshooting

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

ErrorTroubleshooting
Content cannot be blank
Content must be a stringMake sure your content is encapsulated in quotes ("").
Content must be smaller than 50kbThe content in your Content Block must be less than 50kb total.
Content contains malformed liquidThe Liquid provided is not valid or parsable. Try again with valid Liquid or reach out to support.
Content Block cannot be referenced within itself
Content Block description cannot be blank
Content Block description must be a stringMake sure your Content Block description is encapsulated in quotes ("").
Content Block description must be shorter than 250 characters
Content Block name cannot be blank
Content Block name must be shorter than 100 characters
Content Block name can only contain alphanumeric charactersContent Block names can include any of the following characters: the letters (capitalized or lowercase) A through Z, the numbers 0 through 9, dashes -, and underscores _. It cannot contain non-alphanumeric characters like emojis, !, @, ~, &, and other "special" characters.
Content Block with this name already existsTry a different name.
Content Block state must be either active or draft
Tags must be an arrayTags must be formatted as an array of strings, for example ["marketing", "promotional", "transactional"].
All tags must be stringsMake sure your tags are encapsulated in quotes ("").
Some tags could not be foundTo add a tag when creating a Content Block, the tag must already exist in Braze.

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

content_blocks_info_get(connection, opts \\ [])

@spec content_blocks_info_get(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

see-content-block-information

See Content Block Information

Use this endpoint to call information for your existing Content Blocks.

prerequisites

Prerequisites

To use this endpoint, you'll need an API key with the content_blocks.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
{
"content_block_id": (string) the Content Block identifier,
"name": (string) the name of the Content Block,
"content": (string) the content in the Content Block,
"description": (string) the Content Block description,
"content_type": (string) the content type, html or text,
"tags": (array) An array of tags formatted as strings,
"created_at": (string) The time the Content Block was created in ISO 8601,
"last_edited": (string) The time the Content Block was last edited in ISO 8601,
"inclusion_count" : (integer) the inclusion count,
"inclusion_data": (array) the inclusion data,
"message": "success",
}

troubleshooting

Troubleshooting

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

ErrorTroubleshooting
Content Block ID cannot be blankMake sure that a Content Block is listed in your request and is encapsulated in quotes ("").
Content Block ID is invalid for this App GroupThis Content Block doesn't exist or is in a different company account or app group.
Content Block has been deleted—content not availableThis Content Block, though it may have existed earlier, has been deleted.
Include Inclusion Data—errorThis parameter only accepts boolean values (true or false). Make sure the value for include_inclusion_data is not encapsulated in quotes (""), which causes the value to be sent as a string instead. See request headers for details.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :content_block_id (String.t): (Required) String The content block identifier. You can find this by either listing content block information through an API call or going to Settings > Setup and Testing > API Keys, then scrolling to the bottom and searching for your content block API identifier.
    • :include_inclusion_data (boolean()): (Optional) Boolean When set to true, the API returns back the Message Variation API identifier of campaigns and Canvases where this content block is included, to be used in subsequent calls. The results exclude archived or deleted Campaigns or Canvases.

returns

Returns

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

content_blocks_list_get(connection, opts \\ [])

@spec content_blocks_list_get(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

list-available-content-blocks

List Available Content Blocks

Use this endpoint to list your existing Content Blocks information.

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.

prerequisites

Prerequisites

To use this endpoint, you'll need an API key with the content_blocks.list permission.

request-parameters

Request parameters

ParameterRequiredData TypeDescription
modified_afterOptionalString in ISO-8601 formatRetrieve only Content Blocks updated at or after the given time.
modified_beforeOptionalString in ISO-8601 formatRetrieve only Content Blocks updated at or before the given time.
limitOptionalPositive NumberMaximum number of Content Blocks to retrieve. Default to 100 if not provided, with a maximum acceptable value of 1000.
offsetOptionalPositive NumberNumber of Content Blocks to skip before returning rest of the templates that fit the search criteria.

response

Response

Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
"count": "integer",
"content_blocks": [
  {
    "content_block_id": (string) the Content Block identifier,
    "name": (string) the name of the Content Block,
    "content_type": (string) the content type, html or text,
    "liquid_tag": (string) the Liquid tags,
    "inclusion_count" : (integer) the inclusion count,
    "created_at": (string) The time the Content Block was created in ISO 8601,
    "last_edited": (string) The time the Content Block was last edited in ISO 8601,
    "tags": (array) An array of tags formatted as strings,
  }
]
}

troubleshooting

Troubleshooting

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

ErrorTroubleshooting
Modified after time is invalidThe provided date is not a valid or parsable date. Reformat this value as a string in ISO 8601 format (yyyy-mm-ddThh:mm:ss.ffffff).
Modified before time is invalidThe provided date is not a valid or parsable date. Reformat this value as a string in ISO 8601 format (yyyy-mm-ddThh:mm:ss.ffffff).
Modified after time must be earlier than or the same as modified before time.Change the modified_after value to a time that is earlier than the modified_before time.
Content Block number limit is invalidThe limit parameter must be an integer (positive number) greater than 0.
Content Block number limit must be greater than 0Change the limit parameter to an integer greater than 0.
Content Block number limit exceeds maximum of 1000Change the limit parameter to an integer less than 1000.
Offset is invalidThe offset parameter must be an integer greater than 0.
Offset must be greater than 0Change the offset parameter to an integer greater than 0.

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 content blocks updated at or after the given time.
    • :modified_before (String.t): (Optional) String in ISO 8601 Retrieve only content blocks updated at or before the given time.
    • :limit (integer()): (Optional) Positive Number Maximum number of content blocks to retrieve. Default to 100 if not provided, with a maximum acceptable value of 1000.
    • :offset (integer()): (Optional) Positive Number Number of content blocks 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

content_blocks_update_post(connection, opts \\ [])

@spec content_blocks_update_post(
  Tesla.Env.client(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

update-content-block

Update Content Block

Use this endpoint to update a Content Block.

prerequisites

Prerequisites

To use this endpoint, you'll need an API key with the content_blocks.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

ParameterRequiredData TypeDescription
content_block_idRequiredStringYour content block's API identifier.
nameRequiredStringName of the content block. Must be less than 100 characters.
descriptionOptionalStringDescription of the content block. Must be less than 250 characters.
contentRequiredStringHTML or text content within content blocks.
stateOptionalStringChoose active or draft. Defaults to active if not specified.
tagsOptionalArray of stringsTags must already exist.

response

Response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
"content_block_id": (string) Your newly generated block id,
"liquid_tag": (string) The generated block tag from the Content Block name,
"created_at": (string) The time the Content Block was created in ISO 8601,
"message": "success"
}

troubleshooting

Troubleshooting

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

ErrorTroubleshooting
Content cannot be blank
Content must be a stringMake sure your content is encapsulated in quotes ("").
Content must be smaller than 50kbThe content in your Content Block must be less than 50kb total.
Content contains malformed liquidThe Liquid provided is not valid or parsable. Try again with valid Liquid or reach out to support.
Content Block cannot be referenced within itself
Content Block description cannot be blank
Content Block description must be a stringMake sure your Content Block description is encapsulated in quotes ("").
Content Block description must be shorter than 250 characters
Content Block name cannot be blank
Content Block name must be shorter than 100 characters
Content Block name can only contain alphanumeric charactersContent Block names can include any of the following characters: the letters (capitalized or lowercase) A through Z, the numbers 0 through 9, dashes -, and underscores _. It cannot contain non-alphanumeric characters like emojis, !, @, ~, &, and other "special" characters.
Content Block with this name already existsTry a different name.
Content Block name cannot be updated for active Content Blocks
Content Block state must be either active or draft
Active Content Block can not be updated to Draft. Create a new Content Block.
Tags must be an arrayTags must be formatted as an array of strings, for example ["marketing", "promotional", "transactional"].
All tags must be stringsMake sure your tags are encapsulated in quotes ("").
Some tags could not be foundTo add a tag when creating a Content Block, the tag must already exist in Braze.

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