Actions Transaction Metadata is currently in Early Access. To learn more, read Product Release Stages.
- Share data across Actions, such as API responses or intermediate calculations.
- Eliminate the need to re-fetch or re-calculate the same information in different Actions.
Before using transaction metadata in development, we recommend reviewing the limitations. To learn more, read Actions Limitations.
How it works
Use the post-login API objectapi.transaction.setMetadata
to set the key/value pair in order to store transaction metadata.
Use the post-login Event object event.transaction.metadata
to access stored key/value pair in the same Action or subsequent Actions on the post-login trigger for a single execution.
The API and Event objects accept the following parameters:
Value | Type | Description |
---|---|---|
Key | String | The key of the metadata property to be set. |
Value | String , Number , Boolean | The value of the metadata property. Set to null removes the property. |
Latency
Using Actions Transaction Metadata could cause a nominal additional latency. Any latency would be proportional to the metadata payload size and would be relevant when Action suspensions happen. For example, triggering , redirecting from Actions, or rendering Forms, could cause latency issues due to the need of reloading data from storage. Still, the potential latency should be minimal than the redundant outgoing HTTP requests to retrieve data the sequence of Actions needs.Examples
Access metadata immediately
Set key/value pairs in transaction metadata and access values immediately.Set supported values
Set values of types:string
, number
, and boolean
.
Serialize values
Serialize values asstrings
within limits.
You cannot set values of types:
object
or array
, but you can serialize as strings.
Share values between Actions
Share key/value pairs between Actions in the same execution sequence. Action 1 Sethello
key with Auth0
value with the api
object setMetadata
method.
Auth0
value for hello
key in the transaction metadata with the event
object transaction.metadata
property to access the set values.
Update metadata
Set an existing key with a different value to update metadata. Action 1 Set transaction metadata key/value pair ascustom_tx_id
and xyz123
.
custom_tx_id
and the value as xyz123
. Then, set custom_tx_id
to abc456
to log again with the latest value for custom_tx_id
in the transaction metadata.
abc456
value for custom_tx_id
.
Remove metadata
Remove transaction metadata values by nullifying the value of each particular key. Action 1 Setcustom_tx_id
in the transaction metadata.
custom_tx_id
to null
and log the null
value for custom_tx_id
.
null
value for custom_tx_id
.
Preserve values on redirect to external sites
Preserve transaction metadata during redirects. Values are available when users continue the authentication flow. Action 1 Sets acustom_tx_id
in the transaction metadata.
custom_tx_id
from the transaction metadata. Then it compares the custom_tx_id
value at the transaction metadata with the one passed to the external site that has been sent back in the payload of another token.
Preserve values on Forms rendering
Render Forms using Actions and transaction metadata values would be preserved and available when users continue the authentication flow. To learn more about using Forms with Actions, read Render Forms using Actions. Action 1 Sets acustom_tx_id
in the transaction metadata.
custom_tx_id
when continuing the Actions execution.
Share values with Forms
You can render Forms using Actions and pass transaction metadata values to the Form. Action 1 Sets acustom_tx_id
in the transaction metadata.
custom_tx_id
from the transaction metadata as vars
parameter. Then it compares the custom_tx_id
value at the transaction metadata with the one passed to the Form, when continuing the Actions execution.