AnsweredAssumed Answered

Triggering a campaign with custom email tokens per lead

Question asked by 7152cb8148d195149d42938b7cf888c0e59e69ab on Aug 4, 2017
Latest reply on Aug 4, 2017 by Sanford Whiteman

I am working on sending transactional emails via the trigger campaign REST API. The endpoint seems to take a list of leads. My understanding from this article is that it is not possible to supply custom program tokens per lead?

 

For example, let us say I have a "Welcome" email that is sent shortly after signup. The email includes a custom message that is different for each user, and this message is supplied by a {{my.customMessage}} token. My understanding is that I cannot trigger the campaign with JSON like this, where the email tokens for each lead is respectively taken from the "tokens" field:

{
  "input": {
    "leads": [
      {
        "id": 0
      },
      {
        "id": 1
      },
      {
        "id": 2
      }
    ],
    "tokens": [
      [{
        "name": "{{my.customMessage}}",
        "value": "Custom message for lead 0"
      }],
      [{
        "name": "{{my.customMessage}}",
        "value": "Custom message for lead 1"
      }],
      [{
        "name": "{{my.customMessage}}",
        "value": "Custom message for lead 2"
      }],
    ]
  }
}

 

My understanding is that the only batching I can do through the trigger campaign API would be the following, where the leads all get the same message:

{
  "input": {
    "leads": [
      {
        "id": 0
      },
      {
        "id": 1
      },
      {
        "id": 2
      }
    ],
    "tokens": [
      {
        "name": "{{my.customMessage}}",
        "value": "Custom message for lead 0, 1, 2"
      },
    ]
  }
}

 

Is this correct? I am just trying trigger batch and send multiple emails with custom tokens in a single API request.

Outcomes