It's Pimcore Bundle to send notifications to Discord, Google Chat, Slack, Telegram, Email or SMS from admin panel inside Pimcore
First of all you need to add notifier to your config/config.yaml file otherwise bundle won't install properly
framework:
notifier:
chatter_transports:
slack: '%env(SLACK_DSN)%'
googlechat: '%env(GOOGLECHAT_DSN)%'
discord: '%env(DISCORD_DSN)%'
telegram: '%env(TELEGRAM_DSN)%'
texter_transports:
smsapi: '%env(SMSAPI_DSN)%'
Then you can install and enable the bundle
composer require lemonmind/pimcore-message-bundle
// config/bundles.php
LemonmindMessageBundle::class => ['all' => true]
And finally in your config/config.yaml file you need to add
lemonmind_message:
allowed_chatters: googlechat,discord,slack,telegram,email,sms
classes:
Pimcore\Model\DataObject\YOUR_CLASS:
fields_to_send: series,Carclass,country,price,bodystyle,manufacturer
email_to_send: some@email.com
sms_to: PHONE_NUMBER
where:
YOUR_CLASS:
is your class from which notifications will be sentfields_to_send
is your class fields separated with coma without spaceemail_to_send
is e-mail you want to send notification tosms_to
is the phone number to which you want to send the notification
It is possible to add multiple classes from which you can send notifications
You need to specify which chatters should be available using allowed chatters
option
lemonmind_message:
allowed_chatters: googlechat,discord,slack,telegram,email,sms
classes:
Pimcore\Model\DataObject\Car:
fields_to_send: series,Carclass,country,price,bodystyle,manufacturer
email_to_send: some@email.com
sms_to: PHONE_NUMBER
Pimcore\Model\DataObject\Manufacturer:
fields_to_send: name
After correct installation button for sending the notification should be visible only in your class that you defined earlier
When you click at the button a modal should pop up where you can select where you want to send notification and add additional information to the message.
MessageBundle can send asynchronous messages via Symfony Messenger Component. To do that in your config/config.yaml file you need to add lines below
framework:
messenger:
transports:
async: "%env(MESSENGER_TRANSPORT_DSN)%"
routing:
'LemonMind\MessageBundle\Message\CreateNotification': async
Also in your .env file you need to add
MESSENGER_TRANSPORT_DSN=doctrine://default
where:
MESSENGER_TRANSPORT_DSN
is your messenger transport dsn. It can be redis, RabbitMQ or database
Finally, you need to start consuming messages. To do this in your php container, run this command
php bin/console messenger:consume async
It is not recommended to keep this process for a long time. It's better to use supervisord.
To integrate this bundle with Discord you need to add dsn in your .env file
DISCORD_DSN=discord://TOKEN@default?webhook_id=ID
where:
TOKEN
is your secure token of the webhook (returned for Incoming Webhooks)ID
is the id of the webhook
To integrate this bundle with Google Chat you need to add dsn in your .env file
GOOGLE_CHAT_DSN=googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY
where:
ACCESS_KEY
is your Google Chat webhook access keyACCESS_TOKEN
is your Google Chat webhook access tokenSPACE
is the Google Chat spaceTHREAD_KEY
is the Google Chat message thread to group messages into a single thread (optional)
To integrate this bundle with Slack you need to add dsn in your .env file
SLACK_DSN=slack://TOKEN@default?channel=CHANNEL
where:
TOKEN
is your Bot User OAuth Access Token (they begin with xoxb-)CHANNEL
is a channel, private group, or IM channel to send message to, it can be an encoded ID, or a name.
To integrate this bundle with Telegram you need to add dsn in your .env file
TELEGRAM_DSN=telegram://TOKEN@default?channel=CHAT_ID
where:
TOKEN
is your Telegram tokenCHAT_ID
is your Telegram group chat id (starts with -)
You need to contact BotFather on Telegram to start creating your bot. Then add the bot to the group where you want it to send messages
To integrate this package with e-mail, you need to prepare as with regular Pimcore e-mail.
To integrate this package with SMSAPI, you need to add dsn in your .env file
SMSAPI_DSN=smsapi://TOKEN@default?from=FROM&fast=FAST&test=TEST
where:
TOKEN
is your API Token (OAuth)FROM
is the sender nameFAST
setting this parameter to 1 (default 0) will result in sending message with the highest priority which ensures the quickest possible time of delivery. Attention! Fast messages cost more than normal messages.TEST
setting this parameter to 1 (default 0) will result in sending message in test mode (message is validated, but not sent).
You can see your account info at https://ssl.smsapi.pl/