{"id":26655619,"url":"https://github.com/gramiojs/keyboards","last_synced_at":"2026-04-11T00:21:06.677Z","repository":{"id":220421288,"uuid":"751605509","full_name":"gramiojs/keyboards","owner":"gramiojs","description":"Framework-agnostic Telegram bot keyboard builder with many cool features!","archived":false,"fork":false,"pushed_at":"2025-04-06T19:36:28.000Z","size":161,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-06T20:30:38.005Z","etag":null,"topics":["telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-keyboard"],"latest_commit_sha":null,"homepage":"https://gramio.netlify.app/keyboards/overview.html","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/gramiojs.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}},"created_at":"2024-02-01T23:52:07.000Z","updated_at":"2025-04-06T19:33:35.000Z","dependencies_parsed_at":"2024-02-25T14:30:56.892Z","dependency_job_id":"2d994b7f-b804-4d30-a1f4-598d7f523fed","html_url":"https://github.com/gramiojs/keyboards","commit_stats":null,"previous_names":["gramiojs/keyboards"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramiojs%2Fkeyboards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramiojs%2Fkeyboards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramiojs%2Fkeyboards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramiojs%2Fkeyboards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gramiojs","download_url":"https://codeload.github.com/gramiojs/keyboards/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368742,"owners_count":21092445,"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":["telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-keyboard"],"created_at":"2025-03-25T06:36:41.771Z","updated_at":"2026-04-11T00:21:06.600Z","avatar_url":"https://github.com/gramiojs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @gramio/keyboards\n\nFramework-agnostic Telegram bot keyboard (and inline query result) builder with many cool features!\n\n\u003cdiv align=\"center\"\u003e\n\n[![npm](https://img.shields.io/npm/v/@gramio/keyboards?logo=npm\u0026style=flat\u0026labelColor=000\u0026color=3b82f6)](https://www.npmjs.org/package/@gramio/keyboards)\n[![npm downloads](https://img.shields.io/npm/dw/@gramio/keyboards?logo=npm\u0026style=flat\u0026labelColor=000\u0026color=3b82f6)](https://www.npmjs.org/package/@gramio/keyboards)\n[![JSR](https://jsr.io/badges/@gramio/keyboards)](https://jsr.io/@gramio/keyboards)\n[![JSR Score](https://jsr.io/badges/@gramio/keyboards/score)](https://jsr.io/@gramio/keyboards)\n\n\u003c/div\u003e\n\n### Installation (if you don't use GramIO)\n\n```bash\nnpm i @gramio/keyboards\n```\n\n# See more in [Documentation](https://gramio.dev/keyboards/overview.html)\n\n## Usage ([with frameworks](#usage-with-frameworks))\n\n### Simple Keyboard\n\n```ts\nimport { Keyboard } from \"@gramio/keyboards\";\n\nconst keyboard = new Keyboard()\n    .text(\"first row\")\n    .row()\n    .text(\"second row\")\n    .build(); // NOTE: In GramIO, you don't have to use the \".build\" method\n```\n\n## Usage with Frameworks\n\n### Send via [GramIO](https://gramio.dev/)\n\n```ts\nimport { Bot, Keyboard } from \"gramio\"; // import from GramIO package!!\n\nconst bot = new Bot(process.env.TOKEN as string);\n\nconst data = [\"Apple\", \"Realme\", \"Tesla\", \"Xiaomi\"];\n\nbot.on(\"message\", (ctx) =\u003e {\n    return ctx.send(\"test\", {\n        reply_markup: new Keyboard()\n            .columns(1)\n            .text(\"simple keyboard\")\n            .add(...data.map((x) =\u003e Keyboard.text(x)))\n            .filter(({ button }) =\u003e button.text !== \"Tesla\"),\n    });\n});\n\nbot.start();\n```\n\n### Send via [Grammy](https://grammy.dev/)\n\n```ts\nimport { Keyboard } from \"@gramio/keyboards\";\nimport { Bot } from \"grammy\";\n\nconst bot = new Bot(process.env.TOKEN as string);\n\nconst data = [\"Apple\", \"Realme\", \"Tesla\", \"Xiaomi\"];\n\nbot.on(\"message\", (ctx) =\u003e {\n    return ctx.reply(\"test\", {\n        reply_markup: new Keyboard()\n            .columns(1)\n            .text(\"simple keyboard\")\n            .add(...data.map((x) =\u003e Keyboard.text(x)))\n            .filter(({ button }) =\u003e button.text !== \"Tesla\")\n            .build(),\n    });\n});\n\nbot.start();\n```\n\n### Send via [Telegraf](https://github.com/telegraf/telegraf)\n\n\u003e [!WARNING]\n\u003e The `Telegraf` does not support the latest version of Bot API\n\n```ts\nimport { Keyboard } from \"@gramio/keyboards\";\nimport { Telegraf } from \"telegraf\";\n\nconst bot = new Telegraf(process.env.TOKEN as string);\n\nconst data = [\"Apple\", \"Realme\", \"Tesla\", \"Xiaomi\"];\n\nbot.on(\"message\", (ctx) =\u003e {\n    return ctx.reply(\"test\", {\n        reply_markup: new Keyboard()\n            .columns(1)\n            .text(\"simple keyboard\")\n            .add(...data.map((x) =\u003e Keyboard.text(x)))\n            .filter(({ button }) =\u003e button.text !== \"Tesla\")\n            .build(),\n    });\n});\n\nbot.launch();\n```\n\n### Send via [node-telegram-bot-api](https://www.npmjs.com/package/node-telegram-bot-api)\n\n\u003e [!WARNING]\n\u003e The `node-telegram-bot-api` does not support the latest version of Bot API and the types are badly written, so the types may not match\n\n```ts\nimport { Keyboard } from \"@gramio/keyboards\";\nimport TelegramBot from \"node-telegram-bot-api\";\n\nconst bot = new TelegramBot(process.env.TOKEN as string, { polling: true });\n\nconst data = [\"Apple\", \"Realme\", \"Tesla\", \"Xiaomi\"];\n\nbot.on(\"message\", (msg) =\u003e {\n    return bot.sendMessage(msg.chat.id, \"test\", {\n        reply_markup: new Keyboard()\n            .columns(1)\n            .text(\"simple keyboard\")\n            .add(...data.map((x) =\u003e Keyboard.text(x)))\n            .filter(({ button }) =\u003e button.text !== \"Tesla\")\n            .build(),\n    });\n});\n```\n\n### Send via [puregram](https://puregram.cool/)\n\n\u003e [!WARNING]\n\u003e The `puregram` does not support the latest version of Bot API\n\n```ts\nimport { Telegram } from \"puregram\";\nimport { Keyboard } from \"@gramio/keyboards\";\n\nconst bot = new Telegram({\n    token: process.env.TOKEN as string,\n});\n\nconst data = [\"Apple\", \"Realme\", \"Tesla\", \"Xiaomi\"];\n\nbot.on(\"message\", (ctx) =\u003e {\n    return ctx.send(\"test\", {\n        reply_markup: new Keyboard()\n            .columns(1)\n            .text(\"simple keyboard\")\n            .add(...data.map((x) =\u003e Keyboard.text(x)))\n            .filter(({ button }) =\u003e button.text !== \"Tesla\")\n            .build(),\n    });\n});\n\nbot.updates.startPolling();\n```\n\n#### Result\n\n```json\n{\n    \"keyboard\": [\n        [\n            {\n                \"text\": \"simple keyboard\"\n            }\n        ],\n        [\n            {\n                \"text\": \"Apple\"\n            }\n        ],\n        [\n            {\n                \"text\": \"Realme\"\n            }\n        ],\n        [\n            {\n                \"text\": \"Xiaomi\"\n            }\n        ]\n    ],\n    \"one_time_keyboard\": false,\n    \"is_persistent\": false,\n    \"selective\": false,\n    \"resize_keyboard\": true\n}\n```\n\n![image](https://github.com/gramiojs/keyboards/assets/57632712/e65e2b0a-40f0-43ae-9887-04360e6dbeab)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramiojs%2Fkeyboards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgramiojs%2Fkeyboards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramiojs%2Fkeyboards/lists"}