npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@danielnguyen/node-red-contrib-telegrambot-home

v0.5.3

Published

Useful nodes for connecting your home to Telegram

Downloads

81

Readme

node-red-contrib-telegrambot-home

Fork of scraton/node-red-contrib-telegrambot-home as it is mostly inactive.

Useful nodes for connecting your home to Telegram.

Getting Started

This assumes you have node-red already installed and working.

cd ~/.node-red
npm install node-red-contrib-telegrambot-home
sudo service nodered restart

Telegram Bot Setup

You will need to setup a Telegram bot in order to use these nodes. You can follow these instructions for how to do it. In summary:

  1. Create the bot: Send BotFather the message /newbot
  2. Name the bot: Give it any name. This is how you will see it in Telegram.
  3. Give the bot a username: Must be unique. Doesn't have to match the bot's name.
  4. Grab the token: You will need this for configuring the nodes.
  5. Send the bot a message: Just say hi or click the start button in the chat window.
  6. Grab the chat ID: curl "https://api.telegram.org/bot${TOKEN}/getUpdates" replacing ${TOKEN} with your bot token.

You will get a JSON response like the following:

{"ok":true,"result":[{"update_id":123456,
"message":{"message_id":1,"from":{"id":123,"is_bot":false,"first_name":"Your","last_name":"Name","language_code":"en-US"},"chat":{"id":987654321,"first_name":"Your","last_name":"Name","type":"private"},"date":12345678,"text":"/start"}}]}

In this example, the chat ID is 987654321.

If you get an empty response, try sending the bot another message. If it's still empty, make sure the bot is not in use by another application (or node) as it will consume the message before you can grab the ID.

If you wish to send messages to multiple chats, you will need to repeat the steps for grabbing each individual chat ID. Sending messages to a group has not been tested, but should be similar to the above steps.

You can then use the token and chat ID to configure the nodes.

Included Nodes

You can view detailed documentation for the nodes via the node-red info pane. Just select a node and start readin'.

switch

Route messages based on a response from a user via Telegram

notify

Send a notification to a user via Telegram

payload

Send an arbitrary payload via any available method to a user via Telegram

All of the Telegram API methods are available to you, either through the node properties or via dynamic payload generation.

Static

Dynamic

command

Initiate a flow based on a command said in the chat

Command nodes can also be configured for multi-chat flows. All other nodes are compatible and will route the message to the originating chat automatically. Simply leave the chat ID blank on the other nodes to enable this feature (and ensure the other chat IDs are authorized).


Development

An environment with node-red can be easily spun up using Docker and Docker Compose.

  1. Clone this repository: git clone https://github.com/scraton/node-red-contrib-telegrambot-home
  2. Install node dependencies: cd node-red-contrib-telegrambot-home && yarn install
  3. Start the docker environment: yarn run dev

Credits

Gotta give credit where credit is due.