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

telegram-free

v2.0.5

Published

Sends message by Telegram API and SMS by the free-mobile API

Readme

Telegram - Free Mobile

This library has been developed for specific needs. It combines communication with Telegram and the free mobile API.

Configuration

  • Install the library
npm install --save telegram-free
  • Define the configuration variables
  1. Using a json file (example in config.json)
let communicationApi = new TelegramFreeMobile("/home/user/config.json");
  1. Using an object
let config = {
    free_mobile: [
        {
            user: 123,
            password: "xxxxx"
        }
    ],
    telegram: {
        group_id: 123456,
        bot_token: "xxxxxxxxxx"
    }
};

let communicationApi = new TelegramFreeMobile(config);

Usage

Free Mobile

Send a message

let free = communicationApi.freeMobile;
free.sendMessage("Hello World!")
    .then(()=> {
        console.log("Sent to all specified users!");
    })
    .catch((err: Error | null) => {
        console.log("Error...", err);
    });

Telegram

Send a message

let telegram = communicationApi.telegram;
telegram.sendMessage("Hello World!")
.then((message) => {
    console.log("Message sent!");
});

Send a message with a picture

let telegram = communicationApi.telegram;
telegram.sendMessageWithPicture("Hello World!", "/home/user/image.png")
.then((message) => {
    console.log("Photo sent!");
});

Launch Telegram Bot and set OnMessageListener

let telegram = communicationApi.telegram;
telegram.launchTelegramServer()
    .setOnMessageListener((message) => {
        console.log("Message received:", message);
    });

API

Class TelegramFreeMobile

TelegramFreeMobile([config])

  • config - (ConfigurationInterface or string) The configuration variables. If config is a string, then it should be the absolute path of the json configuration file (example in config.json). If config is an object, it should implements ConfigurationInterface. Default: config.json of this current directory.

telegram(): Telegram

Returns an instance of Telegram.

freeMobile(): FreeMobile

Returns an instance of FreeMobile.

configuration(): Configuration

Returns an instance of Configuration.

Class Telegram

sendMessage(content): Promise<TelegramBot.Message>

  • content - (string) Message to be sent.

sendMessageWithPicture(content, picture): Promise<TelegramBot.Message>

  • content - (string) Message to be sent.
  • picture - (string) Absolute path or public URL of the picture to be sent.

sendMessageWithVideo(content, video): Promise<TelegramBotDefinition.Message>

  • content - (string) Message to be sent.
  • video - (string) Absolute path or public URL of the video to be sent.

launchTelegramServer(): Telegram

Launches the telegram bot server. Required to use listeners.

setOnMessageListener(onMessageReceived): void

  • onMessageReceived - ((message: TelegramBot.Message) => void) Callback called each time a message is received.

bot: TelegramBot

Returns an instance of TelegramBot from node-telegram-bot-api library.

Class FreeMobile

sendMessage(content): Promise<void[]>

  • content - (string) Message to be sent.

Interface ConfigurationInterface

  • telegram - (TelegramConfigurationInterface) Telegram group configuration. The bot will listen for messages into the group specified.
  • free_mobile - (Array<FreeMobileConfigurationInterface>) Free mobile configuration. The FreeMobile class will send messages to all specified users.

Interface TelegramConfigurationInterface

  • bot_token - (string) Token of the telegram bot.
  • group_id - (number) Group ID. The bot will listen for messages into the group specified.

Interface FreeMobileConfigurationInterface

  • user - (number) Account number of the free mobile user.
  • password - (string) Token of the free mobile user.