{"id":13989855,"url":"https://github.com/telekits/teleapi","last_synced_at":"2025-07-22T11:31:53.730Z","repository":{"id":34554018,"uuid":"38499153","full_name":"telekits/teleapi","owner":"telekits","description":"🚀 The useful library to simplify your work with Telegram Bot API","archived":false,"fork":false,"pushed_at":"2018-03-31T13:52:07.000Z","size":103,"stargazers_count":56,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-26T09:53:06.298Z","etag":null,"topics":["api","bot","es6","javascript","library","network","nodejs","tekekit","telegram","telegram-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/teleapi","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telekits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-03T15:25:27.000Z","updated_at":"2023-11-21T07:36:07.000Z","dependencies_parsed_at":"2022-08-03T21:31:12.030Z","dependency_job_id":null,"html_url":"https://github.com/telekits/teleapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/telekits/teleapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekits%2Fteleapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekits%2Fteleapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekits%2Fteleapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekits%2Fteleapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telekits","download_url":"https://codeload.github.com/telekits/teleapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telekits%2Fteleapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266483788,"owners_count":23936421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bot","es6","javascript","library","network","nodejs","tekekit","telegram","telegram-api"],"created_at":"2024-08-09T13:02:07.353Z","updated_at":"2025-07-22T11:31:52.735Z","avatar_url":"https://github.com/telekits.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"#what-is-it\" alt=\"teleapi\"\u003e\n        \u003cimg src=\".github/header.png\" alt=\"Header image\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/telekits/telekit\"\u003etelekit\u003c/a\u003e\n    \u003cstrong\u003e\u0026emsp;\u0026bull;\u0026emsp;\u003c/strong\u003e\n    \u003cstrong\u003eteleapi\u003c/strong\u003e\n\u003c/p\u003e\n\n\n[![Build Status](https://travis-ci.org/telekits/teleapi.svg?branch=master)](https://travis-ci.org/telekits/teleapi)\n[![npm](https://img.shields.io/npm/v/teleapi.svg)](https://www.npmjs.com/package/teleapi)\n[![npm](https://img.shields.io/npm/dt/teleapi.svg)](https://www.npmjs.com/package/teleapi)\n[![Airbnb code style](https://img.shields.io/badge/code_style-Airbnb-ff69b4.svg)](https://github.com/sindresorhus/xo)\n[![license](https://img.shields.io/github/license/telekits/teleapi.svg)](./LICENSE)\n\n\n\u003e Now support the Telegram Bot API 3.6\n\n\n## What is it?\nThis is useful library to simplify your work with the Telegram Bot API\n\u003e Before you start, please, read an introduction for developers.  \n\u003e [Just a moment, I'll read it.](https://core.telegram.org/bots \"Bots: an introduction for developers\")\n\n\n## Install\nnpm\n```console\n$ npm install teleapi --save\n```\n\nyarn\n```console\n$ yarn add teleapi\n```\n\n\n## How it use?\nElementary!\nLook at the next example that show you how to send request to `getMe` method:\n```javascript\n/** First be we've required the teleapi */\nconst teleapi = require('teleapi');\n\n/**\n * Next we need a get an instance of the teleapi.\n * Also, we should set the bot token.\n */\nconst api = teleapi('telegram_bot_token');\n\n/**\n * And now we can send requests to the Telegram Bot API;\n * This method returns info about the bot to us.\n *\n * (`getMe` method is available in the Telegram Bot API).\n */\napi.getMe().then((response) =\u003e {\n    /** Bot ID */\n    console.log('id:', response.id);\n    /** and username of the our bot */\n    console.log('username:', response.username);\n\n    /**\n     * And also first name and last name and lang code.\n     * See about it below.\n     */\n}).catch((error) =\u003e {\n    /** Something is wrong! */\n    console.log(error);\n});\n```\n\u003e If you want to see available methods and types:  \n\u003e [Please, have a look at here first.](https://core.telegram.org/bots/api#available-types \"Telegram Bot API\")\n\n\n## API\n#### `teleapi(token, [api]);`\n * `token:String` - Token of the Bot that you can get from the BotFather\n * `api:Object` - **(optional)** An Object with Custom API(see [api.json](./api.json \"Default API\"))  \n * Returns: `api` - An instance of the teleapi.\n\nCreates an new instance of the teleapi with your token of the bot.  \n\n\n#### `teleapi.version:String`\nA contain of the current API version.  \n\n\n#### `teleapi.methods:Array`\nA contain an Array of String with all available methods.  \n\n\n#### `api.getFile(id);`\n * `id:String` - File ID\n * Returns: `Stream` - A stream with file data \n\nGet file from the Telegram.  \n\n\n#### `api.method(name, [params]);`\n * `name:String` - Name of the method that available in the Telegram Bot API\n * `params:Object` - **(optional)** An Object with body params for the request\n * Returns: `Promise` with response in `then`\n\nThis method send request to the Telegram Bot API;  \nIt's private method but you can use it.  \n\n\n#### `api.\u003cmethod\u003e(params);`\n * `params:Object` - An Object with body params for the request\n * Returns: `Promise` with response in `then`\n\nThe `\u003cmethod\u003e` is one of the available methods from Telegram Bot API.  \n\n\u003e See all available methods [here](https://core.telegram.org/bots/api#available-methods \"Telegram Bot API\").\n\n\n## Examples\n\n**Send text message to chat**\n```javascript\nconst teleapi = require('teleapi');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request with chat and text message */\napi.sendMessage({\n    chat_id: 0000,\n    text: 'Hello!', \n});\n```\n\n\n**Save file from the Telegram**\n```javascript\nconst teleapi = require('teleapi');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request with file id */\napi.getFile('file_id').pipe(fs.createWriteStream('image.png'));\n```\n\n\n**Send sticker(file_id)**\n```javascript\nconst teleapi = require('teleapi');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request where `sticker` is a file id */\napi.sendSticker({\n   chat_id: 0000,\n   sticker: 'file_id', \n});\n```\n\n\n**Send document(stream.Readable)**\n```javascript\nconst teleapi = require('teleapi');\nconst fs = require('fs');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request where `document` is stream.Readable */\napi.sendDocument({\n   chat_id: 0000,\n   document: fs.readFile('book_from_tpb.pdf'), \n});\n```\n\n\n**Send photo(URL)**\n```javascript\nconst teleapi = require('teleapi');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request where `photo` is an URL */\napi.sendPhoto({\n   chat_id: 0000,\n   photo: 'https://upload.wikimedia.org/wikipedia/commons/d/d9/Test.png', \n});\n```\n\n**Send voice(Buffer)**\n```javascript\nconst teleapi = require('teleapi');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request where `voice` is a Buffer */\napi.sendVoice({\n   chat_id: 0000,\n   voice: new Buffer([1, 2, 3]), \n});\n```\n\n\n**Send document(strict)**\n```javascript\nconst teleapi = require('teleapi');\nconst fs = require('fs');\n\nconst api = teleapi('telegram_bot_token');\n\n/** Send request where 'document' is an Object with strict data */\napi.sendDocument({\n    chat_id: 000000,\n    document: {\n        filename: 'photo.png',\n        value: fs.readFile('family_photo.dat'),\n        mime: 'image/png',\n    },\n});\n```\n\n\n\u003e A more is coming soon.\n\n\n## LICENSE\n[MIT](./LICENSE \"The MIT License\") © [Denis Maslennikov](https://github.com/nof1000 \"Author\")\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelekits%2Fteleapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelekits%2Fteleapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelekits%2Fteleapi/lists"}