{"id":44319395,"url":"https://github.com/grom-dev/bot-api-spec","last_synced_at":"2026-03-01T16:05:06.293Z","repository":{"id":317338104,"uuid":"1065177564","full_name":"grom-dev/bot-api-spec","owner":"grom-dev","description":"📦 Telegram Bot API specification as a JavaScript package.","archived":false,"fork":false,"pushed_at":"2026-02-11T04:32:12.000Z","size":672,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-11T09:49:31.091Z","etag":null,"topics":["telegram","telegram-bot-api","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/grom-dev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T07:46:47.000Z","updated_at":"2026-02-11T04:32:12.000Z","dependencies_parsed_at":"2025-10-01T09:03:47.394Z","dependency_job_id":null,"html_url":"https://github.com/grom-dev/bot-api-spec","commit_stats":null,"previous_names":["grom-dev/bot-api-spec"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/grom-dev/bot-api-spec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grom-dev%2Fbot-api-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grom-dev%2Fbot-api-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grom-dev%2Fbot-api-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grom-dev%2Fbot-api-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grom-dev","download_url":"https://codeload.github.com/grom-dev/bot-api-spec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grom-dev%2Fbot-api-spec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["telegram","telegram-bot-api","typescript"],"created_at":"2026-02-11T06:07:15.153Z","updated_at":"2026-03-01T16:05:06.288Z","avatar_url":"https://github.com/grom-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![bot-api](https://img.shields.io/badge/v9.5-000?style=flat\u0026logo=telegram\u0026logoColor=%2325A3E1\u0026label=Bot%20API\u0026labelColor=%23000\u0026color=%2325A3E1)][bot-api]\n[![npm](https://img.shields.io/npm/v/%40grom.js%2Fbot-api-spec?style=flat\u0026logo=npm\u0026logoColor=%23BB443E\u0026logoSize=auto\u0026label=Latest\u0026labelColor=%23fff\u0026color=%23BB443E)](https://www.npmjs.com/package/@grom.js/bot-api-spec)\n[![jsr](https://img.shields.io/jsr/v/%40grom/bot-api-spec?style=flat\u0026logo=jsr\u0026logoColor=%231B3646\u0026logoSize=auto\u0026label=Latest\u0026labelColor=%23F3E051\u0026color=%231B3646)](https://jsr.io/@grom/bot-api-spec)\n\n[Telegram Bot API][bot-api] specification as a collection of JavaScript objects in a [custom format](#format).\n\n## Motivation\n\nAutomatically generate tools, libraries, MCP servers, custom documentations, etc.\n\n## Installation\n\n```sh\n# Using npm\nnpm install @grom.js/bot-api-spec\n\n# Using JSR\ndeno add jsr:@grom/bot-api-spec\n```\n\n## Usage\n\nRoot module exports two objects: `types` and `methods`, containing definitions of all Bot API types and methods respectively.\n\n```ts\nimport { types, methods } from '@grom.js/bot-api-spec' // '@grom/bot-api-spec' for JSR\n\nconsole.log(types)\n// {\n//   Update: {\n//     name: 'Update',\n//     description: { markdown: '...' },\n//     fields: [\n//       {\n//         name: 'update_id',\n//         type: { type: 'int32' },\n//         description: { markdown: '...' },\n//         required: true,\n//       },\n//       ...\n//     ],\n//   },\n//   ...\n// }\n\nconsole.log(methods)\n// {\n//   getUpdates: {\n//     name: 'getUpdates',\n//     description: { markdown: '...' },\n//     parameters: [\n//       {\n//        name: 'offset',\n//        type: { type: 'int32' },\n//        description: { markdown: '...' },\n//        required: false,\n//      },\n//      ...\n//     ],\n//     returnType: {\n//       type: 'array',\n//       of: {\n//         type: 'api-type',\n//         name: 'Update',\n//       },\n//     },\n//   },\n//   ...\n// }\n```\n\n## Format\n\nRefer to the [./src/format.ts](./src/format.ts) module for reference.\n\nYou can also import types in your code:\n\n```ts\nimport type { ValueType } from '@grom.js/bot-api-spec/format' // '@grom/bot-api-spec/format' for JSR\n\nfunction generateCode(valueType: ValueType): string {\n  if (valueType.type === 'str') {\n    return 'string'\n  }\n  // ...\n}\n```\n\n### Value Types\n\nWe define custom value types to represent types of the fields and parameters, to allow generating more flexible and user-friendly code.\n\nBelow are the rules how we map type of a field/parameter to the `ValueType`:\n\n- _Type_ is _String_ — `{ type: 'str' }`\n- _Type_ is _Integer_ — `{ type: 'int32' }`\n- _Type_ is _Integer_ and _Description_ says \"...may have more than 32 significant bits...but it has at most 52 significant bits...\" — `{ type: 'int53' }`\n- _Type_ is _Boolean_ — `{ type: 'bool' }`\n- _Type_ is _True_ — `{ type: 'bool', literal: true }`\n- _Type_ is _Float_ — `{ type: 'float' }`\n- _Type_ is _InputFile_ — `{ type: 'input-file' }`\n- _Type_ is _X_, where X is any API type — `{ type: 'api-type', name: X }`\n- _Type_ is _Array of X_ — `{ type: 'array', of: X }`\n- _Type_ is _X or Y or ..._ — `{ type: 'union', types: [X, Y, ...] }`\n\n### Descriptions\n\nAll definitions of types, methods, fields, and parameters include their descriptions.\n\nDescriptions are copied verbatim from the official [Bot API documentation][bot-api], with the following modifications:\n\n- Description HTML is parsed and converted to Markdown.\n- The \"_Optional._\" prefix is omitted from field descriptions. Instead, the `required` property is set to `false` for such fields.\n- \"JSON-serialized...\" portions are omitted from field/parameter descriptions.\n- \"...may have more than 32 significant bits...but it has at most 52 significant bits...\" portions are omitted from _Integer_ field/parameter descriptions. Instead, the `type` is set to `int53` for such fields/parameters (as per [TDLib](https://core.telegram.org/tdlib/docs/td__api_8h.html#a6f57ab89c6371535f0fb7fec2d770126)).\n\n[bot-api]: https://core.telegram.org/bots/api\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrom-dev%2Fbot-api-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrom-dev%2Fbot-api-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrom-dev%2Fbot-api-spec/lists"}