Notifications work on top of Events feature. Blynk platform offers a flexible way to send notifications to various recipients through supported channels:
- Push Notifications to the user's smartphone
- SMS (additional charges apply)
Only registered user can be a notification recipient
Notifications are configured in the second tab of Event - > Notifications
Start with Enabling notifications by turning on this option.
Here you can assign defaut recipients to the event. End-users will not see that there are default recipients.
Example: imagine that you, as a developer or manufacturer would like to get notifications on certain state of the device for your own analysis, but you don't won't your customers to see these notifications.
Default recipients can only be taken from certain Metadata fields:
Device Ownermetadata- this one is available by default. No need to create this metadata.
Contactmetadata . Make sure email or phone number is enabled.
For example, you need to send an email to [email protected] every time the temperature of device is over critical threshold.
- 1.In Templates -> Your Template -> Metadata:Create a new Metadata field of type
Contact.Name it "Technical Support email" and specify a default value (which is
- 2.In Templates -> Your Template -> Events -> Your Event -> Notifications TabSet a recipient of email notification as
Now, all the notifications for this Event will go to the email specified in the metadata of Technical Support, which is [email protected]
When device is deployed, if you go to Device -> Metadata and change the value of Technical Support to let's say [email protected], all notifications for this event will go to the newly added email.
To control how often users get notified about specific events you can apply Notification limits.
Limit Period- limits the number of notifications to just one notification for a specified time period. Timer starts when first Event happened and notification sent.
❇️ Example: if you set 1 hour as a limit, end-users will only get one notification within 1 hour after the first event was recorded. No matter how many events are generated by hardware (or API calls) during one hour after that, no notifications will be sent.
Event Counter - notification will be sent only after a number of events was recorded. Counter starts when first event happened. After counter value was met, counter resets to zero.
❇️ Example: if the counter is set to 50 and device sends 100 events, the user would only get 1 notification (every 51st event will trigger the notification).
You can also use Limit period and Event counter together.
❇️ Example: set Limit Period to 1 hour and Event Counter to 5.
- When first event is recorded, the Limit Period timer starts and Event Counter starts
- Device sends 100 events
- When 6th event is logged, a notification is sent because counter value is met
- No more notifications are sent because 1h limit is active