Mechanic Get Mechanic
Task library

Automatically send account invite to new customers

This task keeps an eye on customers as you create or import them in Shopify, and automatically sends account invitations to any customers that have an email address.

Try this task

When it runs

Occurs whenever a customer is created, with a 1 minute delay

What you choose

  • Invitation email subject
  • Invitation email body

Documentation

This task keeps an eye on customers as you create or import them in Shopify, and automatically sends account invitations to any customers that have an email address.

This task sends account invitations to newly-created customers, whether created/imported through the Shopify admin or through another app. It does not send invitation emails for customers without an email address, or to customers who've signed up via your online store. (Wondering about the 1-minute delay? It's because customers who sign themselves up aren't marked as such until a few seconds after their account is created. So, Mechanic waits a minute, just to be sure.)

Task code and subscriptions

You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.

Subscriptions

shopify/customers/create+1.minute
How task subscriptions work

Option types and flags

Task code

{% assign customer = customer.reload %}

{% assign customer_qualifies = false %}
{% if customer.state == "disabled" and customer.email != blank %}
  {% assign customer_qualifies = true %}
{% endif %}

{% if event.preview or customer_qualifies %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "post",
        "/admin/customers/{{ customer.id }}/send_invite.json",
        {
          "customer_invite": {
            "subject": {{ options.invitation_email_subject__required | json }},
            "custom_message": {{ options.invitation_email_body__multiline_required | json }}
          }
        }
      ]
    }
  }
{% endif %}
Mechanic Liquid reference