You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Braze API发送邮件时,trigger_properties数据无法在模板显示

解决Braze API事务性邮件trigger_properties数据无法在模板显示的问题

问题情况

我用Braze API发送事务性邮件,手动触发发送功能是正常的,但在下面的curl请求里,我在trigger_properties中传入了自定义数据first_name,却没法在邮件模板里显示这个数据。

请求命令

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": "xxxx@xxxx.com"
        }
      }
    ]
  }' \
  https://rest.fra-01.braze.eu/campaigns/trigger/send

邮件模板

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

解决方案

问题出在模板的语法错误:

  • Braze模板中引用变量只需要单一层的${变量名}格式,不需要嵌套双大括号{{}}
  • 条件判断的语法格式有误,多余的嵌套括号会导致变量无法被识别

修正后的模板如下:

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

额外检查点

如果修正后还是无法显示,可排查:

  • 确认trigger_properties在API请求中的位置正确(你当前的请求里,全局和收件人层级都设置了该字段,这部分没问题)
  • 检查邮件模板是否和当前触发的活动正确关联,避免模板与活动不匹配

内容的提问来源于stack exchange,提问作者Melchia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 12:23:03