[ { "label": "Send low and out of stock messages when inventory drops below a threshold", "trigger_type": [ "product_updated" ], "object_type": "product", "app_id": "triggers", "tags": [], "settings": { "priority": 0, "condition_groups": { "2": { "conditions": [], "actions": [ { "type": "trigger_child_workflow", "settings": { "target_path": "product.variants", "exported_workflow": { "label": "Variant subworkflow", "trigger_type": [ "product_variant_custom" ], "object_type": "product_variant", "app_id": "triggers", "tags": [], "settings": { "priority": 0, "condition_groups": [ { "conditions": [ { "field": "product_variant.inventory_quantity", "settings": { "operator": "lt", "value": "50", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 }, { "field": "product_variant.inventory_quantity", "settings": { "operator": "gt", "value": "0", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 }, { "field": "product_variant.database", "settings": { "multiple": "any", "key": "{{ \"now\" | date(\"mdY\") }}-low", "operator": "not_equals", "value": "true", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "slack_message", "settings": { "wait": "0", "custom_wait": "", "check_date": [], "to": "#ops-inbound", "body": "Total inventory for {{ product_variant.product.title }} - {{ product_variant.title }} is low. Total inventory is: {{ product_variant.inventory_quantity }}\r\n\r\n" }, "weight": 999, "target_key": "product_variant" }, { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "check_date": [], "resource_type": "variants", "resource_id": "{{ product_variant.id }}", "key": "{{ \"now\" | date(\"mdY\") }}-low", "value": "true" }, "weight": 999, "target_key": "product_variant" } ] }, { "conditions": [ { "field": "product_variant.inventory_quantity", "settings": { "operator": "lte", "value": "5", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 }, { "field": "product_variant.database", "settings": { "multiple": "any", "key": "{{\"now\"|date(\"W\")}}-sold", "operator": "not_equals", "value": "true", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "slack_message", "settings": { "wait": "0", "custom_wait": "", "check_date": [], "to": "#ops-inbound", "body": "Total inventory for {{ product_variant.product.title }} - {{ product_variant.title }} is SOLD OUT. Total inventory is: {{ product_variant.inventory_quantity }}\r\n" }, "weight": 999, "target_key": "product_variant" }, { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "check_date": [], "resource_type": "variants", "resource_id": "{{ product_variant.id }}", "key": "{{\"now\"|date(\"W\")}}-sold", "value": "true" }, "weight": 999, "target_key": "product_variant" } ] } ] } } }, "weight": 999, "target_key": "product" } ] } }, "shared_workflow_id": 8222 } } ]