BrazeEx.Api.TemplatesContentBlocks (braze_ex v1.0.4)

API calls for all endpoints tagged TemplatesContentBlocks.

Link to this section Summary

Functions

Create Content Block

This endpoint will create a Content Block.

See Content Block Information

This endpoint will call information for an existing Content Block.

List Available Content Blocks

This endpoint will list your existing Content Blocks information.

Update Content Block

This endpoint will 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

This endpoint will create a Content Block.

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_block_id": "newly-generated-block-id",
"liquid_tag": "generated-block-tag-from-name",
"created_at": "time-created-in-iso",
"message": success
}

possible-errors

Possible errors

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

ErrorTroubleshooting

| Content cannot be blank | | Content must be a string | Make sure your content is encapsulated in quotes (""). | | Content must be smaller than 50kb | The content in your Content Block must be less than 50kb total. | | Content contains malformed liquid | The 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 string | Make 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 characters | Content 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 exists | Try a different name. | | Content Block state must be either active or draft | | 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 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

This endpoint will call information for an existing Content Block.

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",
"name": "string",
"content": "string",
"description": "string",
"content_type": "html or text",
"tags":  "array of strings",
"created_at": "time-in-iso",
"last_edited": "time-in-iso",
"inclusion_count" : "integer",
"message": "success"
}

possible-errors

Possible errors

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 parameters 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 Developer Console > API Settings, 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

This endpoint will 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.

response

Response

Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
{
"count": "integer",
"content_blocks": [
  {
    "content_block_id": "string",
    "name": "string",
    "content_type": "html or text",
    "liquid_tag": "string",
    "inclusion_count" : "integer",
    "created_at": "time-in-iso",
    "last_edited": "time-in-iso",
    "tags" : "array of strings"
  }
]
}

possible-errors

Possible errors

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

This endpoint will update a Content Block.

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.

| content | Required | String | HTML or text content within content blocks. | state | Optional | String | Choose active or draft. Defaults to active if not specified. | | tags | Optional | Array of strings | Tags must already exist. |

response

Response

{
"content_block_id": "newly-generated-block-id",
"liquid_tag": "generated-block-tag-from-content_block_name",
"created_at": "time-created-in-iso",
"message": "success"
}

possible-errors

Possible errors

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

ErrorTroubleshooting

| Content cannot be blank | | Content must be a string | Make sure your content is encapsulated in quotes (""). | | Content must be smaller than 50kb | The content in your Content Block must be less than 50kb total. | | Content contains malformed liquid | The 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 string | Make 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 characters | Content 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 exists | Try 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 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 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