Skip to main content

Community

Connector Improvement: Message preheaders in Braze messages

Answered

Please sign in to leave a comment.

Comments

3 comments

  • Official comment

    Hi Graeme,

    Luke from the Product team here. Thanks for submitting this request!

    The only mention I see of preheader in Braze's API docs is on the email_template object: https://www.braze.com/docs/api/endpoints/templates/email_templates/get_see_email_template_information. However, I'm not sure how to join this data back to the message_variation. The preheader field is not included in the endpoint we use to get the data in the message_variation table. We use canvas details to populate that table: https://www.braze.com/docs/api/endpoints/export/canvas/get_canvas_details/#messages-by-channel.

    Any insight you can share would help us address this request faster. Otherwise, we'll keep investigating ourselves.

    Cheers,  
    Luke

    Hi Luke,

    So the Braze docs are a little confusing. Both Canvas Details and Campaign Details include the email messages that have a number of properties including preheader.

    Here's the payload for each channel message: https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaign_details/#messages-by-channel

    Here's an example:

        "messages": {
            "<MESSAGE ID HERE>": {
                "channel": "email",
                "name": "<NAME HERE>",
                "subject": "<SUBJECT HERE>",
                "body": "<HTML IS HERE>",
                "from": "<FROM ADDRESS HERE>",
                "reply_to": "<REPLY TO HERE>",
                "title": null,
                "amp_body": "",
                "preheader": "<PREHEADER HERE>",
                "custom_plain_text": null,
                "should_inline_css": false,
                "should_whitespace_preheader": false,
                "headers": null
            }
        },

    So it's as simple as pulling preheader when you pull all the other email components. 

    And just to clarify, https://www.braze.com/docs/api/endpoints/export/canvas/get_canvas_details/#messages-by-channel is not actually reflective of what the API returns. 

    Not sure why they don't update it, but the documentation on the campaigns details page is correct: https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaign_details/#messages-by-channel

    Here's a sample response from the canvas details (redacted)

    {
      "created_at": "YYYY-MM-DDTHH:MM:SS+00:00",
      "updated_at": "YYYY-MM-DDTHH:MM:SS+00:00",
      "name": "EXAMPLE_CAMPAIGN_NAME",
      "description": "",
      "archived": false,
      "draft": true,
      "enabled": false,
      "has_post_launch_draft": false,
      "schedule_type": "action_based",
      "first_entry": null,
      "last_entry": null,
      "channels": [
        "android_push",
        "ios_push",
        "email"
      ],
      "variants": [
        {
          "id": "variant-id-1",
          "name": "Variant 1",
          "first_step_ids": ["step-id-1"],
          "first_step_id": "step-id-1"
        }
      ],
      "tags": [],
      "teams": [],
      "steps": [
        {
          "name": "Decision Split",
          "id": "step-id-2",
          "type": "decision_split",
          "next_paths": [
            {
              "name": "Yes",
              "next_step_id": "step-id-3"
            }
          ]
        },
        {
          "name": "Experiment Split",
          "id": "step-id-4",
          "type": "experiment_paths",
          "next_paths": [
            {
              "name": "Path A",
              "split_api_id": "split-id-1",
              "next_step_id": "step-id-5"
            }
            // ... additional paths
          ]
        },
        {
          "name": "Delay Step",
          "id": "step-id-5",
          "type": "delay",
          "next_paths": [
            {
              "name": null,
              "next_step_id": "step-id-6"
            }
          ]
        },
        {
          "name": "Message Step",
          "id": "step-id-6",
          "type": "message",
          "next_step_ids": [],
          "next_paths": [],
          "channels": [
            "android_push",
            "ios_push"
          ],
          "messages": {
            "message-id-1": {
              "channel": "android_push",
              "alert": "Example alert content",
              "title": "Example title",
              "action": "https://example.com"
            },
            "message-id-2": {
              "channel": "ios_push",
              "alert": "Example alert content",
              "title": "Example title",
              "action": "https://example.com"
            }
          }
        },
        {
          "name": "Email Message Step",
          "id": "step-id-7",
          "type": "message",
          "channels": ["email"],
          "messages": {
            "message-id-3": {
              "channel": "email",
              "subject": "Example subject",
              "body": "<html>Example HTML email</html>",
              "from": "Example <noreply@example.com>",
              "reply_to": "noreply@example.com",
              "title": null,
              "amp_body": "",
            "preheader": "Example preheader text",
              "custom_plain_text": null,
              "should_inline_css": false,
              "should_whitespace_preheader": false,
              "headers": null
            }
          },
          "next_paths": [
            {
              "name": null,
              "next_step_id": "step-id-2"
            }
          ]
        }
        // ... additional steps
      ],
      "message": "success"
    }