All Collections
User Guides
Events: Telegram Notifications
Events: Telegram Notifications

Set up and trigger Telegram notifications using the Ubidots Events Engine.

David Sepúlveda avatar
Written by David Sepúlveda
Updated over a week ago

Telegram, a good alternative to SMS alerts, is available within Ubidots Events Engine actions.

In this guide, we'll walk you through the process of sending Telegram notifications using Ubidots' Events Engine.

Alternatively you can use our Telegram plugin for custom notifications.

DISCLAIMER: Ubidots adheres to Telegram’s API guidelines and best practices, which might translate into occasional delays in message delivery and even message loss during peak usage periods. Telegram notifications are provided under a “best-effort” policy and come with no warranty of delivery. We strongly advise against using Telegram for mission-critical IoT notifications.

In this article, you’ll learn how to send Telegram notifications using Ubidots’ Events Engine.

Requirements

  • Ubidots account: trial or licensed.

  • Notification recipients must have an active Telegram account and the Telegram app installed in their phones.

NOTE: Every attempt to deliver messages to numbers not yet registered in Telegram increases the chance of our service being penalized by Telegram’s API.

1. Create a new event

To begin, head to the “data” tab →"Events" and hover over the “+” button, located at the upper right corner of the screen, and create a conditional event, global event, or scheduled event depending on your needs.

Next, configure the event’s triggers with an AND/OR logic. For additional details on how to configure these triggers, head to their corresponding guides: value based, inactivity, geofence.

2. Configure the Telegram action

With the "trigger" logic configured, it’s now time to set up the Telegram action.

1. Click on the “+ add action” button to start the process. From the available options, choose “send Telegram”.

2. Assign the correct country code and phone number of the recipient. Multiple numbers can be added.

This user will become the admin of a Telegram group called “IoT Notifications”, where all notifications will be sent. The admin can invite other members to the group.

3. Customize the “active trigger” and the “back to normal” (optional) texts to be delivered to the receiving phone number(s).

By using the tag icon at the upper right corners of the “subject” and “message” fields you can easily add information such as device ID, timestamp, variable name, etc.

Note: By default, data inputs involving timestamps are sent in human-readable format (YYY-MM-DD HH:mm:ss TZ). If you'd rather attach UNIX epoch time in milliseconds, double-click on the data input and delete the text from the pipe symbol ("|") until the end, as shown below.

4. Optionally, enable the “repeat action” if you want to repeat the action multiple times while the event is active. You can choose how often and up to how many times the action will be repeated. There’s a limit of 50 action repetitions.

5. Click on “save” once you finish configuring the action and on “next”, unless you want to set up multiple actions.

6. After completing the action configuration you’ll proceed to the final step, the “settings” tab. There, you’ll name the event and give it a description (optional).

7. Another optional step is to use a tag on the event. This is a great tool to control what your end users see in your app. In this case, for instance, you could decide that your end user sees one event, but not another, using tags. Learn more about tags here.

8. Finally (unless the event you created is a scheduled event), determine the activity window in which the events should be executed. An event can have multiple active windows by clicking on the “+ add window button” and configuring them correspondingly. After finishing this, click on “save” and your event will be deployed.

3. Start receiving Telegram notifications

The first time a Telegram notification is sent, the recipient will see two new chats:

1. A direct message from an Ubidots-owned number indicating that the user has been added to a group called “IoT Notifications”. This chat also contains a rejoin link in case the user ever leaves the group by accident. Please keep this link as it is your way back into the group to receive further notifications from Ubidots over Telegram.

NOTE: In case you, or one of your users, leave the group and lose the rejoin link, feel free to contact us at support@ubidots.com.

2. A group message in the “IoT Notifications” group: The specified Telegram recipient will be named the admin of a new group, where all future Ubidots notifications will be sent to. As an admin, the Telegram user will be able to add other Telegram users so they are also notified.

4. Service health and message delivery

In case of issues with Telegram's API availability, Ubidots applies the following rules to re-attempt the delivery:

  1. The message will be retried after 60 seconds for 5 times. If this fails, then:

  2. The message will be retried every 15 minutes for the next 12 hours. If this fails, then:

  3. The message will be dropped and a corresponding note will be reflected in the event’s log. Also, every re-attempt to send the message will be reflected in the log.

NOTE: Every attempt to deliver messages to numbers not yet registered in Telegram increases the chance of our service being penalized by Telegram’s API.

Did this answer your question?