{"id":16314254,"url":"https://github.com/rustamwin/telegram-bot-api","last_synced_at":"2025-10-04T01:44:25.626Z","repository":{"id":97362300,"uuid":"144332019","full_name":"rustamwin/telegram-bot-api","owner":"rustamwin","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-10T21:04:14.000Z","size":285,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T01:44:23.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/rustamwin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2018-08-10T21:04:03.000Z","updated_at":"2018-08-10T21:04:41.000Z","dependencies_parsed_at":"2023-03-15T17:45:48.793Z","dependency_job_id":null,"html_url":"https://github.com/rustamwin/telegram-bot-api","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/rustamwin/telegram-bot-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustamwin%2Ftelegram-bot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustamwin%2Ftelegram-bot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustamwin%2Ftelegram-bot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustamwin%2Ftelegram-bot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustamwin","download_url":"https://codeload.github.com/rustamwin/telegram-bot-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustamwin%2Ftelegram-bot-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278254470,"owners_count":25956598,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-10T21:53:30.177Z","updated_at":"2025-10-04T01:44:25.611Z","avatar_url":"https://github.com/rustamwin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Telegram Bot Api\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/telegram-bot/api.svg?style=flat-square)](https://packagist.org/packages/telegram-bot/api)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/TelegramBot/Api/master.svg?style=flat-square)](https://travis-ci.org/TelegramBot/Api)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/telegrambot/api.svg?style=flat-square)](https://scrutinizer-ci.com/g/telegrambot/api/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/telegrambot/api.svg?style=flat-square)](https://scrutinizer-ci.com/g/telegrambot/api)\n[![Total Downloads](https://img.shields.io/packagist/dt/telegram-bot/api.svg?style=flat-square)](https://packagist.org/packages/telegram-bot/api)\n\nAn extended native php wrapper for [Telegram Bot API](https://core.telegram.org/bots/api) without requirements. Supports all methods and types of responses.\n\n## Bots: An introduction for developers\n\u003eBots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats.\n\n\u003eYou control your bots using HTTPS requests to [bot API](https://core.telegram.org/bots/api).\n\n\u003eThe Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.\nTo learn how to create and set up a bot, please consult [Introduction to Bots](https://core.telegram.org/bots) and [Bot FAQ](https://core.telegram.org/bots/faq).\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require telegram-bot/api\n```\n\n## Usage\n\nSee example [DevAnswerBot](https://github.com/TelegramBot/DevAnswerBot) (russian).\n\n### API Wrapper\n#### Send message\n``` php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN');\n\n$bot-\u003esendMessage($chatId, $messageText);\n```\n#### Send document\n```php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN');\n\n$document = new \\CURLFile('document.txt');\n\n$bot-\u003esendDocument($chatId, $document);\n```\n#### Send message with reply keyboard\n```php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN');\n\n$keyboard = new \\TelegramBot\\Api\\Types\\ReplyKeyboardMarkup(array(array(\"one\", \"two\", \"three\")), true); // true for one-time keyboard\n\n$bot-\u003esendMessage($chatId, $messageText, null, false, null, $keyboard);\n```\n#### Send message with inline keyboard\n```php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN');\n\n$keyboard = new \\TelegramBot\\Api\\Types\\Inline\\InlineKeyboardMarkup(\n            [\n                [\n                    ['text' =\u003e 'link', 'url' =\u003e 'https://core.telegram.org']\n                ]\n            ]\n        );\n        \n$bot-\u003esendMessage($chatId, $messageText, null, false, null, $keyboard);\n```\n#### Send media group\n```php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN');\n\n$media = new \\TelegramBot\\Api\\Types\\InputMedia\\ArrayOfInputMedia();\n$media-\u003eaddItem(new TelegramBot\\Api\\Types\\InputMedia\\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));\n$media-\u003eaddItem(new TelegramBot\\Api\\Types\\InputMedia\\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));\n// Same for video\n// $media-\u003eaddItem(new TelegramBot\\Api\\Types\\InputMedia\\InputMediaVideo('http://clips.vorwaerts-gmbh.de/VfE_html5.mp4'));\n$bot-\u003esendMediaGroup($chatId, $media);\n```\n\n#### Client\n\n```php\nrequire_once \"vendor/autoload.php\";\n\ntry {\n    $bot = new \\TelegramBot\\Api\\Client('YOUR_BOT_API_TOKEN');\n    // or initialize with botan.io tracker api key\n    // $bot = new \\TelegramBot\\Api\\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');\n    \n\n    $bot-\u003ecommand('ping', function ($message) use ($bot) {\n        $bot-\u003esendMessage($message-\u003egetChat()-\u003egetId(), 'pong!');\n    });\n    \n    $bot-\u003erun();\n\n} catch (\\TelegramBot\\Api\\Exception $e) {\n    $e-\u003egetMessage();\n}\n```\n\n### Botan SDK (not supported more)\n\n[Botan](http://botan.io) is a telegram bot analytics system based on [Yandex.Appmetrica](http://appmetrica.yandex.com/).\nIn this document you can find how to setup Yandex.Appmetrica account, as well as examples of Botan SDK usage.\n\n### Creating an account\n * Register at http://appmetrica.yandex.com/\n * After registration you will be prompted to create Application. Please use @YourBotName as a name.\n * Save an API key from settings page, you will use it as a token for Botan API calls.\n * Download lib for your language, and use it as described below. Don`t forget to insert your token!\n\nSince we are only getting started, you may discover that some existing reports in AppMetriсa aren't properly working for Telegram bots, like Geography, Gender, Age, Library, Devices, Traffic sources and Network sections. We will polish that later.\n\n## SDK usage\n\n#### Standalone\n\n```php\n$tracker = new \\TelegramBot\\Api\\Botan('YOUR_BOTAN_TRACKER_API_KEY');\n\n$tracker-\u003etrack($message, $eventName);\n```\n\n#### API Wrapper\n```php\n$bot = new \\TelegramBot\\Api\\BotApi('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');\n\n$bot-\u003etrack($message, $eventName);\n```\n\n_You can use method `getUpdates()` and all incoming messages will be automatically tracked as `Message`-event_\n\n#### Client\n```php\n$bot = new \\TelegramBot\\Api\\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');\n```\n\n_All registered commands are automatically tracked as command name_\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email mail@igusev.ru instead of using the issue tracker.\n\n## Credits\n\n- [Ilya Gusev](https://github.com/iGusev)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustamwin%2Ftelegram-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustamwin%2Ftelegram-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustamwin%2Ftelegram-bot-api/lists"}