My.Token value not updating on REST API call | Community
Skip to main content
June 22, 2017
Question

My.Token value not updating on REST API call

  • June 22, 2017
  • 3 replies
  • 2560 views

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"

      }

    ]

  }

}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

SanfordWhiteman
Level 10
June 22, 2017

Just

     "name" : "bodyReplacement"

June 22, 2017

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
June 22, 2017

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

{

  "input": {

    "leads": [

      {

        "id": 3893678

      }

    ],

    "tokens": [

      {

        "name": "apiToken2",

        "value": "12345"

      }

    ]

  }

}

June 22, 2017

The token type needed to be type text.

They were created as script block.

Thank you for your help!

SanfordWhiteman
Level 10
June 22, 2017

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