- How do I install defstudio/telegraph in a Laravel application?
- Install it with composer require defstudio/telegraph; Laravel's package discovery registers the service provider and facade automatically. Publish the package config with php artisan vendor:publish and set your bot token in the published config or its matching environment variable. No database migrations or queue infrastructure are required, so you can start calling the Telegraph facade from controllers, commands, jobs, or notifications right away.
- Which Laravel and PHP versions does Telegraph support?
- Telegraph targets modern Laravel applications on PHP 8.1+, including Laravel 9, 10, and 11, and installs as a normal Composer dependency with no framework-level changes. The 1.73.x line is a minor release with additive, non-breaking changes, so existing behaviour is preserved. If your team needs strict change control, pin the exact version, because a ^1.72 constraint will pull 1.73 automatically.
- How do I send a Telegram message from Laravel using Telegraph?
- You build the message with the Telegraph facade, target the destination chat, and call send, which keeps the call site readable instead of hand-crafting Bot API payloads. Chat IDs can come from config, a notifiable model, or a database column, which makes it easy to route per user or per tenant. The same fluent builder supports formatting, media attachments, and keyboards, so you rarely need raw HTTP calls.
- How do I add inline keyboards and buttons to a Telegraph bot message?
- Telegraph ships keyboard and button builders that you attach to a message before sending, so you define rows and actions fluently rather than assembling nested arrays. Buttons can carry callback data or open URLs, and callback presses arrive through your webhook handler where you can answer and update the message. This keeps interactive menus, confirmations, and pagination inside normal Laravel code.
- How do I set up a Telegram webhook with Telegraph in Laravel?
- Telegraph includes webhook support so Telegram pushes updates into your app instead of you polling the API. You register your HTTPS endpoint with Telegram and route incoming updates through the package's update handling, where you dispatch commands or jobs. Make sure the webhook route is reachable by POST and not blocked by middleware such as CSRF, and consider validating Telegram's secret token header.
- Can I test Telegram bots built with Telegraph without hitting the API?
- Yes. Telegraph is designed to be testable, so you can fake the Telegram API in your test suite and assert which messages, keyboards, or media would have been sent. That works cleanly with Laravel's HTTP test helpers and with queued notification tests. Keep at least one staging smoke test against a real bot, because fakes cannot catch an invalid token or a wrong endpoint.
- Does Telegraph work with Laravel notifications?
- Yes. Telegraph integrates with Laravel's notification system, so you add telegram to a notification's via array and return a Telegraph message from the matching method. This lets one notification fan out across mail, database, and Telegram channels without duplicating logic. Resolve chat IDs per notifiable rather than hardcoding them, which keeps multi-tenant routing sane.
- How do conversations and polls work in Telegraph?
- The package includes helpers for multi-step conversations and for sending polls through the Bot API. Conversations let a flow wait for the user's next reply and continue, which suits onboarding, wizards, and simple support bots. Conversation state is persisted through a configurable store, so review that setting and its cache or database driver before running flows in production.
- How do I run multiple Telegram bots or resolve the bot token per tenant?
- Version 1.73.0 added deferred chat bot support, which allows the bot instance and token to be resolved lazily instead of at registration or boot time. That matters for multi-bot and multi-tenant applications where the correct token is only known per request, per tenant, or after configuration loads. Check the release notes to confirm resolution happens per request or job rather than being serialized into queued payloads, and test the notification channel and webhook handlers accordingly.
- Can Telegraph point at a local Telegram Bot API server or an egress proxy?
- Version 1.73.0 added the ability to set a custom full URL on a request, which is useful for a self-hosted Telegram Bot API server, an egress proxy, or a regional gateway. Drive it from environment configuration so staging and production can never accidentally share an endpoint. Because it overrides the destination for that call, verify it also covers file uploads and webhook registration, and watch for interactions with any custom Guzzle or HTTP client bindings.