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

noti_bot

v1.1.4

Published

Send notifications to slack, telegram, discord

Downloads

42

Readme

noti_bot

send notifications to slack, telegram

Install

https://www.npmjs.com/package/noti_bot

npm install noti_bot

Setup

  • Slack:

    • Go to Incoming webhook setting
    • Add to Slack
    • At Post to Channel section, select channel or username want to receive message
    • Add Incoming webhook integration
    • Copy webhook URL
    • Your SLACK_HOOK_KEY is all text following https://hooks.slack.com/services/ example: T04BK8XKDPH/B04SA4ZCT45/EuvIUglFNNkEJIPlKRyGNH5K
  • Telegram:

    • Go to @BotFather
    • /start to create your bot
    • Save your bot's token
    • If you would like to get direct message from bot, send message to bot first to activate (otherwise, telegram will make your message is spam and won't deliver to your user)
    • If you would like to post message to a group, invite bot to that group
    • Run a bot instance to answer to user their TELEGRAM_CHAT_ID

    using /mytelegramid

    const Promise = require('bluebird')
        Promise.config({
        cancellation: true,
    })
    const TelegramBot = require('node-telegram-bot-api')
    // replace the value below with the Telegram token you receive from @BotFather
    const token = process.env.TOKEN
    // Create a bot that uses 'polling' to fetch new updates
    const bot = new TelegramBot(token, {
    polling: true,
    })
    
    
    bot.onText(/\/mytelegramid/, async (msg, match) => {
        let res = `Your telegram id is ${msg.from.id}`
        if (msg.chat.id != msg.from.id) {
            res += `\n Your group chatId: ${msg.chat.id}`
        }
        bot.sendMessage(msg.chat.id, res, {
            reply_to_message_id: msg.message_id,
        })
    })

Usage

    const noti_bot = require('noti_bot')
    const notifyTelegram = noti_bot.telegram
    const notifySlack = noti_bot.slack
    const notifyDiscord = noti_bot.discord
    
    // enable isHtmlMode = true if you send rich text
    notifyTelegram(msg, TELEGRAM_BOT_TOKEN, TELEGRAM_TARGET_CHAT_ID , isHtmlMode)

    // convert msg to markdown format if you want to send rich text
    notifySlack(msg, SLACK_HOOK_KEY, SLACK_CHANNEL, SLACK_BOTNAME, SLACK_BOT_ICON)

    // convert msg to markdown format if you want to send rich text
    notifyDiscord(msg, webhook)