Mechanic is a development and ecommerce automation platform for Shopify. :)
Use this task to easily contact all of your customers at once, optionally filtering by customer tag. Important: This task can only be used in a transactional context - it cannot be used be used for marketing emails, or any type of message that would require an unsubscribe link.
Runs Occurs when a user manually triggers the task. Configuration includes only send to customers having this tag, email subject, email body, and test mode.
Use this task to easily contact all of your customers at once, optionally filtering by customer tag. Important: This task can only be used in a transactional context - it cannot be used be used for marketing emails, or any type of message that would require an unsubscribe link.
This task will send your preconfigured email to all of your customers, optionally filtering by preconfigured tag. Make sure to double-check your task configuration before sending! Use test mode to receive a list of customers who will receive your email, before running without it.
Important: This task can only be used in a transactional context - it cannot be used be used for marketing emails, or any type of message that would require an unsubscribe link. Read more: What kind of email can I send with Mechanic?
Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, everybody.
That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.
(By the way, have you seen our documentation? Have you joined the Slack community?)
mechanic/user/trigger
{% comment %} Express an opinion about option order {{ options.only_send_to_customers_having_this_tag }} {{ options.email_subject__required }} {{ options.email_body__required_multiline }} {{ options.test_mode__boolean }} {% endcomment %} {% assign cursor = nil %} {% assign emails = array %} {% for n in (0..100) %} {% capture query %} query { customers( first: 250 after: {{ cursor | json }} {% if options.only_send_to_customers_having_this_tag != blank %} query: {{ options.only_send_to_customers_having_this_tag | json | prepend: "tag:" | json }} {% endif %} ) { pageInfo { hasNextPage } edges { cursor node { email } } } } {% endcapture %} {% assign result = query | shopify %} {% if event.preview %} {% capture result_json %} { "data": { "customers": { "edges": [ { "node": { "email": "customer@example.com" } } ] } } } {% endcapture %} {% assign result = result_json | parse_json %} {% endif %} {% for customer_edge in result.data.customers.edges %} {% assign customer = customer_edge.node %} {% if customer.email != blank %} {% assign emails[emails.size] = customer.email %} {% endif %} {% endfor %} {% if result.data.customers.pageInfo.hasNextPage %} {% assign cursor = result.data.customers.edges.last.cursor %} {% else %} {% break %} {% endif %} {% endfor %} {% if options.test_mode__boolean %} {% action "echo" emails %} {% else %} {% for email in emails %} {% action "email" %} { "to": {{ email | json }}, "subject": {{ options.email_subject__required | strip | json }}, "body": {{ options.email_body__required_multiline | strip | newline_to_br | json }}, "reply_to": {{ shop.customer_email | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% endfor %} {% endif %}
true