Replace tokens
When dealing with templates there is often a need to replace parts of the template with specific data.
An example
We have a flow asking for a name which is "Henry" and store it in the Communicator state as "communicator.name"
Template: Now we can use the name in a message like this: "Hi, {{communicator.name?you}}. How can I help you?"
Result: This will result in "Hi, Henry. How can I help you?"
You see, using tokens is nothing to be afraid of!
Keep in mind that some states like the vault are only readable in certain circumstances, read more about it at states
Defaults(Optional)
Sometimes it can be handy to set a default for certain tokens. This is especially true for testing adapters. using a default for your token is really simple: You can either set a 'default value' or specify a default in the token itself "https://my-api.com/searchcustomer?emailaddress={{[email protected]}}"
When a state variable is present it will take the variable, if not it will look for a specified default in the token. If that is also not available Tick will fallback on the default value from the state variable configured on States & Variables.
Function in tokens
Math functions
When dealing with messages or conditions it can be a great help to calculate with numbers stored already in one of your states. With the math function you can do just this.
Simple
use a token in a flow message like: {{math(flow.numericalanswer1).add(2)}} to do the math. You can use either a state or a number to work with.
Chained
Example chained: use a token in a flow message like: {{math(flow.numericalanswer1).add(2).minus(flow.numericalanswer2)}} to do the math. You can use either a state or a number to work with.