Socket
Socket
Sign inDemoInstall

puregram

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puregram

Powerful Node.js package written on TypeScript that allows you to work with Telegram API


Version published
Weekly downloads
760
decreased by-15.56%
Maintainers
1
Weekly downloads
 
Created
Source

Powerful Node.js package that allows you to easily interact with Telegram API 🚀

🤖 Examples 📖 Documentation 💬 Chat 💬 Channel

Features

  • 100% Telegram Bot API coverage
  • Works with JavaScript and TypeScript

Installation

Node.js 12.0.0 or newer is required

$ yarn add puregram
$ npm i -S puregram

Polling example

import { Telegram } from 'puregram';

const telegram = new Telegram({
  token: process.env.TOKEN
});

// Message received
telegram.updates.on(
  'message',
  (context) => context.send('Hello, World!')
);

// Inline button pressed
telegram.updates.on(
  'callback_query',
  (context) => (
    context.message.editMessageText('*You just clicked the inline button!*', {
      parse_mode: 'Markdown'
    })
  )
);

telegram.updates.startPolling().catch(console.error);

Webhook example (express)

import express from 'express';
import { Telegram } from 'puregram';

const telegram = new Telegram({
  token: process.env.TOKEN
});

const app = express();

app.use(bodyParser.json());
app.use(telegram.updates.getWebhookMiddleware());

telegram.updates.on(
  'message',
  (context) => context.send('Hello, World!')
);

// Available ports: 80, 88, 443, 8443
app.listen(443, () => console.log('Webhook started handling!'));

🤖 Click to see more examples!

Community

Packages that might be useful to you

Thanks to

Biggest thanks to Negezor for his vk-io library that helped me with this package!

Keywords

FAQs

Package last updated on 12 Jun 2021

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