Full version of the article on the GREEN-API blog available at the link. You can find a video version of the instructions on our YouTube channel.
whatsapp-zabbix-script - a script for integrating notifications from Zabbix into WhatsApp using GREEN-API.
To implement the integration, you will need Zabbix, a WhatsApp account linked to the GREEN-API instance, and a WhatsApp group, in case notifications are received in the group.
Detailed instructions for registering an account in GREEN-API can be found here. For free use, use the "Developer" tariff.
To receive messages in a WhatsApp group, you need to know the ID of this group. You can learn more about it from the full version of the article or from our documentation.
All configuration is done in the Zabbix web interface:
-
Go to the
Administration
–Media types
tab. -
Click on
Create media type
in the upper right corner and create a notification method namedWhatsApp
(Name
-WhatsApp
), select theWebhook
type for it (Type
-Webhook
). -
Add the following parameters to the Parameters of the created method, specified in the format
Name
:Value
(if theValue
field contains-
, the field remains empty):
ApiURL
: "insert ApiURL"
apiTokenInstance
: "insert apiTokenInstance"
HTTPProxy
: -
IdInstance
: "insert IdInstance"
Message
: {ALERT.MESSAGE}
ParseMode
: -
Subject
: {ALERT.MESSAGE}
ChatId
: "insert chat ID or client ID"
The values for ApiURL
, apiTokenInstance
and IdInstance
are taken from the GREEN-API console. In chatId
we insert the ID of the chat to which we are sending notifications, or the WhatsApp client ID. You can read about generating WhatsApp identifiers for a personal chat or group in the full version of the article or in the documentation.
-
In the
Script
field, paste the script provided in the repository, the Zabbix version for which the script is written is indicated in its name. You can make changes for the version you are using yourself, in accordance with the official Zabbix documentation. -
Next, go to the
Message templates
tab and add standard message templates:Problem
,Problem recovery
,Problem update
,Discovery
,Autoregistration
. The text inTemplate
can be left unchanged, or edited to your taste. -
The
Options
tab can be left unchanged. It contains notification processing settings. The parameters provided there will be identical for all message types. -
Save the created
"WhatsApp"
notification method.
To test the created notification method, go back to the Media types
tab and see the added "WhatsApp"
method. You can test it by clicking Test
on the right side of the screen on the line with this method.
As an example, in the Message
value, we will put Trigger message
, and in Subject
– Trigger fired
.
If everything was done correctly, then after clicking Test
, the Response
value will display OK.
You should also check whether the notification was delivered to the chat WhatsApp.
This method allows you to set up any notifications from Zabbix to WhatsApp for free using GREEN-API, within the framework of the "Developer" plan.
If you have any questions about our service or purchasing a paid plan, you can contact us in the following ways:
+7-999-333-12-23 for communication in Russia
+7-727-312-23-66 for communication in Kazakhstan
+44-745-803-80-17 our international number