Whether you are new to Event Watcher or an advanced user, you can find some useful information here.
In this guide, you'll learn how to:
php -f bin/magento module:enable Mirasvit_Core Mirasvit_Event Mirasvit_Mq Mirasvit_Notificator
to enable extension.php -f bin/magento setup:upgrade
to install extension.php -f bin/magento cache:clean
for clean cache.Deploy static view files
php -f bin/magento setup:static-content:deploy
"app/code/"
directory, additionally install the required liquid/liquid
and messengers' API libraries through composer:composer require "liquid/liquid:^1.3" "irazasyed/telegram-bot-sdk:^2.2" "maknz/slack:^1.7"
Go to System -> Event Watcher and Notification -> Settings. You will see the following settings:
Allowed Error Level - allows you to select registered error levels by the extension.
Channel is a medium used for communication or the passage of information to the target recipient or a group of recipients.
Out of the box, our extension provides 3 channels:
To create a new channel follow these steps:
To use Slack, you need to create an incoming webhook. You can create it on your Slack account following this instruction.
Additionally, you can specify the following fields:
To verify a connection, you can send a test message which will be published in the default channel specified when creating an Incoming WebHook or to the channel specified in the settings.
To use Telegram, you need to obtain a bot token. To get a Bot Token, you should create a bot first. For this follow the steps below:
To get a Chat ID follow the steps below:
/my_id
to the telegram bot @get_id_bot.You can also publish messages to a group chat. To get a Group Chat ID follow the steps below:
/my_group_id
in the group (group chat ID starts with a dash symbol).
To send messages to a group, you should invite your bot (whose token is used for the channel) to the required group in Telegram.To verify the connection, you can send a test message which will be published in the chat specified in the settings.
Channel is a medium used for communication or the passage of information to the target recipient or a group of recipients.
Out of the box, our extension provides 3 channels:
To create a new channel follow these steps:
To use Slack, you need to create an incoming webhook. You can create it on your Slack account following this instruction.
Additionally, you can specify the following fields:
To verify a connection, you can send a test message which will be published in the default channel specified when creating an Incoming WebHook or to the channel specified in the settings.
To use Telegram, you need to obtain a bot token. To get a Bot Token, you should create a bot first. For this follow the steps below:
To get a Chat ID follow the steps below:
/my_id
to the telegram bot @get_id_bot.You can also publish messages to a group chat. To get a Group Chat ID follow the steps below:
/my_group_id
in the group (group chat ID starts with a dash symbol).
To send messages to a group, you should invite your bot (whose token is used for the channel) to the required group in Telegram.To verify the connection, you can send a test message which will be published in the chat specified in the settings.
Channel is a medium used for communication or the passage of information to the target recipient or a group of recipients.
Out of the box, our extension provides 3 channels:
To create a new channel follow these steps:
To use Slack, you need to create an incoming webhook. You can create it on your Slack account following this instruction.
Additionally, you can specify the following fields:
To verify a connection, you can send a test message which will be published in the default channel specified when creating an Incoming WebHook or to the channel specified in the settings.
To use Telegram, you need to obtain a bot token. To get a Bot Token, you should create a bot first. For this follow the steps below:
To get a Chat ID follow the steps below:
/my_id
to the telegram bot @get_id_bot.You can also publish messages to a group chat. To get a Group Chat ID follow the steps below:
/my_group_id
in the group (group chat ID starts with a dash symbol).
To send messages to a group, you should invite your bot (whose token is used for the channel) to the required group in Telegram.To verify the connection, you can send a test message which will be published in the chat specified in the settings.
Channel is a medium used for communication or the passage of information to the target recipient or a group of recipients.
Out of the box, our extension provides 3 channels:
To create a new channel follow these steps:
To use Slack, you need to create an incoming webhook. You can create it on your Slack account following this instruction.
Additionally, you can specify the following fields:
To verify a connection, you can send a test message which will be published in the default channel specified when creating an Incoming WebHook or to the channel specified in the settings.
To use Telegram, you need to obtain a bot token. To get a Bot Token, you should create a bot first. For this follow the steps below:
To get a Chat ID follow the steps below:
/my_id
to the telegram bot @get_id_bot.You can also publish messages to a group chat. To get a Group Chat ID follow the steps below:
/my_group_id
in the group (group chat ID starts with a dash symbol).
To send messages to a group, you should invite your bot (whose token is used for the channel) to the required group in Telegram.To verify the connection, you can send a test message which will be published in the chat specified in the settings.
Recipient is a target person who will receive the messages sent by notification.
To create a new channel follow these steps:
Notification purpose is to send messages to the specified recipients when some certain event has occurred in your system.
In this context, an event is the certain action of a visitor of your site (e.g., login, registration, placing an order) or an action of a system (e.g., change order status, cron job execution).
All notifications are located at System -> Event Watcher and Notification -> Manage Notifications section. There you can edit existing notification, or create a new one.
Event watcher & notification for Magento 2 works for different store views.
Visit System -> Event Watchers -> Manage Notifications and press Add New Notification button to open creation page. It breaks into two subsequent stages:
Each notification has Conditions section, where you can set conditions that define when notification should be sent.
All conditionals should be enclosed in the global mode block. They have four possible global modes of applying, shown in special header If *[apply mode]* of these conditions are *[validation mode]*
:
Applying modes define, when rule shall be triggered:
Validation modes define, which result can produce each condition to be counted as "met":
You can also define multiple nested mode blocks by selecting the Conditions Combination option. These modes allow creating flexible condition sets to satisfy a policy of any complexity.
Once you had selected global mode (or left it as default), press the green (+) button, and pick up a condition type.
There are many possible conditions, which depend on the every Event field. Here is their list, depending on event types:
Customer
Store
Admin (User)
Schedule
name
attribute for <job>
tag in /etc/crontab.xml
config file of the module.
mq_process
, and can be seen in /vendor/mirasvit/module-message-queue/src/Mq/etc/crontab.xml
config.
Product
These conditions are used in events of the following event groups: Customer, Shopping Cart, Wishlist, Review. They break into two large categories:
Product is one of [X] most recently added products is [Yes/No]
expression, where X
is limit of newly added products list to check.
Product is one of 10 most recently added products is Yes
.
Product is one of [X] top selling products is [Yes/No]
, where X
is also a limit for a list of top-performing products to check.
Product is one of 10 top-selling products is Yes
.
Product Special Block
There are two special options used in conditions:
If [ALL/ANY] products in cart/order matching these conditions:
, which can contain one or more Products condition from category above If [Comparison Mode] [Constant] of [Selection Mode] [Attribute] found while ALL of these conditions match
, which also can contain one or more Products condition from category above. Same
and Different
, you can pick up an Attribute and compare that attribute value to some Constant. There are three possible Comparison Modes: Equal To, More than, and Less Than.Refer to the Examples section to know how these blocks can be properly used.
Shipping Address
Quote
Order
Wishlist
Admin Notifications
Error
Back to Notification creation
Templates are the basic building blocks of Notifications sent to selected recipients (store admins, for example).
The templates are used together with notification and can contain information about the event.
To edit an existing or create a new template, follow steps below:
Back to Notification creation
Depending on the event type used for notification, the following transactional variables are available:
{{event.toString}}
- print default event message{{order.increment_id}}
- Order's number{{order.grand_total}}
- Grand total of an order
sales_order
{{wishlist.summary_qty}}
- Total quantity of products{{wishlist.summary_count}}
- Total count of products{{wishlist.subtotal}}
- Subtotal{{customer.confirmation}}
- Is Confirmed{{customer.created_at}}
- Created At{{customer.website_id}}
- Associate to Website{{customer.created_in}}
- Created From{{customer.store_id}}
- Create In{{customer.group_id}}
- Group{{customer.disable_auto_group_change}}
- Disable Automatic Group Change Based on VAT ID{{customer.prefix}}
- Name Prefix{{customer.firstname}}
- First Name{{customer.middlename}}
- Middle Name/Initial{{customer.lastname}}
- Last Name{{customer.suffix}}
- Name Suffix{{customer.email}}
- Email{{customer.default_billing}}
- Default Billing Address{{customer.default_shipping}}
- Default Shipping Address{{customer.updated_at}}
- Updated At{{customer.dob}}
- Date of Birth{{customer.failures_num}}
- Failures Number{{customer.taxvat}}
- Tax/VAT Number{{customer.gender}}
- Gender{{customer.first_failure}}
- First Failure Date{{customer.lock_expires}}
- Failures Number{{customer.lifetime_sales}}
- Lifetime Sales{{customer.number_of_orders}}
- Number of Orders{{customer.avgsale}}
- Average Sales{{customer.is_subscriber}}
- Is subscriber of newsletter{{customer.subscription_status}}
- Newsletter subscription status{{customer.reviews_count}}
- Number of reviews{{customer.last_activity}}
- Last activity (in days){{store.lifetime}}
- Lifetime Sales{{store.num_orders}}
- Number of Orders{{product.name}}
- Name{{product.qty}}
- Product stock quantity{{product.activity}}
- Activity{{product.attribute_set_id}}
- Attribute Set{{product.category_ids}}
- Category{{product.category_gear}}
- Category Gear{{product.climate}}
- Climate{{product.collar}}
- Collar{{product.color}}
- Color{{product.eco_collection}}
- Eco Collection{{product.erin_recommends}}
- Erin Recommends{{product.features_bags}}
- Features{{product.format}}
- Format{{product.gender}}
- Gender{{product.material}}
- Material{{product.new}}
- New{{product.pattern}}
- Pattern{{product.performance_fabric}}
- Performance Fabric{{product.sku}}
- SKU{{product.sale}}
- Sale{{product.size}}
- Size{{product.sleeve}}
- Sleeve{{product.strap_bags}}
- Strap/Handle{{product.style_bags}}
- Style Bags{{product.style_bottom}}
- Style Bottom{{product.style_general}}
- Style GeneralIn notification associated with order event, to display info of purchased items you can use the code below:
{% for item in order.items %}
<p>{{ item.name }}: {{ item.price }}</p>
{% endfor %}
Notification purpose is to send messages to the specified recipients when some certain event has occurred in your system.
In this context, an event is the certain action of a visitor of your site (e.g., login, registration, placing an order) or an action of a system (e.g., change order status, cron job execution).
All notifications are located at System -> Event Watcher and Notification -> Manage Notifications section. There you can edit existing notification, or create a new one.
Event watcher & notification for Magento 2 works for different store views.
Visit System -> Event Watchers -> Manage Notifications and press Add New Notification button to open creation page. It breaks into two subsequent stages:
Each notification has Conditions section, where you can set conditions that define when notification should be sent.
All conditionals should be enclosed in the global mode block. They have four possible global modes of applying, shown in special header If *[apply mode]* of these conditions are *[validation mode]*
:
Applying modes define, when rule shall be triggered:
Validation modes define, which result can produce each condition to be counted as "met":
You can also define multiple nested mode blocks by selecting the Conditions Combination option. These modes allow creating flexible condition sets to satisfy a policy of any complexity.
Once you had selected global mode (or left it as default), press the green (+) button, and pick up a condition type.
There are many possible conditions, which depend on the every Event field. Here is their list, depending on event types:
Customer
Store
Admin (User)
Schedule
name
attribute for <job>
tag in /etc/crontab.xml
config file of the module.
mq_process
, and can be seen in /vendor/mirasvit/module-message-queue/src/Mq/etc/crontab.xml
config.
Product
These conditions are used in events of the following event groups: Customer, Shopping Cart, Wishlist, Review. They break into two large categories:
Product is one of [X] most recently added products is [Yes/No]
expression, where X
is limit of newly added products list to check.
Product is one of 10 most recently added products is Yes
.
Product is one of [X] top selling products is [Yes/No]
, where X
is also a limit for a list of top-performing products to check.
Product is one of 10 top-selling products is Yes
.
Product Special Block
There are two special options used in conditions:
If [ALL/ANY] products in cart/order matching these conditions:
, which can contain one or more Products condition from category above If [Comparison Mode] [Constant] of [Selection Mode] [Attribute] found while ALL of these conditions match
, which also can contain one or more Products condition from category above. Same
and Different
, you can pick up an Attribute and compare that attribute value to some Constant. There are three possible Comparison Modes: Equal To, More than, and Less Than.Refer to the Examples section to know how these blocks can be properly used.
Shipping Address
Quote
Order
Wishlist
Admin Notifications
Error
Back to Notification creation
Event is a certain action of a visitor to your site (e.g., login, registration, placing an order) or an action of a system (e.g., change order status, cron job execution).
Events are used in the notifications as a signal for the extension to start sending messages.
Each event has a set of related variables - which can be used in the template and conditions - that are used in the rules and allow you to set up a notification in such a way as to receive only the messages that interest you.
App Events
Error
This event is triggered when a new error is occurred in your site and allows you to be aware of all critical errors.
When a new error is occurred by using this event, you can immediately inform your developer on the need to investigate it. In addition, you can send a message to the support team of a company that developed the extension, which thrown an error.
Admin Events
Admin Logged In
This event is triggered whenever Admin User is logged in to the backend.
You can configure notifications to be sent when admin users use new devices to log in to your store, or even possible password stealing.
Admin Login Failed
This event is triggered whenever Admin User tries to log in to the backend but failed.
You can configure notifications to be sent when login failures reach a certain limit, so you can detect a brute-force hacker attack.
Cron Events
Cron job
The event is triggered whenever a new cron job is added to a schedule.
With this event, you can always be aware of failed and long-running cron jobs or be notified when the cron schedule has stuck and can send notifications to your server admin to handle problems with cron. Or, you can also automatically contact the support of a company that developed the extension whose cron job got failed.
Admin Notification Events
New Notification
The event is triggered whenever your site receives a new Admin Notification. These messages feature in Magento is used for notifying an admin user about variability issues, security patches, updates, and other news. Read more about them.
With this event, you can configure the extension to receive only the notifications of a selected severity, therefore, notifying different staff members about respective problems.
Product Events
Decreased QTY
The event is triggered whenever a product quantity is decreased. This event allows you to be aware, when product stock quantity falls below the threshold, and to notify responsible staff on the need to replenish the warehouse.
Product View
The event is triggered when a product is viewed by a registered customer. This rule can be used for tracking down the interest in specially promoted products, or some experimental goods.
Customer Events
Customer Logged In
The event is triggered whenever a customer logs in to the store.
Customer Logged out
The event is triggered whenever a customer logs out of the store.
New Customer Sign up
The event is triggered when a customer is registered in your store.
Customer Birthday
The event is triggered whenever a customer has a birthday.
Newsletter Events
Newsletter subscription
The event is triggered when a customer subscribes to the newsletter.
Newsletter unsubscription
The event is triggered when a customer cancels the subscription to the newsletter.
Subscription status change
The event is triggered when a customer enables or cancels the subscription to the newsletter.
Shopping Cart
Abandoned Shopping Cart
The event is triggered when the shopping cart was not updated in a reasonable period, or customer logged off but did not place an order. Criteria for such a cart can be configured at Stores -> Settings -> Configuration -> Dotmailer -> Abandoned Carts.
Order Events
Order status was changed
The event is triggered whenever the order is saved to apply some changes (it includes placing an Invoice or Shipping documents).
Order obtained 'XXX' status
Our extension features a set of generic Events, which act as a shortcut to Order was changed event with a check of Order status. These events have similar names as shown in the header (Order obtained 'Complete' status
, for example), and trigger, whenever Order receives particular status.
Review Events
New review was added
This event is triggered whenever a new Review is added (but before Approvement).
Review has been approved
This event is triggered whenever a new Review is approved and displayed in the store.
Wishlist Events
Product was added to wishlist
This event is triggered whenever a new product is added to the customer's wishlist.
Event Log is a special Grid, which holds all registered notifications sent to recipients with respective information on each event.
It is a great tool for analyzing store performance.
The grid provides the following data:
You do not receive messages
In order to send messages, the extension starts a background process, which runs continuously. It listens for the new registered events and sends notifications.
This background process is launched by cron, and it requires the function exec
to be enabled to run it.
However, you won't be able to receive the messages if this function is disabled. So, in that case you can ask your server admin to enable the PHP exec
function or just add the cron job below to the server crontab:
* * * * * <path to php binary> <magento install dir>/bin/magento mirasvit:message-queue:subscribe > /dev/null 2>&1
To upgrade the extension, follow these steps:
composer require mirasvit/module-notificator:* --update-with-dependencies
to update current extension with all dependencies.
composer update mirasvit/*
command. It will update all Mirasvit modules installed in your store. php -f bin/magento setup:upgrade
to install updates.php -f bin/magento cache:clean
to clean the cache.Deploy static view files
rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
To temporarily disable the extension please follow these steps:
php -f bin/magento module:disable Mirasvit_Notificator
to disable the extension.To uninstall the extension, please follow these steps:
composer remove mirasvit/module-notificator
to remove the extension.(2024-10-21)
(2024-08-21)
(2024-08-15)
(2024-05-23)
(2024-05-14)
(2024-01-10)
(2023-01-13)
(2022-08-16)
(2022-07-12)
(2022-06-20)
(2022-05-31)
(2022-03-15)
(2021-09-28)
(2021-07-15)
(2021-01-29)
(2020-10-23)
(2020-09-23)
(2020-09-10)
(2020-09-09)
(2020-08-26)
(2020-07-30)
(2020-03-16)
(2019-11-01)
(2019-10-28)
(2019-10-16)
(2019-10-03)
(2019-05-23)
(2019-05-14)
(2019-05-02)
(2019-04-30)
(2019-03-20)
(2019-03-20)
(2019-02-08)
(2019-02-05)
(2019-01-31)
(2019-01-22)
(2019-01-18)
(2019-01-18)
(2019-01-18)
(2019-01-17)
(2018-12-21)
(2018-12-20)
(2018-12-10)
(2018-11-29)
(2018-07-20)
(2018-04-23)
(2018-02-09)
(2018-02-05)
(2018-01-25)
(2018-01-18)
(2018-01-11)
(2017-12-01)
(2017-11-30)
(2017-11-27)
(2017-11-27)
(2017-11-23)
(2017-11-20)
(2017-11-09)
(2017-11-02)
(2017-10-30)
(2017-10-26)
(2017-10-18)