BrazeEx.Api.ExportCampaign (braze_ex v1.0.22)

API calls for all endpoints tagged ExportCampaign.

Link to this section Summary

Functions

Export Campaign Analytics

Use this endpoint to retrieve a daily series of various stats for a campaign over time.

Export Campaign Details

Use this endpoint to retrieve relevant information on a specified campaign, which can be identified by the campaign_id.

Export Campaign List

Use this endpoint to export a list of campaigns, each of which will include its name, campaign API identifier, whether it is an API campaign, and tags associated with the campaign.

Export Send Analytics

Use this endpoint to retrieve a daily series of various stats for a tracked send_id.

Link to this section Functions

Link to this function

campaigns_data_series_get(connection, opts \\ [])

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

export-campaign-analytics

Export Campaign Analytics

Use this endpoint to retrieve a daily series of various stats for a campaign over time.

Data returned includes how many messages were sent, opened, clicked, or converted by messaging channel.

Note: If you are using our older navigation, campaign_id can be found at Developer Console > API Settings.

prerequisites

Prerequisites

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

responses

Responses

multichannel-response

Multichannel response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
  "message": (required, string) the status of the export, returns 'success' when completed without errors,
  "data" : [
      {
          "time" : (string) date as ISO 8601 date,
          "messages" : {
              "ios_push" : [
                  {
                    "variation_name": "iOS_Push",
                    "sent" : (int),
                    "direct_opens" : (int),
                    "total_opens" : (int),
                    "bounces" : (int),
                    "body_clicks" : (int)
                    "revenue": 0,
                    "unique_recipients": 1,
                    "conversions": 0,
                    "conversions_by_send_time": 0,
                    "conversions1": 0,
                    "conversions1_by_send_time": 0,
                    "conversions2": 0,
                    "conversions2_by_send_time": 0,
                    "conversions3": 0,
                    "conversions3_by_send_time": 0,
                    "carousel_slide_[NUM]_[TITLE]_click": (optional, int),
                    "notif_button_[NUM]_[TITLE]_click": (optional, int)
                  }
              ],
              "android_push" : [
                  {
                    "sent" : (int),
                    "direct_opens" : (int),
                    "total_opens" : (int),
                    "bounces" : (int),
                    "body_clicks" : (int)
                  }
              ],
              "webhook": [
                  {
                    "sent": (int),
                    "errors": (int)
                  }
              ],
              "email" : [
                  {
                    "sent": (int),
                    "opens": (int),
                    "unique_opens": (int),
                    "clicks": (int),
                    "unique_clicks": (int),
                    "unsubscribes": (int),
                    "bounces": (int),
                    "delivered": (int),
                    "reported_spam": (int)
                  }
              ],
              "sms" : [
                {
                  "sent": (int),
                  "delivered": (int),
                  "undelivered": (int),
                  "delivery_failed": (int)
                }
              ]
            },
         "conversions_by_send_time": (optional, int),
         "conversions1_by_send_time": (optional, int),
         "conversions2_by_send_time": (optional, int),
         "conversions3_by_send_time": (optional, int),
         "conversions": (int),
         "conversions1": (optional, int),
         "conversions2": (optional, int),
         "conversions3": (optional, int),
         "unique_recipients": (int),
         "revenue": (optional, float)
      },
      ...
  ],
  ...
}

multivariate-response

Multivariate response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
  "data" : [
      {
          "time" : (string) date as ISO 8601 date,
          "conversions" : (int),
          "revenue": (float),
          "conversions_by_send_time": (int),
          "messages" : {
             "trigger_in_app_message": [{
                    "variation_name": (optional, string),
                    "impressions": (int),
                    "clicks": (int),
                    "first_button_clicks": (int),
                    "second_button_clicks": (int),
                    "revenue": (optional, float),,
                    "unique_recipients": (int),
                    "conversions": (optional, int),
                    "conversions_by_send_time": (optional, int),
                    "conversions1": (optional, int),
                    "conversions1_by_send_time": (optional, int),
                    "conversions2": (optional, int),
                    "conversions2_by_send_time": (optional, int),
                    "conversions3": (optional, int),
                    "conversions3_by_send_time": (optional, int)
                }, {
                    "variation_name": (optional, string),
                    "impressions": (int),
                    "clicks": (int),
                    "first_button_clicks": (int),
                    "second_button_clicks": (int),
                    "revenue": (optional, float),,
                    "unique_recipients": (int),
                    "conversions": (optional, int),
                    "conversions_by_send_time": (optional, int),
                    "conversions1": (optional, int),
                    "conversions1_by_send_time": (optional, int),
                    "conversions2": (optional, int),
                    "conversions2_by_send_time": (optional, int),
                    "conversions3": (optional, int).
                    "conversions3_by_send_time": (optional, int)
                }, {
                    "variation_name": (optional, string),
                    "revenue": (optional, float),,
                    "unique_recipients": (int),
                    "conversions": (optional, int),
                    "conversions_by_send_time": (optional, int),
                    "conversions1": (optional, int),
                    "conversions1_by_send_time": (optional, int),
                    "conversions2": (optional, int),
                    "conversions2_by_send_time": (optional, int),
                    "conversions3": (optional, int),
                    "conversions3_by_send_time": (optional, int),
                    "enrolled": (optional, int)
                }]
            },
            "conversions_by_send_time": (optional, int),
            "conversions1_by_send_time": (optional, int),
            "conversions2_by_send_time": (optional, int),
            "conversions3_by_send_time": (optional, int),
            "conversions": (optional, int,
            "conversions1": (optional, int),
            "conversions2": (optional, int),
            "conversions3": (optional, int),
            "unique_recipients": (int),
            "revenue": (optional, float)
       }],
       ...
}

Possible message types are email, in_app_message, webhook, android_push, ios_push, kindle_push, web_push. All push message types will have the same statistics shown for android_push.

Tip: For help with CSV and API exports, visit Export troubleshooting.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :campaign_id (String.t): (Required) String See campaign API identifier. The campaign_id for API campaigns can be found at Settings > Setup and Testing > API Keys and the Campaign Details page within your dashboard, or you can use the List campaigns endpoint.
    • :length (integer()): (Required) Integer Max number of days before ending_at to include in the returned series. Must be between 1 and 100 (inclusive).
    • :ending_at (String.t): (Optional) Datetime (ISO 8601 string) Date on which the data series should end. Defaults to time of the request.

returns

Returns

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

campaigns_details_get(connection, opts \\ [])

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

export-campaign-details

Export Campaign Details

Use this endpoint to retrieve relevant information on a specified campaign, which can be identified by the campaign_id.

If you want to retrieve Canvas data, refer to the Canvas Details endpoint.

Note: If you are using our older navigation, campaign_id can be found at Developer Console > API Settings

prerequisites

Prerequisites

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

responses

Responses

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
  "message": (required, string) the status of the export, returns 'success' when completed without errors,
  "created_at" : (string) the date created as ISO 8601 date,
  "updated_at" : (string) the date last updated as ISO 8601 date,
  "archived": (boolean) whether this campaign is archived,
  "draft": (boolean) whether this campaign is a draft,
  "name" : (string) the campaign name,
  "description" : (string) the campaign description,
  "schedule_type" : (string) the type of scheduling action,
  "channels" : (array) the list of channels to send via,
  "first_sent" : (string) the date and hour of first sent as ISO 8601 date,
  "last_sent" : (string) the date and hour of last sent as ISO 8601 date,
  "tags" : (array) the tag names associated with the campaign,
  "messages": {
      "message_variation_id": (string) { // <=This is the actual id
          "channel": (string) the channel type of the message, must be either email, ios_push, webhook, content_card, in-app_message, or sms,
          "name": (string) the name of the message in the dashboard (eg., "Variation 1")
          ... channel-specific fields for this message, see the following messages section ...
      }
  },
  "conversion_behaviors": (array) the conversion event behaviors assigned to the campaign, see the following conversions behavior section.
}

messages

Messages

The messages response will contain information about each message. The following includes example message responses for each channel:

Push channels

{
  "channel": (string) description of the channel, such as "ios_push" or "android_push"
  "alert": (string) alert body text,
  "extras": (hash) any key value pairs provided
}

Email channel

{
  "channel": "email",
  "subject": (string) subject,
  "body": (string) HTML body,
  "from": (string) from address and display name,
  "reply_to": (string) reply-to for message, if different than "from" address,
  "title": (string) name of the email,
  "extras": (hash) any key value pairs provided
}

In-app message channel

{
  "type": (string) description of in-app message type, such as "survey",
  "data": {
      "pages": [
          {
              "header": 
                  {
                       "text":(string) display text for the header of the survey,
                  }
              "choices": [
                  {
                     "choice_id": (string) choice identifier,
                     "text": (string) display text, 
                     "custom_attribute_key": (string) custom attribute key, 
                     "custom_attribute_value": (sting) custom attribute value,
                     "deleted": (boolean) deleted from live campaign, 
                  },
                  ...
              ]
          }
      ]
  }
}

Content Card channel

{
  "channel": "content_cards",
  "name": (string) name of variant,
  "extras": (hash) any key value pairs provided; only present if at least one key-value pair has been set
}

Webhook channel

{
  "channel": "webhook",
  "url": (string) url for webhook,
  "body": (string) payload body,
  "type": (string) body content type,
  "headers": (hash) specified request headers,
  "method": (string) HTTP method (e.g., "POST" or "GET"),
}

SMS channel

{
"channel": "sms",
"body": (string) payload body,
"from": (string) list of numbers associated with the subscription group,
"subscription_group_id": (string) API id of the subscription group targeted in the SMS message
}

Control Messages

{
  "channel": (string) description of the channel that the control is for,
  "type": "control"
}

conversion-behaviors

Conversion Behaviors

The conversion_behaviors array will contain information about each conversion event behavior set for the campaign. These behaviors are in order as set by the campaign. For example, Conversion Event A will be the first item in the array, Conversion Event B will be second, etc. The following lists example conversion event behavior responses:

Clicks email

{
  "type": "Clicks Email",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours
}

Opens email

{
  "type": "Opens Email",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours
}

Makes purchase (any purchase)

{
  "type": "Makes Any Purchase",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours
}

Makes purchase (specific product)

{
  "type": "Makes Specific Purchase",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,
  "product": (string) name of the product, i.e. - "Feline Body Armor"
}

Performs custom event

{
  "type": "Performs Custom Event",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,
  "custom_event_name": (string) name of the event, i.e. - "Used Feline Body Armor"
}

Upgrades app

{
  "type": "Upgrades App",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,
  "app_ids": (array|null) array of app ids, i.e. - ["12345", "67890"], or `null` if "Track sessions for any app" is selected in the UI
}

Uses app

{
  "type": "Starts Session",
  "window": (integer) number of seconds during which the user can convert on this event, i.e. - 86400, which is 24 hours,
  "app_ids": (array|null) array of app ids, i.e. - ["12345", "67890"], or `null` if "Track sessions for any app" is selected in the UI
}

Tip: For help with CSV and API exports, visit Export troubleshooting.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :campaign_id (String.t): (Required) String See campaign API identifier. The campaign_id for API campaigns can be found on the Settings > Setup and Testing > API Keys and the campaign details page within your dashboard, or you can use the Campaign List Endpoint.

returns

Returns

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

campaigns_list_get(connection, opts \\ [])

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

export-campaign-list

Export Campaign List

Use this endpoint to export a list of campaigns, each of which will include its name, campaign API identifier, whether it is an API campaign, and tags associated with the campaign.

The campaigns are returned in groups of 100 sorted by time of creation (oldest to newest by default).

prerequisites

Prerequisites

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

campaign-list-endpoint-api-response

Campaign list endpoint API response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
  "message": (required, string) the status of the export, returns 'success' when completed without errors,
  "campaigns" : [
      {
          "id" : (string) Campaign API Identifier,
          "last_edited": (ISO 8601 string) the last edited time for the message 
          "name" : (string) campaign name,
          "is_api_campaign" : (boolean) whether the campaign is an API Campaign,
          "tags" : (array) tag names associated with the campaign
      },
      ...
  ]
}

Tip: For help with CSV and API exports, visit Export troubleshooting.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :page (integer()): (Optional) Integer The page of campaigns to return, defaults to 0 (returns the first set of up to 100).
    • :include_archived (boolean()): (Optional) Boolean Whether or not to include archived campaigns, defaults to false.
    • :sort_direction (String.t): (Optional) String - Sort creation time from newest to oldest: pass in the value desc. - Sort creation time from oldest to newest: pass in the value asc. If sort_direction is not included, the default order is oldest to newest.
    • :"last_edit.time[gt]" (String.t): (Optional) Datetime (ISO 8601 string) Filters the results and only returns campaigns that were edited greater than the time provided till now. Format is yyyy-MM-DDTHH:mm:ss.

returns

Returns

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

sends_data_series_get(connection, opts \\ [])

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

export-send-analytics

Export Send Analytics

Use this endpoint to retrieve a daily series of various stats for a tracked send_id.

Braze stores send analytics for 14 days after the send.

Campaign conversions will be attributed towards the most recent send id that a given user has received from the campaign.

prerequisites

Prerequisites

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

send-analytics-endpoint-api-response

Send analytics endpoint API response

Content-Type: application/json
Authorization: Bearer YOUR-REST-API-KEY
{
          "variation_name": (string) variation name,
          "sent": (int) the number of sends,
          "delivered": (int) the number of messages successfully delivered,
          "undelivered": (int) the number of undelivered,
          "delivery_failed": (int) the number of rejected,
          "direct_opens": (int) the number of direct opens,
          "total_opens": (int) the number of total opens,
          "bounces": (int) the number of bounces,
          "body_clicks": (int) the number of body clicks,
          "revenue": (float) the number of dollars of revenue (USD),
          "unique_recipients": (int) the number of unique recipients,
          "conversions": (int) the number of conversions,
          "conversions_by_send_time": (int) the number of conversions,
          "conversions1": (int, optional) the number of conversions for the second conversion event,
          "conversions1_by_send_time": (int, optional) the number of conversions for the second conversion event by send time,
          "conversions2": (int, optional) the number of conversions for the third conversion event,
          "conversions2_by_send_time": (int, optional) the number of conversions for the third conversion event by send time,
          "conversions3": (int, optional) the number of conversions for the fourth conversion event,
          "conversions3_by_send_time": (int, optional) the number of conversions for the fourth conversion event by send time
        }
      ]
    },
    "conversions_by_send_time": 0,
    "conversions1_by_send_time": 0,
    "conversions2_by_send_time": 0,
    "conversions3_by_send_time": 0,
    "conversions": 0,
    "conversions1": 0,
    "conversions2": 0,
    "conversions3": 0,
    "unique_recipients": 1,
    "revenue": 0
  }
],
"message": "success"
}

Tip: For help with CSV and API exports, visit Export troubleshooting.

parameters

Parameters

  • connection (BrazeEx.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :Authorization (String.t):
    • :campaign_id (String.t): (Required) String See Campaign API identifier.
    • :send_id (String.t): (Required) String See Send API identifier.
    • :length (integer()): (Required) Integer Max number of days before ending_at to include in the returned series. Must be between 1 and 100 (inclusive).
    • :ending_at (String.t): (Optional) Datetime (ISO 8601 string) Date on which the data series should end. Defaults to time of the request.

returns

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure