appto-team/telegram-bot-cast-laravel
A Laravel package for integrating Telegram bots into your application. Configure bot credentials and send messages or notifications to Telegram chats through a simple, framework-friendly API, making bot-driven updates and alerts easy to add.
composer require appto-dev/telegram-bot-cast-laravel, then publish the package config/views with php artisan vendor:publish (pick the provider tag shown by php artisan vendor:publish --list — the package exposes a service provider that registers the client, facade alias, and config file). Add your bot credentials to .env (typically a TELEGRAM_BOT_TOKEN entry) and never commit the token.config/telegram-bot-cast.php (or similarly named file) is the source of truth for token, base API URL, timeouts, and default chat/channel IDs. Next, check the service provider's bindings — that tells you which contract to type-hint for dependency injection and which facade to use for quick calls.3.2.10.3) is a bot-generated sync to Telegram Bot API 10.3. Check composer.json for the supported PHP/Laravel ranges, and note the version suffix tracks the upstream Bot API — not a package-specific patch level.php artisan tinker (or a throwaway route) using the facade/default client to a private chat with your bot. This validates token, network egress, and config caching in one step before you build notifications or webhooks on top.ShouldQueue) rather than calling the API inline from HTTP requests. This keeps request latency low and gives you a natural place to add rate-limit backoff and retries (retry_after on 429s).via() routing, or call the client directly from a notification's toTelegram() method if the channel isn't provided. Keep message formatting (Markdown/HTML) in a dedicated formatter class so escaping is centralized.web middleware group (no CSRF/session), verify the X-Telegram-Bot-Api-Secret-Token header against config, and dispatch an event/job per update. Return 200 fast; do the work asynchronously.update_id (or message ID for edits) in a cache/DB unique index so retried webhook deliveries don't double-send.Http::fake() to assert outgoing payloads, and fake the client contract for unit tests. Keep one or two integration smoke tests against a private test bot gated behind an env flag so you catch real API drift without slowing CI.composer.json and read the changelog before bumping minor versions — payload shapes for new media/types can change between Bot API syncs.[BOT] API 10.3 | release 3.2.10.3 mean an automated API-sync PR, not a curated bugfix. Treat the bump as "new upstream Bot API surface" and diff the actual commits if you depend on a specific method's payload shape.setWebhook persists on Telegram's side — remember to deleteWebhook before switching back to polling locally, or you'll spend an hour debugging "no updates received."parameters.retry_after; don't blindly retry Retry-After-less failures.php artisan config:cache, any runtime config()->set() trick for tokens is ignored. Use env vars plus named connections instead of mutating config at runtime.file_id reuse from fresh uploads; Bot API caps uploads (~50 MB send / ~20 MB download) and streaming large files through PHP will blow memory limits — prefer URLs or pre-uploaded file_ids.400 Bad Request: can't parse entities). Escape user-supplied text or send as plain text; log the raw response body, not just the status code./bot<token>/method). Ensure your HTTP client logging / Laravel Telescope / exception handlers redact it, and never echo the resolved base URL in error messages.php artisan queue:restart after deploying a package or config change, especially with Octane.call(method, payload) escape hatch — use it and file an issue upstream rather than patching vendor code.How can I help you explore Laravel packages today?