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 🙏

© 2026 – Pkg Stats / Ryan Hefner

raccoonjs-api

v1.0.0

Published

A Simple Node.js Module to Interact withh Telegram Bot API

Readme

Build Status

Install

$ yarn add raccoonjs-api

or

$ npm i raccoonjs-api

Documentation

See raccoonjs-api documentation here.

Tutorial

In this tutorial we will first use localhost as a server to develop the Telegram bot, but at the end of this tutorial we will try to change localhost to Heroku as a server.

Exposing localhost to the internet

In order for bots to receive incoming updates from the Telegram server, localhost needs to be exposed to the internet using Ngrok.

$ ngork http <PORT>

In this tutorial we use PORT = 5000

Coding

Here we will make a simple bot that makes the bot can respond back when the user sends certain commands to the bot. For example, when a user sends a message like this "/hello", the bot will respond "Hello, <your_name>"

  1. Create Project

    $ mkdir example && cd example
  2. Init Nodejs Project

    $ npm init --yes
  3. Install Raccoonjs-api

    $ npm install raccoonjs-api
  4. Create App

    $ touch index.js
  5. Open Project with Text Editor (vscode)

    $ code .
  6. Write a simple bot

    // index.js
    
    // import the module
    const { TelegramAPI } = require("raccoonjs-api");
    
    // A unique authentication token see: https://core.telegram.org/bots/api#making-requests
    const YOUR_TOKEN = "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11";
    
    // Ngrok forwarding secure url (prefix with 'https')
    const YOUR_HOST = "https://<unique_number>.ngrok.io";
    const port = 5000;
    
    // create bot instance
    const bot = new TelegramAPI(YOUR_TOKEN, YOUR_HOST);
    
    // start the webhook then the bot can receive incoming updates
    // it is recommended to use a secret path in the URL, e.g. YOUR_HOST/<YOUR_TOKEN>. Because no one else knows your bot token.
    bot.startWebhook("/secretPath", port, () => {
        console.log("Webhook started!");
    });
    
    // define a command message
    bot.cmd("hello", ctx => {
        const { chat } = ctx;
        bot.sendText(chat.id, `Hello ${chat.first_name}`);
    });
  7. It's time to try

    $ node index.js

    to see the results, try sending the "/hello" message to the bot and see the magic!

Deploy to Heroku

Follow the official tutorial from Heroku. Deploying Node.js Apps on Heroku

Note: Because this bot application is not a web application, but a process it is necessary to add the following script to the Procfile file.

worker: node index.js

Note: Before actually deploying an application to Heroku it is recommended to save variables such as token or other credentials to the environment variables. See.

Special Thanks

PT Privy Identitas Digital (PrivyID)

Thanks for giving the internship opportunity as a Back End Developer, this project began when PrivyID gave the task of making a Telegram bot to assist in the Stand-up Meeting.

Inspiration

Node Telegram Bot API

License

MIT