{"id":22596037,"url":"https://github.com/roziscoding/grammy-tap","last_synced_at":"2025-06-12T06:11:19.822Z","repository":{"id":265604198,"uuid":"850706771","full_name":"roziscoding/grammy-tap","owner":"roziscoding","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-10T11:53:02.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-07T17:54:54.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/roziscoding.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-09-01T14:54:57.000Z","updated_at":"2024-09-01T23:53:37.000Z","dependencies_parsed_at":"2024-11-30T04:48:21.680Z","dependency_job_id":"d7ad4a63-c394-4884-af34-745a6c316041","html_url":"https://github.com/roziscoding/grammy-tap","commit_stats":null,"previous_names":["roziscoding/grammy-tap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/roziscoding/grammy-tap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-tap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-tap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-tap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-tap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roziscoding","download_url":"https://codeload.github.com/roziscoding/grammy-tap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roziscoding%2Fgrammy-tap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259410151,"owners_count":22852971,"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":[],"created_at":"2024-12-08T10:12:50.035Z","updated_at":"2025-06-12T06:11:19.799Z","avatar_url":"https://github.com/roziscoding.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grammy-tap\n\nA middleware for [grammY](https://grammy.dev/) that sends updates to a\nconfigured server. It also has a UI available at the\n[grammy-tap-ui](https://github.com/yourusername/grammy-tap-ui) repository on\nGitHub.\n\n## Installation\n\nTo use this module in your Deno project:\n\n```ts\nimport { tap } from \"https://deno.land/x/grammy-tap/mod.ts\";\n```\n\n## Usage\n\n### Combined Tap (Updates and API)\n\nHere's a basic example of how to use the combined `tap` middleware with grammY:\n\n```ts\nimport { Bot } from \"https://deno.land/x/grammy/mod.ts\";\nimport { tap } from \"https://deno.land/x/grammy-tap/mod.ts\";\n\nconst bot = new Bot(Deno.env.get(\"TELEGRAM_TOKEN\") ?? \"\");\n\n// Add the combined tap middleware\nbot.use(tap({ serverUrl: Deno.env.get(\"TAP_SERVER_URL\") ?? \"\" }));\n\n// Your bot logic here\nbot.command(\"start\", (ctx) =\u003e ctx.reply(\"Hello, world!\"));\n\nbot.start();\n```\n\n### Individual Tap Functions\n\nYou can also use the update tap and API tap functions separately for more\ngranular control:\n\n#### Update Tap\n\nThe `udpateTap` function can be used to tap into updates received by your bot:\n\n```ts\nimport { Bot } from \"https://deno.land/x/grammy/mod.ts\";\nimport { udpateTap } from \"https://deno.land/x/grammy-tap/mod.ts\";\n\nconst bot = new Bot(Deno.env.get(\"TELEGRAM_TOKEN\") ?? \"\");\n\n// Add the update tap middleware\nbot.use(udpateTap({ serverUrl: Deno.env.get(\"TAP_SERVER_URL\") ?? \"\" }));\n\n// Your bot logic here\nbot.command(\"start\", (ctx) =\u003e ctx.reply(\"Hello, world!\"));\n\nbot.start();\n```\n\n#### API Tap\n\nThe `apiTap` function can be used to tap into API requests made by your bot:\n\n```ts\nimport { Bot } from \"https://deno.land/x/grammy/mod.ts\";\nimport { apiTap } from \"https://deno.land/x/grammy-tap/mod.ts\";\n\nconst bot = new Bot(Deno.env.get(\"TELEGRAM_TOKEN\") ?? \"\");\n\n// Add the API tap transformer\nbot.api.config.use(apiTap(Deno.env.get(\"TAP_SERVER_URL\") ?? \"\"));\n\n// Your bot logic here\nbot.command(\"start\", (ctx) =\u003e ctx.reply(\"Hello, world!\"));\n\nbot.start();\n```\n\nThese individual tap functions allow you to choose which aspects of your bot's\noperation you want to monitor with Tap.\n\n## Configuration\n\nThe `tap` and `updateTap` functions accept an options object with the following\nproperties:\n\n- `serverUrl` (required): The URL of your Tap server.\n- `tapErrors` (optional): A boolean indicating whether to send errors to the tap\n  server. Defaults to `true`.\n- `customProperties` (optional): A function that takes the context (`ctx`) as an\n  argument and returns a record of custom properties to send with each update.\n  This allows you to include additional information with your tapped data.\n\nExample usage with all options:\n\n```ts\nbot.use(tap({\n  serverUrl: Deno.env.get(\"TAP_SERVER_URL\") ?? \"\",\n  tapErrors: true,\n  customProperties: (ctx) =\u003e ({\n    userId: ctx.from?.id,\n    chatType: ctx.chat?.type,\n    // Add any other custom properties you want to include\n  }),\n}));\n```\n\nThis configuration will send all updates and errors to the tap server, along\nwith custom properties for each update.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froziscoding%2Fgrammy-tap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froziscoding%2Fgrammy-tap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froziscoding%2Fgrammy-tap/lists"}