Hi all,
I want to add a profile filter to a flow trigger that will filter based on the event data.
High-level usecase:
When a product drops in price, I want to send an email to all profiles that have this product in their wishlist.
More specifically:
- Profiles have an attribute called “wishlist_product_ids” - which is an array of uuids (strings)
- I have a metric called “price drop”
- The events related to this metric have a property called “product_id”, which is a uuid (string) of the product for which the price dropped
- I want to filter out all profiles that do not have this event’s “product_id” in their “wishlist_product_ids” array.
Ideas towards a solution:
Ideally I’d just access event data inside the profile filters. But it does not seem like we have access to product data inside the profile filters. So I can not figure out how to accomplish this.
Perhaps there is some way it is possible in the template? Since we have access to both the product data (using the {% catalog %} tags as well as the profile data. I know there is a way to cancel the e-mail based on whether a product is “unpublished” or not - perhaps we can also cancel the e-mail based on other conditions, using the template syntax?
If that is the case I could:
- with every price drop event send the number of times that product has been wishlisted.
- add a trigger filter event.wishlist_count > 0
- add a profile filter profile.wishlist_product_ids has at least one item
- in the template use some logic to cancel e-mails if the profile.wishlist_product_ids does not contain event.product_id
Any suggestions and all ideas welcome!