This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation.
You can run multiple site automations that need to access up-to-date business data. For example, when launching a new promotion campaign, the email marketing and order processing automations need to use the same coupon code as created by the campaign automation. Storage items let you coordinate this data across different automations.
To share data across automations, follow these steps:
In a campaign automation, call Create Storage Item with the coupon code value SUMMERSAVE20:
Other automations in the site can now retrieve and update this item using its key.
In an email automation, call Get Storage Item with the season_coupon_code key to retrieve the coupon value. You can set the consistentRead parameter to true to ensure the data is up to date.
The method returns a response such as:
You can now include the retrieved coupon code in the email sent to customers.
Similarly, in your order processing automation, call Get Storage Item with the item's key to verify that the coupon code used by the customer matches the one created by the marketing automation.
The method returns a response such as:
The order processing automation can now validate the customer's coupon code and apply the discount.
When launching a new campaign, update the coupon code by calling Update Storage Item Value with the item's key.
The method returns a response such as:
Use the retrieved theme preference to apply the appropriate styling to the email template sent to the user.
When the user changes their preference to light mode, call Update Storage Item Value with the updated value:
Your email and order processing automations automatically use the updated coupon code.
Users may want personalized experiences based on their individual settings. For example, some users prefer dark mode while others prefer light mode, or some prefer email notifications while others prefer SMS. You can use storage items to save these preferences and ensure all automations provide a consistent, personalized experience for each user.
To store and manage user preferences, follow these steps:
Call Create Storage Item to create a user's theme preference. You can also specify tags for later filtering:
In your email automation, call Get Storage Item with the current_user_theme_preference item key to retrieve the user's theme preference:
The method returns a response such as:
Use the retrieved theme preference to style the email template.
If the user changes their preference to light mode, call Update Storage Item Value with current_user_theme_preference as the item's key, and specify light_mode as the value to update.
The method returns a response such as:
All automations that interact with this user automatically use the updated preference for consistent personalization.
Some users need to track business metrics that change over time, such as active user counts. Unlike simple counters that only increase, active user metrics require both incrementing and decrementing based on user behavior. Counter storage items support atomic updates that ensure accurate counting even when multiple automations update the same counter simultaneously.
To track and update active user metrics, follow these steps:
Call Create Storage Item to create a counter for tracking total active users:
In your user registration automation, call Update Storage Item Counter By with the value field set to 1. This increments the counter by 1 when a user signs up.
For example, if you previously had 250 users, the method returns a response such as:
The counter now accurately reflects the current number of active users after the sign-up.
In your account cleanup automation, call Update Storage Item Counter By with the value field set to -1. This decrement the counter by 1 when a user deletes their account.
For example, if you previously had 251 users, the method returns a response such as:
In your user activity monitoring automation, call Update Storage Item Counter By to decrement the counter by 1 when a user deletes their account or when they have been inactive for more than 60 days.
The method returns a response such as:
Multiple automations can now safely update the active user counter simultaneously, ensuring an accurate real-time count of the site's active user base.