Download the PHP package chatflowphp/telegram without Composer
On this page you can find all versions of the php package chatflowphp/telegram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chatflowphp/telegram
More information about chatflowphp/telegram
Files in chatflowphp/telegram
Package telegram
Short Description Telegram adapter for the ChatFlow conversational runtime.
License MIT
Homepage https://github.com/chatflowphp/telegram
Informations about the package telegram
ChatFlow Telegram
chatflowphp/telegram is the Telegram adapter for the ChatFlow runtime. Every chat is a state
machine: screens and dialog steps are scenes, each update is one tick, and navigation between
them is a transition that either commits or rolls back.
It supports webhook and polling execution, commands (including /command@bot in groups),
signed callback buttons, smart edit-or-send rendering, media views, callback acknowledgements,
file downloads, media groups and a typed Telegram layer for admin-style bots.
Documentation starts at docs/index.md. Coming from 1.x? Read docs/upgrade-from-1.x.md.
Quick Start
/start sent while the phone scene is active runs the command and keeps the scene; cancel
leaves it; anything else asks again. See examples/StarterBot for the
runnable version and examples/MiniShop for a larger bot with a declared
screen map.
Mapping
- Telegram messages become text events, callback queries become action events, media messages become inbound attachments.
- The chat id is the conversation id and the storage key.
reply()sends a new message.render()edits the current message where Telegram allows it, otherwise deletes and sends. An unchanged screen is a no-op.ack()answers the callback query; with text and no callback it sends a message.- Updates without a chat (inline queries, polls, shipping queries) are skipped with
Result::noMatch('unsupported_update').
Telegram-Specific Layer
Keep handlers on ChatFlow\Core\Context. Use ChatFlow\Telegram\TelegramContext for force
reply, Telegram message options and update metadata; inject TelegramPublisher when a handler
must obtain Telegram message ids immediately; inject Telegram\Bot\Api for endpoints ChatFlow
does not model.
Callback payloads are signed with a key derived from the bot token (or callbackSecret) and
verified on every callback query. Payloads that do not fit into 64 bytes are stored behind a
random token. Forged callback data is rejected before it reaches any handler.
Examples And Tests
TelegramBotTester and MockHttpClient drive a bot without network access and assert on the
Telegram requests it makes and on the conversation state.
Requirements
PHP 8.2 or newer, chatflowphp/core 2.x, irazasyed/telegram-bot-sdk 3.16 or newer.
License
MIT. See LICENSE.
All versions of telegram with dependencies
chatflowphp/core Version ^2.1
irazasyed/telegram-bot-sdk Version ^3.16
psr/log Version ^3.0