{"id":25198723,"url":"https://github.com/feathers-studio/telegraf-docs","last_synced_at":"2025-04-04T18:13:19.528Z","repository":{"id":60676029,"uuid":"526383492","full_name":"feathers-studio/telegraf-docs","owner":"feathers-studio","description":"Documentation for Telegraf - the modern Bot API framework","archived":false,"fork":false,"pushed_at":"2024-02-11T17:02:24.000Z","size":674,"stargazers_count":319,"open_issues_count":7,"forks_count":32,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-10T03:18:38.129Z","etag":null,"topics":["api","bot","hacktoberfest","telegraf","telegram"],"latest_commit_sha":null,"homepage":"https://telegraf.js.org","language":null,"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/feathers-studio.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}},"created_at":"2022-08-18T21:51:56.000Z","updated_at":"2025-01-29T19:31:24.000Z","dependencies_parsed_at":"2023-01-19T01:00:34.225Z","dependency_job_id":"64402de8-d5b5-4044-b242-66935c5b39bd","html_url":"https://github.com/feathers-studio/telegraf-docs","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/feathers-studio%2Ftelegraf-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathers-studio%2Ftelegraf-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathers-studio%2Ftelegraf-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feathers-studio%2Ftelegraf-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feathers-studio","download_url":"https://codeload.github.com/feathers-studio/telegraf-docs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226198,"owners_count":20904465,"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":["api","bot","hacktoberfest","telegraf","telegram"],"created_at":"2025-02-10T03:18:40.152Z","updated_at":"2025-04-04T18:13:19.497Z","avatar_url":"https://github.com/feathers-studio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegraf docs\n\nThis repo will house the future of Telegraf's documentation. For now, it houses bot examples.\n\n### [![New](https://img.shields.io/badge/new%20✨-8A2BE2?style=flat-square) Build Telegram Mini Apps with Telegraf](./examples/mini-apps/README.md)\n\n## How to use these examples:\n\nIn the interest of brevity, the examples in the repo don't explain certain good-to-haves.\n\n### Graceful stop\n\nOn NodeJS, to make sure connections are gracefully closed before process is killed, you can use the `process.once` hooks. This is safe to add to the end of your bot's entry file.\n\n```TS\nprocess.once(\"SIGINT\", () =\u003e bot.stop(\"SIGINT\"));\nprocess.once(\"SIGTERM\", () =\u003e bot.stop(\"SIGTERM\"));\n```\n\n### Secrets\n\nThis section talks about how to pass variables like token, port, webhook domain to the bot.\n\nThe recommendation is to pass them via environment variables and not directly include them in code. This is especially true for sensitive secrets such as token. This should probably be added before calling `new Telegraf()`.\n\n```TS\n// default to port 3000 if PORT is not set\nconst port = Number(process.env.PORT) || 3000;\n\n// assert and refuse to start bot if token or webhookDomain is not passed\nif (!process.env.BOT_TOKEN) throw new Error('\"BOT_TOKEN\" env var is required!');\nif (!process.env.WEBHOOK_DOMAIN) throw new Error('\"WEBHOOK_DOMAIN\" env var is required!');\n```\n\n\u003e **Important note**: Only use the vars needed for your bot. If you don't use webhooks, you don't need WEBHOOK_DOMAIN or the corresponding assertion.\n\nDifferent deployment methods may have their own ways to pass environment variables. If you deploy to a Function-as-a-Service host such as Heroku, Netlify, AWS Lambda, GCP Functions, use the platform-specific way to set the correct environment variables.\n\nIf you use a conventional server, you can use the npm package `\"dotenv\"` to load vars from an `.env` file. Place this file in root and \u003cu\u003e\u003cb\u003eDO NOT FORGET\u003c/b\u003e\u003c/u\u003e to add this file to `.gitignore` (or you may leak credentials on the internet):\n\n```yaml\n# .env\nPORT=3000\nWEBHOOK_DOMAIN=bot.example.com\nBOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeathers-studio%2Ftelegraf-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeathers-studio%2Ftelegraf-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeathers-studio%2Ftelegraf-docs/lists"}