Automatically send account invite to new customers, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Automatically send account invite to new customers

by Isaac Bowen (team@usemechanic.com)

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.

Runs 1 minute after a customer is created. Configuration includes invitation email subject and invitation email body.

15-day free trial – unlimited tasks

Documentation

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

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
1 minute after a customer is created (shopify/customers/create+1.minute)
Options
invitation email subject (required), invitation email body (multiline, required)
Script
{% 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 tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.