Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

telenode-js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telenode-js

Lightweight Telegram API framework for Node.js

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
increased by72.83%
Maintainers
1
Weekly downloads
 
Created
Source

Telenode

Lightweight Telegram API framework for Node.js

npm package npm package MIT licensed


Getting started

Installation

npm install telenode-js

Set webhook

In order to listen to updates from Telegram servers you have to set up a webhook.
The webhook url will be stored in a .env file in the root of your project as WEBHOOK=https://your_amazing_webhook.com.
Then you can execute the following command:

npx set-webhook

Usage

const Telenode = require('telenode-js');
require('dotenv').config();

const bot = new Telenode({
	apiToken: process.env.API_TOKEN,
});

bot.createServer();

bot.onTextMessage('hello', async (messageBody) => {
	console.log(messageBody);
	await bot.sendTextMessage('hello back', messageBody.chat.id);
});

In this example the bot will listen only to 'hello' text messages and will respond to the user 'hello back'. Any other message will be ignored.

Additional examples can be found in the examples folder.


TODO's

  • Regex matching on text messages
  • Buttons support (sending & listening)
  • Direct respond function in message handler without passing chat ID
  • Chat ID handlers
  • Arguments validations
  • Add tests

Keywords

FAQs

Package last updated on 19 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc