Braze send data to be displayed in campaign email

229 Views Asked by At

I'm using braze API to send transactional emails. For now I'm triggering the sent manually using their API which works fine. But in this command below you see I'm sending a custom data in trigger_properties first_name. I'm unable for now to display it in the email (see the template below)

curl -X POST \
  -H 'Content-Type:application/json' \
  -d '{
    "campaign_id": "9854b86c-c185-3362-78a9-c442763bed9e",
    "trigger_properties": {
      "first_name":"First Name"
    },
    "broadcast": false,
    "recipients": [
      {
        "external_user_id": "xxxxx",
        "trigger_properties": {
          "first_name":"First Name"
        },
        "send_to_existing_only": false,
        "attributes": {
          "first_name": "xxxxx",
          "last_name": "xxxxx",
          "email": "[email protected]"
        }
      }
    ]
  }' \
  https://rest.fra-01.braze.eu/campaigns/trigger/send

A simple template:

Discover a new restaurant today{% if {{${first_name}}} == nil %}!{% else %}, {{${first_name}}}!{% endif %}
1

There are 1 best solutions below

0
On

Ok I was able to find it. In the template the variable should be like this:

{{api_trigger_properties.${first_name} | default: 'there'}}