I'm trying to use the Transactional Messaging API (https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/transactional-messaging-api.htm) to create a password reset e-mail that could be triggered by an API call from outside SFMC. I managed to successfully create a send definition for a simple e-mail and trigger it, but I'm having trouble with something more complex.

According to https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/sendMessageSingleRecipient.htm, it is possible to pass recipient attributes in an API call. ("Information used to personalize the message for the recipient. Written as key:value pairs. The attributes match profile attributes, content attributes, or triggered send data extension attributes.") How to actually use this information to personalize the message? If I want to pass values like:

"attributes": {
  "user_code": "value"

How do I actually use "user_code" in the e-mail? Putting in %%user_code%% in the content makes my create send definition POST request (https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/createSendDefinition.htm) fail with MCMS_UTM_Validation_email_does_not_pass_validation.

1 Answer 1


You are on the right track. Your payload should look more or less like this:

  "recipient": {
    "to": "user@example.com",
    "contactKey": "123456",
    "attributes": {
      "attrib1": "foo",
      "attrib2": "bar",
      "attrib3": "42"
  "definitionKey": "MyEmail"

And referencing the above attributes in email can be done using AttributeValue function, as per:

SET @fish = AttributeValue("attrib1")
SET @horse = AttributeValue("attrib2")
SET @bird = AttributeValue("attrib3")
  • 1
    Thank you! My payload was more or less the same, but the AttributeValue part was crucial, it now works as I envisioned.
    – bst
    Jul 3, 2020 at 10:57
  • 1
    you're welcome @bst - I have also provided an answer to one of your older questions Jul 3, 2020 at 11:08
  • Lukas, thanks for sharing this solution! I'm kind of new to Marketing Cloud but have the exact same issue. The first part with the payload-stuff makes sense but 2nd with the "SET @fish = AttributeValue("attrib1")" - where should this go? Would be so thankful if you could elaborate on this? Dec 9, 2021 at 8:48
  • @MarkusKnappenJohansson - the SET fish needs to go into the email. Then your fish variable will be populated with "foo" from the payload, allowing you to display this value in the email. Dec 9, 2021 at 9:39
  • Thanks! I managed to figure out that I could just go "Attribute 1: %%=AttributeValue("attrib1")=%%" inside the content of the email. What would be the benefit of setting a variable in the beginning of the email? If I did, would this just be a block of code in the "HTML"-edit mode? Dec 9, 2021 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.