Auto-invite customers when tagged, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

Auto-invite customers when tagged

This task watches for updates to customers, and sends invites for any customer who has the tag you choose, who hasn't previously been invited. If you'd like to run this task in bulk, you can find that version of the task here.

Runs Occurs whenever a customer is created and Occurs whenever a customer is updated. Configuration includes tag to watch for, ignore tag case, invitation email subject, and invitation email body.

15-day free trial – unlimited tasks

Documentation

This task watches for updates to customers, and sends invites for any customer who has the tag you choose, who hasn't previously been invited. If you'd like to run this task in bulk, you can find that version of the task here.

This task watches for updates to customers, and sends invites for any customer who has the tag you choose, who hasn't previously been invited.

Invitation emails are sent using your store's account invite notification email template. Learn how to update this template.

Developer details

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?)

Open source
View on GitHub to contribute to this task
Subscriptions
shopify/customers/create
shopify/customers/update
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
tag to watch for (required), ignore tag case (boolean), invitation email subject (required), invitation email body (multiline, required)
Code
{% assign customers = array %}

{% if event.preview %}
  {% assign customers[0] = hash %}
  {% assign customers[0]["id"] = 1234567890 %}
{% elsif event.topic contains "shopify/customers/" %}
  {% assign customer_qualifies = true %}

  {% assign customer_tags = customer.tags | split: ", " %}
  {% assign tag = options.tag_to_watch_for__required %}

  {% if options.ignore_tag_case__boolean %}
    {% assign customer_tags = customer.tags | downcase | split: ", " %}
    {% assign tag = tag | downcase %}
    {% unless customer_tags contains tag %}
      {% assign customer_qualifies = false %}
    {% endunless %}
  {% else %}
    {% unless customer_tags contains tag %}
      {% assign customer_qualifies = false %}
    {% endunless %}
  {% endif %}

  {% if customer.state != "disabled" %}
    {% assign customer_qualifies = false %}
  {% endif %}

  {% if customer_qualifies %}
    {% assign customers[customers.size] = customer %}
  {% endif %}
{% endif %}

{% for customer in customers %}
  {% action "shopify" %}
    [
      "post",
      "/admin/customers/{{ customer.id | json }}/send_invite.json",
      {
        "customer_invite": {
          "subject": {{ options.invitation_email_subject__required | json }},
          "custom_message": {{ options.invitation_email_body__multiline_required | json }}
        }
      }
    ]
  {% endaction %}
{% endfor %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more
Defaults
Tag to watch for
invite
Ignore tag case
true
Invitation email subject
Your account is ready!
Invitation email body
Your account for {{ shop.name }} has been pre-approved! Use the button below to get started.