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

telegram-rss-feed

v0.8.0

Published

Ever wanted to have a bot that posts new RSS feed entries to a channel or group on telegram? Well, here you go.

Downloads

5

Readme

NodeJS Telegram RSS Feed Channel Bot

Ever wanted to have a bot that posts new RSS feed entries to a channel or group on telegram? Well, here you go.

How to use

  1. setup a bot from telegram's @botfather accounts
  2. check the build arguments the Dockerfile accepts and edit to your demands
  3. setup a cronjob on your machine/server to run the docker container every 120 minutes or so
  4. enjoy the news on telegram 🤗

Dependencies

let's go easy on the dependencies, shall we?

for all of the dev dependencies, see the package.json, but the most important ones are:

Run using Docker

run (in a cron job maybe?)

docker run --rm \
  -v /path/to/telegram-rss-feed/db:/app/db \
  -e TELEGRAM_API_KEY=12345666:abcdefg \
  -e TELEGRAM_CHANNEL_OR_GROUP=your-channel-or-group \
  -e FEED_URL=https://test.test/awesomefeed.rss \
  ghcr.io/simonneutert/telegram-rss-feed:main

Need to build it yourself?

$ docker build . \
  --build-arg telegram_key=THIS123MY:TELEGRAMKEY \
  --build-arg telegram_channel_or_group=@channel_or_groupnumber_on_telegram \
  --build-arg feed_url=https://www.rss-feed.test/feed \
  -t mytelegramrssbot
$ docker run --rm \
  -v /path/to/telegram-rss-feed/db:/app/db \
  mytelegramrssbot

No Docker?

Make sure to set the ENV variables just as you need it.

$ mkdir mytelegramrssbot
$ cd mytelegramrssbot
$ npm init
$ npm install telegram-rss-feed --save
$ touch index.js
// content of index.js
const { Db } = require("telegram-rss-feed/lib/db");
const { parseFeed } = require("telegram-rss-feed/lib/parseFeed");
const { sendMessage } = require("telegram-rss-feed/lib/sendMessage");

Db.sync() // { force: true } will be useful if you need to start from scratch
  .then(() => {});

/**
 * this function auto calls itself in an async fashion
 */
(async () => {
  // you can also pass a custom function to handle the message sending
  await parseFeed(
    process.env.FEED_URL,
    sendMessage, {
      telegramApiKey: "12345666:abcdefg",
      telegramChannelOrGroup: "@your-channel-or-group",
    }
  );
})();

Then run it with:

$ node index.js

Concepts / Good to know

  • docker host volume persistant sqlite database that uses a unique constraint, to not send duplicates into the channel.
  • public channel messaging, but your bot needs admin privileges
  • will work out-of-the-box with any standard compliant modern rss feed supported by rss-parser on npm