TC4.2 - Managing Notifications on IOT Application: SMS, Telegram, email, Twitter, Dashboard events, in Push on other IOT Applications

×

Warning message

  • You can't delete this newsletter because it has not been sent to all its subscribers.
  • You can't delete this newsletter because it has not been sent to all its subscribers.

Test Case Title

TC4.2 - Managing Notifications on IOT Application: SMS, Telegram, email, Twitter, Dashboard events, in Push on other IOT Applications.

Goal

I can:

  • Get status from the Dashboard Notificator
  • Create a Telegram Bot to retrieve notification on push
  • Send notification on email
  • Show notification on a dashboard
  • Send alert on Telegram
  • Send an alert as a Twitter Tweet

Prerequisites

The user must have an email, a Twitter account, a Telegram account

The user must have created a firing condition Notification on the dashboard, see the previous TC.

Expected successful result

The creating of new blocks/MicroServices that can be installed into NodeRED editor to create applications, put them in execution, update, share them with other developers via email, portal, ProcessLoader, etc.

Steps

 

 

Firing conditions can be set for each widget of each dashboard of each user, thus actions on the verification of those conditions are defined and can be executed: blinking on dash, sending message, sending events on ESB, posting on Telegram, facebook, twitter; sending SMS, acting on multiple dashboard, acting on multiple IOT sensors, acting in Push on mobile applications, scheduling on processes, etc. etc.

Please note that the Notificator tool is accessible on Cloud only for high level users as RootAdmin. On the other and, all users kind can use the IOT App for creating their own notifcations, sending email, sms, telegram, etc. according to any rule they define there on the basis of any kind of accessible data they have. in Addition, Notificator Tool is also provided in the installation on premise as appliances in VM and Docker.


Example 1: Create a Telegram Bot

  1. Using the notifier provided by the Dashboard Builder and can create with the dedicated blocks of Telegram a personal Telegram Bot that warns us on request of any notifications from public sensors or realize their own from private sensors.
  2. Drag and drop of the "Notificator Last Events" node menu form "S4CManagement".

  1. And configure it as follow:

  1. The data that is returned by the notifiers are temporarily saved on a file and are read when the user asks the last notifications to the bot

  1. To make a bot telegram you need to create one by following the instructions on the link https://core.telegram.org/bots#6-botfather
  2. During registration you is asked to choose the name of the BOT and the access token is provided to be able to reply to incoming messages.

  1. In the flow https://iot-app.snap4city.org/nodered/nr30/ it is possible to see the entire flow. On each GetNotification call to the BOT, the file saved with the latest notifications of the selected events is read, the chatId of the person who registered with the BOT is read and they are gathered to respond to the person who submitted the request. Please note that the access to the IOT App is possible only for the owner to avoid all users testing to perform changes that could destroy the tutorial for any other users/testers. Following the tutorial you can replicate it on a your IOT App.

  1. An example of the answer is the following

 


Example 2: Send Email on Notification

  1. To send notifications through an email the flow is even simpler than that of the creation of a telegram bot. You simply have to connect the node that handles the notifications either directly to the node that sends the emails or through a node that formats the response to have a mail that is more flexible.

 

Function for example:

msg.topic = " any topic you like";
msg.payload = "any body of the email";
msg.from = "for example event on Snap4City xxxx";
return msg;

email block configured such as

It may happen that you need to allow the usage of less secure App from your gmail account. On the other hand, for some account this feature of gmail is not accessible. You have to use another SMTP server for posting your emails.

  1. The "function" node also checks that the notifications received are as desired. This example can be found at https://iot-app.snap4city.org/nodered/nr26

 


Example 3: Show notification on dashboard

  1. Showing notifications on a dashboard panel is as easy as sending them by email, in fact the flow that can perform these operations is as follows (see in https://iot-app.snap4city.org/nodered/nr29)

  1. You must insert a "single content" node choosing the name of the widget and the dashboard on which you want to insert

  1. The result is this: