Tokens
Flow Tokens allow users to pass information between different Flow cards when creating their Flows.
Last updated
Was this helpful?
Flow Tokens allow users to pass information between different Flow cards when creating their Flows.
Last updated
Was this helpful?
Tokens are typed variables that can be used throughout a Flow. A token is either:
Local — Attached to a Flow's trigger card, for example the name of the user that came home.
Global — Available anywhere, for example the current time.
Both tokens can be used in a Flow card's argument, such as a textfield.
When triggering a Flow, some information might be useful to use in that Flow. For example, when it starts raining, the mm/hour could be a token.
Tokens have a pre-defined type
, which can be either string
, number
, boolean
or image
.
Users can use Flow Tokens in compatible Flow Arguments, such as a text field for string
tokens. This way, the user can make advanced flows with variables. To add tokens to a Flow card, just add a property tokens
to your Flow card manifest.
And when firing your trigger, add them as second argument:
A token can also be registered globally, so they can be used in any Flow. This means the token can be used without requiring the app to trigger the Flow. For example a weather app could expose the current temperature as a global token.
By default a device's capability are registered as global tokens.
Certain applications might want to share images between Flows, e.g. a webcam that made a snapshot, or a Chromecast that wants to cast an image. A token with type image
can be used here.
A Flow card can also have adroptoken
field, droptokens are Flow Arguments that require the input to be a token. You can read more about droptokens in the .
A Then-card can optionally return tokens in an . Similar to a When-card, specify the tokens
property as an array
, and return an object
in the run-listener of your Flow card.