Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Telegram Bot

Telegram Bot Laravel Package

aymericcucherousset/telegram-bot

A simple PHP Telegram Bot library for sending messages, handling updates, and interacting with Telegram’s Bot API. Includes helpers for requests, webhooks/long polling, keyboards, and common methods to build bots quickly and cleanly.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Telegram Bot
How do I integrate this Telegram bot package with Laravel’s queue system for delayed messages?
Use Laravel’s queue system by dispatching jobs for non-critical messages. The package supports queuing via `telegram:send` jobs, allowing you to delay messages with `->delay()` in your event or command logic. Ensure your queue worker (e.g., `queue:work`) is running to process these jobs asynchronously.
Does this package support Telegram’s webhooks, and how do I configure HTTPS for production?
Yes, the package supports webhooks, but you’ll need HTTPS for production. Use Laravel’s built-in server for testing or deploy with a reverse proxy like Nginx or Apache. For local development, tools like `ngrok` can expose your Laravel app securely for webhook testing.
Can I use this package with Laravel 9 or 10, and what PHP version is required?
The package requires PHP 8.1+, which aligns with Laravel 9 and 10. Verify compatibility by checking the package’s `composer.json` for Laravel version constraints. If unsure, test the package in a fresh Laravel project matching your target version.
How do I handle conversation states or multi-step interactions in this bot?
The package doesn’t include built-in state management, so you’ll need to implement it yourself. Use Laravel’s session, Redis, or a database to store conversation states. Middleware can help filter updates and route them to the correct state handler.
What are the alternatives to this package, and which one should I choose?
Alternatives include `irazasyed/laravel-telegram-bot` (more mature but older) or raw Telegram API calls via Guzzle. Choose this package if you want a lightweight, Laravel-native solution with event/queue support. For high-traffic bots, consider the raw API or a more established package.
How do I test Telegram bot updates locally without deploying to production?
Use long polling instead of webhooks for local testing. Configure the bot to use `setWebhook(false)` and handle updates via `getUpdates()` in a Laravel route or command. Tools like `ngrok` can also forward webhook requests to your local environment for testing.
Is this package suitable for production use, or is it better for small projects?
The package is lightweight and suitable for small to medium projects, but its low GitHub activity suggests unproven scalability for high-volume bots. Monitor Telegram API rate limits and consider queuing non-critical messages. For mission-critical bots, test thoroughly or use the raw API as a fallback.
How do I extend the package to add custom commands or domain-specific logic?
Extend the package by creating custom commands in Laravel routes or by overriding methods in a service provider. For example, bind a custom `BotService` to the container and inject it where needed. Use Laravel’s facades or dependency injection to wrap Telegram API calls for your domain.
How can I log bot interactions or errors for debugging?
Integrate Laravel’s logging system (e.g., Monolog) to log bot interactions, errors, or API responses. Use the `Log` facade to record events like `BotMessageReceived` or `BotError`. For alerts, pair with `laravel-sentry` or similar monitoring tools.
Does this package handle Telegram API rate limits, and how can I mitigate throttling?
The package doesn’t enforce rate limits, so you’ll need to implement them manually. Use Laravel’s queue system to batch messages and avoid exceeding Telegram’s 30 requests/second limit. Monitor API responses for `429 Too Many Requests` and implement exponential backoff in your retries.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle