Send account invites to all customers in bulk with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Send account invites to all customers in bulk

by Isaac Bowen (team@usemechanic.com)

Use this task to send out account invitations to all the customers you already have on file, with the push of a button. Optionally, filter by customer tag.

Runs when a user triggers the task. Configuration includes invitation email subject, invitation email body, and only invite customers with this tag.

15-day free trial – unlimited tasks

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, 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.

Events
when a user triggers the task (mechanic/user/trigger)
Options
invitation email subject (required), invitation email body (multiline, required), only invite customers with this tag
Script
{% if event.preview %}
  {
    "action": {
      "type": "email",
      "options": {
        "to": "customer@example.com",
        "subject": {{ options.invitation_email_subject__required | strip | json }},
        "body": {{ options.invitation_email_body__multiline_required | replace: "CUSTOMER_FIRST_NAME", "(customer first name)" | replace: "ACCOUNT_ACTIVATION_URL", "https://example.com/" | newline_to_br | json }},
        "reply_to": {{ shop.customer_email | json }},
        "from_display_name": {{ shop.name | json }}
      }
    }
  }
{% else %}
  {% assign customers = shop.customers %}
  {% if options.only_invite_customers_with_this_tag != blank %}
    {% assign query = "tag:" | append: options.only_invite_customers_with_this_tag %}
    {% assign customers = shop.customers.search[query] %}
  {% endif %}

  {% for customer in customers %}
    {% if customer.state != "enabled" %}
      {% assign customer_first_name = customer.first_name | default: "there" %}
      {
        "action": {
          "type": "email",
          "options": {
            "to": {{ customer.email | json }},
            "subject": {{ options.invitation_email_subject__required | strip | json }},
            "body": {{ options.invitation_email_body__multiline_required | replace: "CUSTOMER_FIRST_NAME", customer_first_name | replace: "ACCOUNT_ACTIVATION_URL", customer.account_activation_url | newline_to_br | json }},
            "reply_to": {{ shop.customer_email | json }},
            "from_display_name": {{ shop.name | json }}
          }
        }
      }
    {% endif %}
  {% endfor %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Invitation email subject
Activate your account at {{ shop.name }}
Invitation email body
Hi CUSTOMER_FIRST_NAME,

Just one step left:

<b><a href="ACCOUNT_ACTIVATION_URL">Activate your account</a></b>

Thanks,
{{ shop.name }}