Your first rule

For arlanix/notification 1.0.0

Your first rule

Three things make a notification, and each answers one question:

Answers Here
Topic What is it about? Orders
Subscription Who gets it, and how? The sales team, by email
Rule When is it sent? A new order of $100 or more

A rule sends a message to a topic, and the topic hands it to every subscription it has:

New order of $117 → rule Big orders to the sales team → topic Orders → subscription Sales team → email

A topic takes any number of subscriptions, each with its own address and way of delivery, and the messages of any number of rules.

Below, you make one of each and see an order arrive, in about ten minutes. Email has to work first: see Before you start.

1. Make the topic

  1. Open Arlanix > Notifications > Topics.

    The Arlanix menu with Topics under Notifications

  2. Click Add topic.

    The Topics grid with the Add topic button

  3. Enter a Name, Orders, and, for whoever subscribes later, a Description of what is sent to it. Leave Delivers on.

    The topic form filled in: Orders, a description, Delivers on

  4. Click Save. The topic's page stays open, now with Subscriptions under it.

    The topic's page after the save: Topic "Orders" saved., and Subscriptions with Add subscription

2. Subscribe the sales team

  1. Under Subscriptions, click Add subscription. The subscription form opens in a panel, on this topic.

  2. Enter a Name for who gets it, Sales team. Leave Gets on Everything.

  3. Under Delivery, leave Delivered by on Email and enter one Email address, such as [email protected]: your own, for now.

    The panel filled in: Sales team, Orders, Everything, Email, sales@example.com

  4. Click Save in the panel. It closes, and the topic's page lists the subscription, with Nothing sent yet under Last delivery.

    The topic's page after the save: Subscription "Sales team" saved., and the subscription in the list

  5. In the subscription's row, click Select, then Send test message.

    The Sales team row's Select open, with Send test message

  6. Above the list, the page says Test message sent. Check that it arrived., and the row's Last delivery says it was sent.

    Above the list: Test message sent. Check that it arrived., and the Sales team row

  7. The test arrives in your inbox: whatever is sent to Orders reaches the address.

    The test email: [INFO] Test notification from the store

3. Make the rule

  1. Open Arlanix > Notifications > Rules.

    The Arlanix menu with Rules under Notifications

  2. Click Add rule.

    The Rules grid with the Add rule button

  3. Enter a Name, Big orders to the sales team: the grid and the Message Log show it. Choose the Event, New order, and the Topic the message goes to, Orders.

    The rule form: Big orders to the sales team, the event New order, the topic Orders

  4. Under Conditions, click Add condition and choose Grand total, equals or greater than, 100. Without a condition, the rule would send every order.

    The condition: Grand total equals or greater than 100

  5. Under Message, enter the Subject Big order #{order.increment_id}: {order.grand_total_formatted}. The braces name the order's fields; left empty, the subject is the event's own.

  6. Click Save & Close under the arrow beside Save. The grid lists the rule.

    The Rules grid after the save: Rule "Big orders to the sales team" saved.

4. See it send

  1. Place an order of $100 or more in the store. Within a minute or so, the email arrives.

    The email the rule sent for an order of $117

    To try it without an order, Publish test message on the rule's page sends the message to Orders with sample values, marked [Test].

  2. The Message Log lists the message, with the rule that sent it and who got it.

    The Message Log: a Big order message, with the rule that sent it

From here:

  • Subscribe more people to Orders, each their own way: an address, a Telegram chat, a Slack or Discord channel. One that should hear only of problems takes only warnings and errors: see Subscriptions.
  • Add rules for other events, to this topic or a new one, such as the store's own health: see Rules.
  • Hear about a product feed that fails or delivers again: Arlanix Product Feed brings its own events, and Get told when a feed fails has rules to copy.