Type
magento2-module
Magento 2 multi channel notification module
magento2-module
OSL-3.0
None
None
None
None
WARNING: This module has been superseeded by MSP_Notifier, it will not be maintained anymore. Unless you are using Magento <= 2.1 consider switch to the new and improved version.
MSP Notify is a Magento 2 extension that allows to be notified when something happens in your store. (e.g. "if an admin fails to login send me a message on Slack") You can attach to any Magento 2 or custom event and get a notification to a specified channel (e.g. Slack, Telegram, Email..)
It is easily customizable and you can create your custom adapter to add even mode notification channels.
Suggested installation method is by using composer composer require msp/notify
. This module needs that the Magento cron is up and running.
First of all you need to tell Magento how you want to be notified.
Then you need to subscribe to events
When the event is triggered you receive a message on the channel you selected.
The default message contains just the event's name, if you want to have more meaningful messages read the next section.
You can customize the message that is sent by creating a new module containing a new notification_templates.xml
.
Example content for that file:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:MSP_Notify:etc/notification_templates.xsd">
<templates>
<template id="event_to_be_observed" label="Template name" file="Your_Module::path_to_your_template.phtml" module="Your_Module" />
</templates>
</config>
Your template must be placed under msp_notify
(e.g.: app/code/Vendor/Module/msp_notify/myevent.phtml
) and should be something like:
<?php
$observedObject = $block->getObject();
echo __("Object %1 has been processed", $observedObject->getName());
Optionally in the xml file you can specify a custom Block instead of the default one.
This module contains three build in adapters:
if you want to add another adapter you just need to do three things:
MSP\Notify\Api\AdapterInterface
\MSP\Notify\Base\AdapterList
using di.xml
To use slack you need an incoming webhook that can obtained following those instructions
All the other fields are optional.
/newbot
/my_id
Chat Id
fieldThe same procedure can be applied for a Telegram group by temporary adding the get_id_bot
as group member.
After you get the Chat ID you should remove it.
This is easy! Just specify email object and recipients (separated by commas)