Re: My.Token value not updating on REST API call

Anonymous
Not applicable

My.Token value not updating on REST API call

Hello,

I'm trying to replace the value of a my.token and send an email out using the REST API. I'm able to send the email just fine, but the my.token (my.bodyReplacement) is only adding the default value to my email. What am I doing wrong here?

This is the JSON we are sending to update the value of a token.

{

  "input": {

    "leads": [

      {

        "id": 327947

      }

    ],

    "tokens": [

      {

          "name": "{{my.bodyReplacement}}",

        "value": "Hello World, this is your new body text"

      }

    ]

  }

}

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: My.Token value not updating on REST API call

Just

     "name" : "bodyReplacement"

Anonymous
Not applicable

Re: My.Token value not updating on REST API call

I tried that and it didn't pull through.

I also tried {{bodyReplacement}}

and bodyReplacement

with and without {{}}

{

  "input": {

    "leads": [

      {

        "id": 327947

      }

    ],

    "tokens": [

      {

          "name": "bodyReplacement",

        "value": "Hello World, this is your new body text"

      }

    ]

  }

}

The documentation says:

{"input":{"leads":[{"id":1}],"tokens":[{"name":"{{my.bodyReplacement}}","value":"<div class="replacedContent"><p>This content has been replaced</p></div>"}]}}

Is there a better piece of documentation?
SanfordWhiteman
Level 10 - Community Moderator

Re: My.Token value not updating on REST API call

It's definitely not all those options! This request to /trigger.json works for me:

{

  "input": {

    "leads": [

      {

        "id": 3893678

      }

    ],

    "tokens": [

      {

        "name": "apiToken2",

        "value": "12345"

      }

    ]

  }

}

Anonymous
Not applicable

Re: My.Token value not updating on REST API call

The token type needed to be type text.

They were created as script block.

Thank you for your help!

SanfordWhiteman
Level 10 - Community Moderator

Re: My.Token value not updating on REST API call

Right, Velocity tokens can't be (very unfortunately) overridden this way.