[ { "label": "Text a discount code to a customer 30 days after first order", "trigger_type": [ "order_paid" ], "object_type": "order", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": [ { "conditions": [ { "field": "order.customer.accepts_marketing", "settings": { "value": "true" }, "weight": 1 }, { "field": "order.customer.phone", "settings": { "operator": "not_empty", "value": "" }, "weight": 2 }, { "field": "order.customer.database", "settings": { "multiple": "any", "key": "sms_discount", "operator": "empty", "value": "", "condition_type": "AND" }, "weight": 3 }, { "field": "order.delay", "settings": { "wait": "2592000", "custom_wait": "", "condition_type": "AND" }, "weight": 4 } ], "actions": [ { "type": "sms", "settings": { "wait": "0", "custom_wait": "", "to": "{{ order.customer.phone }}", "body": "Use code [CODE] for 20% off your next order at {{ shop.name }}" }, "weight": 999, "target_key": "order" }, { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "resource_type": "customers", "resource_id": "{{ order.customer.id }}", "key": "sms_discount", "value": "SENT {{ \"now\" | date }}" }, "weight": 999, "target_key": "order" } ] } ], "shared_workflow_id": 1111 }, "description": "This is automation is fired when an order is raised, it checks if the customer has the accepts marketing option enabled the waits for a month before sending out a discount code on SMS. The workflow also checks if the discount code has already been sent to prevent sending the code more than once." } ]