{"id":22355443,"url":"https://github.com/dreamcode-uz/telegram-js","last_synced_at":"2025-09-14T05:30:30.447Z","repository":{"id":60203775,"uuid":"541651783","full_name":"DreamCode-Uz/telegram-js","owner":"DreamCode-Uz","description":"Use this library to easily connect your website with Telegram🤩","archived":false,"fork":false,"pushed_at":"2023-02-23T17:28:04.000Z","size":1040,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-04T14:06:27.400Z","etag":null,"topics":["javascript","javascript-library","telegram","telegram-bot","telegrambot-js"],"latest_commit_sha":null,"homepage":"https://github.com/DreamCode-Uz/telegram-js","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/DreamCode-Uz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-26T15:20:19.000Z","updated_at":"2024-05-12T18:46:05.000Z","dependencies_parsed_at":"2023-01-19T03:01:08.173Z","dependency_job_id":null,"html_url":"https://github.com/DreamCode-Uz/telegram-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamCode-Uz%2Ftelegram-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamCode-Uz%2Ftelegram-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamCode-Uz%2Ftelegram-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DreamCode-Uz%2Ftelegram-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DreamCode-Uz","download_url":"https://codeload.github.com/DreamCode-Uz/telegram-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228124671,"owners_count":17873170,"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","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":["javascript","javascript-library","telegram","telegram-bot","telegrambot-js"],"created_at":"2024-12-04T14:06:32.034Z","updated_at":"2024-12-04T14:06:32.953Z","avatar_url":"https://github.com/DreamCode-Uz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/DreamCode-Uz/telegram-js\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/DreamCode-Uz/telegram-js/main/images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e\n\n\u003ch3 align=\"center\"\u003eTelegram JS\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Special library for Telegram bot to connect via browser\n    \u003cbr/\u003e\n    \u003cbr/\u003e\n    \u003ca href=\"https://github.com/DreamCode-Uz/telegram-js\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr/\u003e\n    \u003cbr/\u003e\n    \u003ca href=\"https://github.com/DreamCode-Uz/telegram-js\"\u003eView Demo\u003c/a\u003e\n    .\n    \u003ca href=\"https://github.com/DreamCode-Uz/telegram-js/issues\"\u003eReport Bug\u003c/a\u003e\n    .\n    \u003ca href=\"https://github.com/DreamCode-Uz/telegram-js/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues/DreamCode-Uz/telegram-js?style=flat-square\"  alt=\"issues\"/\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/DreamCode-Uz/telegram-js?style=flat-square\" alt=\"stars\"/\u003e\n\u003cimg src=\"https://img.shields.io/github/license/DreamCode-Uz/telegram-js?style=flat-square\" alt=\"license\"/\u003e\n\u003cimg src=\"https://data.jsdelivr.com/v1/package/npm/@dreamcoder-uzbek/telegramjs/badge\" alt=\"jsDeliver\"/\u003e\n\u003cimg src=\"https://img.shields.io/npm/v/@dreamcoder-uzbek/telegramjs\" alt=\"npm version\"/\u003e\n\u003cimg src=\"https://img.shields.io/npm/dt/@dreamcoder-uzbek/telegramjs\" alt=\"npm download\"/\u003e\n\u003c/p\u003e\n\n[![NPM](https://nodei.co/npm/@dreamcoder-uzbek/telegramjs.png)](https://nodei.co/npm/@dreamcoder-uzbek/telegramjs/)\n## About The Project\n\nThis project was created to facilitate communication with Telegram using javascript\n\n## Add for Node js project(`ReactJs`)\n\n- `npm`\n```npm\nnpm install @dreamcoder-uzbek/telegramjs\n```\n\n- `yarn`\n```yarn\nyarn add @dreamcoder-uzbek/telegramjs\n```\n\n## Add to project via CDN link\n\n- [jsDeliver](https://www.jsdelivr.com/package/npm/@dreamcoder-uzbek/telegramjs)\n```bash\nhttps://cdn.jsdelivr.net/npm/@dreamcoder-uzbek/telegramjs@1.2.5/dist/telegram.min.js\n```\n\n```bash\nhttps://unpkg.com/@dreamcoder-uzbek/telegramjs@1.2.5/dist/telegram.min.js\n```\n\n## Add to project for browser\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eTelegram Js | Connection example\u003c/title\u003e\n    \u003cscript src=\"dist/telegram.min.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n\u003cbody\u003e\n\u003cscript\u003e\n  // your js code...\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n###  This is a complete guide to using this library. After reading it, you will be able to use it. I hope it will be useful for you\n\n---\n\n## Getting Started\n\nFirst of all, a special object is created to use the library.\nit will be possible to connect to the library using the `telegram` keyword\n\n```javascript\nconst connected = new telegram.init(botToken, chatId, parseMode);\n```\n\n| Keyword     | required | default    |\n|-------------|:---------|------------|\n| `botToken`  | yes      |            |\n| `chatId`    | yes      |            |\n| `parseMode` | optional | `Markdown` |\n\n# Usage\n\n## `getMe`\n\n\u003e A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.\n\n\n## `getUpdates`\n\n\u003e Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.\n\n## `getFile`\n\n| Parameter | Type   | Required | Description                              |\n|-----------|--------|----------|------------------------------------------|\n| `file_id` | String | Yes      | File identifier to get information about |\n\nSee [here](https://core.telegram.org/bots/api#getfile) for more information\n\n## `sendMessage`\n\u003e Use this method to send text messages. On success, the sent Message is returned.\n\n```javascript\nconnected.sendMessage(text, reply_to_message_id, protect_content, disable_notification);\n```\n\n| Parameter              | Type    | Required | Description                                                                    |\n|------------------------|---------|----------|--------------------------------------------------------------------------------|\n| `text`                 | String  | yes      | Text of the message to be sent, `1-4096` characters after entities parsing     |\n| `reply_to_message_id`  | Integer | optional | If the message is a reply, ID of the original message                          |\n| `protect_content`      | Boolean | optional | Protects the contents of the sent message from forwarding and saving           |\n| `disable_notification` | Boolean | optional | Sends the message [silently]. Users will receive a notification with no sound. |\n---------------\n\n### `Markdown`\n\n\u003cpre language=\"markdown\"\u003e\n  *bold text*\n  _italic text_\n  [inline URL](http://www.example.com/)\n  [inline mention of a user](tg://user?id=123456789)\n  `inline fixed-width code`\n  ```\n  pre-formatted fixed-width code block\n  ```\n  ```javascript\n  pre-formatted fixed-width code block written in the Javascript programming language\n  ```\n\u003c/pre\u003e\n\n### `Please note`:\n\n- Entities must not be nested, use parse mode [MarkdownV2](https://core.telegram.org/bots/api#markdownv2-style) instead.\n- There is no way to specify underline and strikethrough entities, use parse mode MarkdownV2 instead.\n- To escape characters `_`, `*`, \\`, `[` outside of an entity, prepend the characters '\\' before them.\n- Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\\__case_` for italic snake_case and `*2*\\**2=4*` for bold `2*2=4`.\n\n\n### `MarkdownV2`\n\n\u003cpre language=\"markdown\"\u003e\n  *bold \\*text*\n  _italic \\*text_\n  __underline__\n  ~strikethrough~\n  ||spoiler||\n  *bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*\n  [inline URL](http://www.example.com/)\n  [inline mention of a user](tg://user?id=123456789)\n  `inline fixed-width code`\n  ```\n  pre-formatted fixed-width code block\n  ```\n  ```javascript\n  pre-formatted fixed-width code block written in the Javascript programming language\n  ```\n\u003c/pre\u003e\n\n### `Please note:`\n\n- Any character with code between `1` and `126` inclusively can be escaped anywhere with a preceding '\\' character, in which case it is treated as an ordinary character and not a part of the markup. This implies that '\\' character usually must be escaped with a preceding '\\' character.\n- Inside pre and code entities, all '`' and '\\' characters must be escaped with a preceding '\\' character.\n- Inside (`...`) part of inline link definition, all `)` and `\\ ` must be escaped with a preceding '\\' character.\n- In all other places characters `_`, `*`, `[`, `]`, `(`, `)`, `~`, \\`, `\u003e`, `#`, `+`, `-`, `=`, `|`, `{`, `}`, `.`, `!` must be escaped with the preceding character '\\'.\n- In case of ambiguity between italic and underline entities `__` is always greadily treated from left to right as beginning or end of underline entity, so instead of `___italic underline___` use `___italic underline_\\r__`, where `\\r` is a character with code `13`, which will be ignored\n\n\n### `HTML`\n```html\n  \u003cb\u003ebold\u003c/b\u003e, \u003cstrong\u003ebold\u003c/strong\u003e\n  \u003ci\u003eitalic\u003c/i\u003e, \u003cem\u003eitalic\u003c/em\u003e\n  \u003cu\u003eunderline\u003c/u\u003e, \u003cins\u003eunderline\u003c/ins\u003e\n  \u003cs\u003estrikethrough\u003c/s\u003e, \u003cstrike\u003estrikethrough\u003c/strike\u003e, \u003cdel\u003estrikethrough\u003c/del\u003e\n  \u003cspan class=\"tg-spoiler\"\u003espoiler\u003c/span\u003e, \u003ctg-spoiler\u003espoiler\u003c/tg-spoiler\u003e\n  \u003cb\u003ebold \u003ci\u003eitalic bold \u003cs\u003eitalic bold strikethrough \u003cspan class=\"tg-spoiler\"\u003eitalic bold strikethrough spoiler\u003c/span\u003e\u003c/s\u003e \u003cu\u003eunderline italic bold\u003c/u\u003e\u003c/i\u003e bold\u003c/b\u003e\n  \u003ca href=\"http://www.example.com/\"\u003einline URL\u003c/a\u003e\n  \u003ca href=\"tg://user?id=123456789\"\u003einline mention of a user\u003c/a\u003e\n  \u003ccode\u003einline fixed-width code\u003c/code\u003e\n  \u003cpre\u003epre-formatted fixed-width code block\u003c/pre\u003e\n  \u003cpre\u003e\u003ccode class=\"language-javascript\"\u003epre-formatted fixed-width code block written in the Javascript programming language\u003c/code\u003e\u003c/pre\u003e\n```\n\n### `Please note:`\n\n- Only the tags mentioned above are currently supported.\n- All `\u003c`, `\u003e` and \u0026 symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`\u003c` with `\u0026lt;`, `\u003e` with `\u0026gt;` and `\u0026` with `\u0026amp;`).\n- All numerical `HTML` entities are supported.\n- The `API` currently supports only the following named `HTML` entities: `\u0026lt;`, `\u0026gt;`, `\u0026amp;` and `\u0026quot;`.\n- Use nested `pre` and `code` tags, to define programming language for `pre` entity.\n- Programming language can't be specified for standalone code tags.\n\n---\n\n## `sendPhoto`\n\n```javascript\nconnected.sendPhoto(photo, caption, disable_notification = false, protect_content = false, reply_to_message_id);\n```\n\n| Parameter              | Type                | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                    |\n|------------------------|---------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `photo`                | InputFile or String | yes      | Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. [More information on Sending Files] » |\n| `caption`              | String              | optional | Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing                                                                                                                                                                                                                                                                                                                    |\n| `reply_to_message_id`  | Integer             | optional | If the message is a reply, ID of the original message                                                                                                                                                                                                                                                                                                                                                                          |\n| `disable_notification` | Boolean             | optional | Sends the message [silently]. Users will receive a notification with no sound.                                                                                                                                                                                                                                                                                                                                                 |\n| `protect_content`      | Boolean             | optional | Protects the contents of the sent message from forwarding and saving                                                                                                                                                                                                                                                                                                                                                           |\n\n[More information on Sending Files]: https://core.telegram.org/bots/api#sending-files\n\n\u003e Methods with the same properties as sendPhoto\n\u003e\u003e `sendPhoto`, `sendVideo`,`sendDocument`, `sendAudio`,`sendAnimation`, `sendVideoNote`,\n---\n\n## `sendPoll`\n\n```javascript\nconnected.sendPoll(question, options, correct_option_id, is_anonymous, explanation, type, reply_to_message_id, disable_notification, protect_content)\n```\n\n| Parameters             | Type            | Required | Description                                                                                                                                                                 |\n|------------------------|-----------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `question`             | String          | yes      | Poll question, 1-300 characters                                                                                                                                             |\n| `options`              | Array of String | yes      | A JSON-serialized list of answer options, 2-10 strings 1-100 characters each                                                                                                |\n| `correct_option_id`    | Integer         | Optional | 0-based identifier of the correct answer option, required for polls in quiz mode                                                                                            |\n| `is_anonymous`         | Boolean         | Optional | True, if the poll needs to be anonymous, defaults to True                                                                                                                   |\n| `type`                 | String          | Optional | Poll type, `quiz` or `regular`, defaults to `regular`                                                                                                                       |\n| `explanation`          | String          | Optional | Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing |\n| `reply_to_message_id`  | Integer         | Optional | If the message is a reply, ID of the original message                                                                                                                       |\n| `disable_notification` | Boolean         | optional | Sends the message [silently]. Users will receive a notification with no sound.                                                                                              |\n| `protect_content`      | Boolean         | optional | Protects the contents of the sent message from forwarding and saving                                                                                                        |\n\n## `sendDice`\n\n```javascript\nconnected.sendDice(emoji, disable_notification, protect_content, reply_to_message_id)\n```\n\n| Parameters             | Type    | Required | Description                                                                                                                                                                                                                                 |\n|------------------------|---------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `emoji`                | String  | Optional | Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” |\n| `reply_to_message_id`  | Integer | Optional | If the message is a reply, `ID` of the original message                                                                                                                                                                                     |\n| `disable_notification` | Boolean | optional | Sends the message [silently]. Users will receive a notification with no sound.                                                                                                                                                              |\n| `protect_content`      | Boolean | optional | Protects the contents of the sent message from forwarding and saving                                                                                                                                                                        |\n\n## `sendLocation`\n\n```javascript\nconnected.sendLocation (latitude, longitude, horizontal_accuracy, disable_notification = false, protect_content = false, reply_to_message_id)\n```\n\n| Parameters             | Type         | Required | Description                                                                    |\n|------------------------|--------------|----------|--------------------------------------------------------------------------------|\n| `latitude`             | Float number | Yes      | `Latitude` of the `location`                                                   |\n| `longitude`            | Float number | Yes      | `Longitude` of the `location`                                                  |\n| `reply_to_message_id`  | Integer      | Optional | If the message is a reply, `ID` of the original message                        |\n| `disable_notification` | Boolean      | optional | Sends the message [silently]. Users will receive a notification with no sound. |\n| `protect_content`      | Boolean      | optional | Protects the contents of the sent message from forwarding and saving           |\n\n## `sendContact`\n\n```javascript\nconnected.sendContact (phone_number, first_name, last_name, disable_notification, protect_content, reply_to_message_id)\n```\n\n| Parameters             | Type    | Required | Description                                                                    |\n|------------------------|---------|----------|--------------------------------------------------------------------------------|\n| `phone_number`         | String  | Yes      | \tContact's phone number                                                        |\n| `first_name`           | String  | Yes      | \tContact's first number                                                        |\n| `last_name`            | String  | Optional | \tContact's last number                                                         |\n| `reply_to_message_id`  | Integer | Optional | If the message is a reply, `ID` of the original message                        |\n| `disable_notification` | Boolean | optional | Sends the message [silently]. Users will receive a notification with no sound. |\n| `protect_content`      | Boolean | optional | Protects the contents of the sent message from forwarding and saving           |\n\n[silently]: https://telegram.org/blog/channels-2-0#silent-messages\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamcode-uz%2Ftelegram-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdreamcode-uz%2Ftelegram-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamcode-uz%2Ftelegram-js/lists"}