# @busshi/telegram-api

> Basic Telegram API to interact with your bot

Latest version **2.0.6** (published 2022-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @busshi/telegram-api
pnpm add @busshi/telegram-api
yarn add @busshi/telegram-api
bun add @busshi/telegram-api
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2022-12-12 |
| First published | 2022-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | busshi |
| Maintainers | busshi |
| Keywords | Telegram, API, bot |

## Links

- npm: https://www.npmjs.com/package/@busshi/telegram-api
- Repository: https://github.com/busshi/npm-telegram-api
- Homepage: https://github.com/busshi/npm-telegram-api#readme
- Issues: https://github.com/busshi/npm-telegram-api/issues
- npm.io page: https://npm.io/package/@busshi/telegram-api

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.2.0

## Recent versions

- 2.0.6 (latest) — 2022-12-12
- 2.0.5 — 2022-12-12
- 2.0.4 — 2022-12-06
- 2.0.3 — 2022-12-06
- 2.0.2 — 2022-12-06
- 2.0.1 — 2022-12-06
- 2.0.0 — 2022-12-05
- 1.0.0 — 2022-12-05
- 1.0.3 — 2022-12-05
- 1.0.2 — 2022-12-05
- 1.0.1 — 2022-12-05

## README

![publish](https://github.com/busshi/npm-telegram-api/actions/workflows/publish.yml/badge.svg)

# npm-telegram-api

Node package for the Telegram API

## Installation

`yarn add @busshi/telegram-api`
or 
`npm install @busshi/telegram-api`

## Functionnalities

| Method | Parameters |
| :-- | :-- |
| sendMessage | <ul><li>chatId: string</li><li>text: string</li><li>disableNotification: boolean (optional, default: false)</li></ul> |
| editMessage | <ul><li>chatId: string</li><li>messageId: string</li><li>text: string</li></ul> |
| deleteMessage | <ul><li>chatId: string</li><li>messageId: string</li></ul> |
| sendPhoto | <ul><li>chatId: string</li><li>picUrl: string</li><li>disableNotification: boolean (optional, default: false)</li></ul> |
| sendDocument | <ul><li>chatId: string</li><li>fileUrl: string</li><li>disableNotification: boolean (optional, default: false)</li></ul> |
| sendVideoNote | <ul><li>chatId: string</li><li>videoUrl: string</li><li>disableNotification: boolean (optional, default: false)</li></ul> |
| sendPoll | <ul><li>chatId: string</li><li>question: string</li><li>options: string[]</li><li>disableNotification: boolen (optional, default: false)</li><li>isAnonymous: boolean (optional, default: false)</li></ul> |
| sendSticker | <ul><li>chatId: string</li><li>stickerId: string</li></ul> |
| sendDice | <ul><li>chatId: string (get a random number from 1 to 6)</li></ul> |

## Usage

```js
import Telegram from '@busshi/telegram-api';

const telegram = new Telegram(BOT_TOKEN);

const req = await telegram.sendMessage(CHAT_ID, 'Hello world!');
const messageId = req.dat.result.message_id;

telegram.editMessage(CHAT_ID, messageId, 'Edited message');

telegram.deleteMessage(CHAT_ID, messageId);

telegram.sendPhoto(CHAT_ID, PICTURE_URL);

telegram.sendDocument(CHAT_ID, DOCUMENT_URL);

telegram.sendVideoNote(CHAT_ID, VIDEO_URL);

telegram.sendPoll(CHAT_ID, QUESTION, OPTIONS);
telegram.sendPoll(CHAT_ID, 'Is it working?', ['yes', 'no']);

telegram.sendSticker(CHAT_ID, STICKER_ID);
telegram.sendSticker(CHAT_ID, 'CAACAgIAAxkBAAI6GV6vP_F6BaWapEmBZ2k8e8yBi2xMAAICAwACusCVBTRFBuRNlNodGQQ');

telegram.sendDice(CHAT_ID);
```

---
_Source: https://npm.io/package/@busshi/telegram-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
