Weave 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 Laravel Package

laravel-notification-channels/telegram

Send Telegram notifications from Laravel using the Telegram Bot API. Supports text messages, inline keyboards, dice, polls, media groups, photos, documents, locations, contacts, stickers and more, plus message routing, response handling and direct client access.

View on GitHub
Deep Wiki
Context7
8.0.0

What's Changed

Added

  • Add button style support (danger, success, primary by @kooler62 in https://github.com/laravel-notification-channels/telegram/pull/213
  • TelegramRichMessage for the sendRichMessage API method (Telegram Bot API 10.1/10.2). Supports Markdown / HTML content (markdown(), html(), view()), attached media referenced with tg://photo?id= style links (media()), the is_rtl and skip_entity_detection flags, and fluent builders for every documented InputRichBlock type (paragraph(), heading(), preformatted(), footer(), divider(), math(), anchor(), blockquote(), pullquote(), details(), table(), listBlock(), thinking(), map(), photoBlock(), videoBlock(), audioBlock(), animationBlock(), voiceNoteBlock()) plus a block() escape hatch for raw blocks such as collage and slideshow.
  • TelegramRichMessageDraft for the sendRichMessageDraft API method. Extends TelegramRichMessage (so every content and block builder is available) and adds draftId(), a send() that streams the current content into the draft, and finalize() which turns the draft into a permanent message via sendRichMessage. Useful for streaming an AI generated answer as it is produced: repeated send() calls with the same draft id animate the replacement of the content. Drafts are limited to private chats and the draft id must be non-zero.
  • CouldNotSendNotification::invalidRichMessageDraftId() and CouldNotSendNotification::richMessageDraftIdNotProvided() exception constructors.
  • Telegram::sendRichMessage() and Telegram::sendRichMessageDraft() client methods.
  • Optional style parameter ('danger', 'success', 'primary') on button(), buttonWithCallback(), and buttonWithWebApp() methods for colored inline keyboard buttons (Telegram Bot API 9.4).
  • Support for guzzlehttp/guzzle 8.x alongside 7.x (^7.8 || ^8.0).
  • TelegramMessage::escapeLegacyMarkdown() helper that escapes the characters supported by the legacy Markdown parse mode (_, *, `, [).
  • TelegramFile::fileId() and TelegramFile::url() for attaching an existing Telegram file ID or a remote URL explicitly, bypassing the local-file/URL/file-ID detection heuristics of file(). Both validate their input and throw CouldNotSendNotification::invalidFileIdentifier() when it is malformed.
  • CouldNotSendNotification::invalidFileType() exception constructor.
  • Default HTTP timeouts on the bundled Guzzle client (Telegram::DEFAULT_TIMEOUT = 30s, Telegram::DEFAULT_CONNECT_TIMEOUT = 10s), so a network stall can no longer hang a queue worker indefinitely. Configurable via the new services.telegram.http config array, which is passed through to the Guzzle client (e.g. timeout, connect_timeout, proxy).
  • Automatic retry on rate limiting: when Telegram responds with a 429, the client waits for the reported parameters.retry_after and retries once. Responses with a retry_after above 60 seconds are not retried and fail immediately.
  • NotificationChannels\Telegram\Facades\Telegram facade for direct Bot API access (Telegram::sendMessage([...]) etc.). No alias is auto-registered to avoid clashing with other packages — import the class directly.
  • TelegramUpdates::create() (and its constructor) accept an optional Telegram client instance, so updates can be fetched without resolving the client from the container.

Changed

  • Breaking: escapedLine() now escapes according to the currently set parse mode. Under the default legacy Markdown mode only _, *, ` and [ are escaped (the only characters that mode supports escaping — previously the full MarkdownV2 set was escaped, which rendered stray backslashes). Under MarkdownV2 the previous full escaping is applied, and with HTML or no parse mode the line is appended untouched. Set the parse mode before calling escapedLine().

  • Breaking: TelegramFile::file() (and the string $type on the new fileId()/url()) now throws CouldNotSendNotification::invalidFileType() for an unknown file type string instead of silently falling back to document.

  • Breaking: Telegram client methods (sendMessage(), sendFile(), getUpdates(), etc.) and TelegramSenderContract::send() no longer have nullable return types; they either return a PSR-7 response (or a decoded array for chunked messages) or throw. TelegramUpdates::get() no longer returns an empty array for a missing response.

  • Breaking: CouldNotSendNotification::telegramRespondedWithAnError() now accepts any GuzzleHttp\Exception\BadResponseException (previously ClientException only) and no longer throws JsonException for a non-JSON error body — it falls back to no description given instead.

  • Server errors (5xx) from Telegram are now wrapped by CouldNotSendNotification::telegramRespondedWithAnError() with the status code and description, instead of the generic "communication failed" message.

  • Breaking: Removed the unused FileType::getMimeType(), FileType::getAllowedExtensions(), and FileType::isExtensionAllowed() enum helpers. They were never consulted by the package and carried incorrect data (e.g. the non-standard audio/mp3 MIME type). FileType::toArray() remains.

  • Breaking: Array values passed as form params to the Telegram client (e.g. via options() or direct client calls) are now JSON encoded before sending, as the Bot API expects for structured parameters such as message_ids. Previously they were passed to Guzzle's form_params and serialized in PHP's key[0]=... style, which Telegram rejects. Pre-encoded JSON strings are unaffected.

  • onError() now declares a static return type instead of self, preserving fluent chain types in subclasses.

  • Message chunking is now accurate for multibyte text: chunks are measured in UTF-8 characters (Telegram's 4096-character limit) instead of a byte/display-width mix, and the splitter prefers breaking at the last newline, then the last space, before hard-splitting. Note that a split can still land inside a Markdown entity; prefer chunk-sized paragraphs or normal() for machine-generated content.

  • Chunked messages no longer sleep after the final chunk (previously a fixed 1-second delay was added after every chunk, including the last one).

  • Allowed Pest 5 / PHPUnit 13 for the test suite (pestphp/pest and pestphp/pest-plugin-laravel ^4.0 || ^5.0). Pest 5 requires PHP 8.4+ and Laravel 13 (via Testbench 11 / PHPUnit 13), so Pest 4 is kept for the PHP 8.3 and Laravel 12 test matrix. No test or configuration changes were required.

  • TelegramRichMessage is no longer final and its fluent builders now return static instead of self, so subclasses (such as TelegramRichMessageDraft) keep chainability.

  • Telegram::decodeResponse() and CouldNotSendNotification::telegramRespondedWithAnError() now use PHP's json_decode() with JSON_THROW_ON_ERROR instead of the removed GuzzleHttp\Utils::jsonDecode(). Invalid JSON now throws JsonException instead of GuzzleHttp\Exception\InvalidArgumentException.

  • CouldNotSendNotification::telegramRespondedWithAnError() no longer calls ClientException::hasResponse() (removed in Guzzle 8); a ClientException always carries a response in both Guzzle 7 and 8, so the "no response body found" fallback has been dropped.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/7.0.0...8.0.0

7.0.0

What's Changed

Breaking Changes

  • TelegramFile::file() now strictly normalizes inputs to PSR-7 streams and rejects unsupported types earlier. Passing arbitrary values through to Guzzle is no longer allowed.

Added

  • Laravel 13 support.
  • New Telegram payload builders and fields:
    • businessConnectionId(), messageThreadId(), directMessagesTopicId()
    • protectContent(), allowPaidBroadcast(), messageEffectId()
    • replyParameters(), suggestedPostParameters()
  • TelegramLocation enhancements: horizontalAccuracy(), livePeriod(), heading(), proximityAlertRadius().
  • TelegramMessage: entities(), linkPreviewOptions().
  • TelegramFile: captionEntities(), showCaptionAboveMedia().
  • New builders: TelegramDice, TelegramMediaGroup.
  • Low-level client helpers:
    • sendDice, sendMediaGroup, sendChatAction
    • editMessageText, editMessageCaption, editMessageMedia, editMessageReplyMarkup
    • stopPoll, deleteMessage, deleteMessages

Changed

  • Minimum PHP version bumped to 8.3.
  • Dropped Laravel 11 support.
  • Codebase now enforces stricter typing (strict_types, improved PHPDoc shapes).
  • Centralized response decoding via Telegram::decodeResponse() using Guzzle JSON utilities.
  • Improved Telegram error parsing with safer fallbacks.
  • Refactored:
    • TelegramChannel recipient resolution and response handling
    • TelegramFile upload handling (clear remote vs local distinction)
    • TelegramMessage chunked sending behavior
    • Shared media logic extracted to InteractsWithTelegramMedia
  • onError() now accepts any callable.
  • HasSharedLogic typing hardened; keyboard layouts normalized for invalid column counts.
  • TelegramBase now accepts optional Telegram instance (better testability).
  • TelegramUpdates::get() safely returns empty array on invalid responses.
  • Config now supports both services.telegram.* and legacy keys.

Dev / Tooling

  • Upgraded to Pest 4 + pest-plugin-laravel 4.
  • PHPUnit 12 configuration and coverage updates.
  • CI workflows modernized (tests, coverage, changelog, PHPStan, PHP versions).
  • PHPStan raised to level: max with stricter rules enabled.

Tests

  • Expanded coverage:
    • Response decoding and error parsing
    • Channel routing and early returns
    • Chunked message handling
    • Updates fallback handling
    • Dice, media groups, and client helpers
  • Updated test suite to align with refactored runtime and tooling.

Docs

  • README refreshed with new builders, helpers, and configuration details.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/6.0.0...7.0.0

6.0.0

What's Changed

  • Add support for Laravel 12.
  • Add TelegramVenue to support sendVenue method.
  • Add sticker method to the TelegramFile to send sticker file.
  • Add sendWhen method to conditionally send a message.
  • Add ParseMode Enum and refactor parsing mode setting logic.
  • Add buttonWithWebApp method to open web app from a button.
  • Add onError method to handle exceptions. Based of https://github.com/laravel-notification-channels/telegram/pull/201 by @Hesammousavi.
  • Refactor sendFile to support raw data sending.
  • Refactor escapedLine method.
  • Refactor HasSharedLogic trait.
  • Refactor classes to use PHP 8.2 features.
  • Revise keyboard method parameters to $requestLocation and $requestContact to be consistent.
  • Fix sending document with content on-fly https://github.com/laravel-notification-channels/telegram/issues/200.
  • Drop support for Laravel 10.
  • Drop support for PHP 8.1.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/5.0.0...6.0.0

3.0.0

What's Changed

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/2.1.0...3.0.0

2.1.0

What's Changed

  • #143 - Fix jsonSerialize not compatible warning by making it compatible as per PHP.
  • #141 - Fix jsonSerialize warning by changing the return type to the array. Thanks @Muetze42.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/2.0.0...2.1.0

2.0.0

Notable Changes

  • Add Laravel 9 Support.
  • #139 - Add Laravel conditional trait to payload builder to use when on methods chain. Thanks, @foremtehan.
  • Drop support for the older versions of PHP < 7.4 and Laravel < 8.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/1.0.0...2.0.0

1.0.0

Notable Changes

  • Register Telegram instance to the container.
  • #133 - Add TelegramUpdates to retrieve bot updates. Thanks, @faissaloux.
  • #136 - Refactor TelegramChannel. Thanks, @faissaloux.
  • #138 - Add Contact Support. Thanks, @faissaloux.
  • Add Retrieving Chat ID docs and improve docs.
  • Add missing type declaration and minor improvements to various methods.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.9.0...1.0.0

0.9.0

Notable Changes

  • #130 - Add Poll Support. Thanks, @faissaloux.
  • #131 - Add Code Style GitHub Actions workflow.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.8.0...0.9.0

0.8.0

Notable Changes

  • #125 - Add usage in Lumen instructions.
  • Add message chunking feature ( chunk($limit) ) in cases where the message is too long. Closes #127.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.7.0...0.8.0

0.7.0

Notable Changes

  • #118 - Dropped PHP 7.1 support. Thanks @alexsoft.
  • #119 - Dispatch event NotificationFailed on exception. Thanks @4irik.
  • #120 - Test against PHP 8.1. Thanks @sergiy-petrov.
  • #122 - Add support to use TelegramChannel::class in on-demand notification route.
  • #122 - Refactor channel registration with the channel manager.

New Contributors

  • @4irik made their first contribution in #119

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.6.0...0.7.0

0.6.0

Notable Changes

  • #103 - Add GitHub Actions workflows for tests and coverage. Thanks @alexsoft.
  • #110 - Add alternate method to resolve Telegram notification channel. Thanks @putera.
  • #114 - Add buttonWithCallback() method. Thanks @digislexia.
  • Revise file upload logic.
  • Add more info on proxy setting in readme.
  • Remove dead badges from readme.

New Contributors

  • @putera made their first contribution in #110
  • @digislexia made their first contribution in #114

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.5.1...0.6.0

0.5.1
0.5.0

Notable Changes

  • #82 - Add view file support for notification content.
  • #84 - Add Bot token per notification support.
  • #86 - Add previous ClientException when constructing CouldNotSendNotification exception. Thanks @rubendl.
  • #88 - Add Laravel 8 Support. Thanks @faustbrian.
  • Add support to set HTTP Client.

New Contributors

  • @rubendl made their first contribution in #86
  • @faustbrian made their first contribution in #88

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.4.1...0.5.0

0.4.1

Notable Changes

  • #80 - Add Guzzle 7 support. Thanks @halloei.

New Contributors

  • @halloei made their first contribution in #80

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.4.0...0.4.1

0.4.0

Notable Changes

  • Add support to set custom api base_uri for web bridge.
  • Revise README with instructions for Proxy or Bridge support.
  • Fix typo in test.
  • Remove redundant test.
  • #72 - Revise on-demand notification instructions.
  • #75 - Fix issue with anonymous notifiables. Thanks @JackEllis.

New Contributors

  • @JackEllis made their first contribution in #75.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.3.0...0.4.0

0.3.0

Notable Changes

  • #68 - Test on PHP 7.4. Thanks @sergiy-petrov.
  • #70 - Add ability to set param in disableNotification method. Thanks @2618094.

New Contributors

  • @2618094 made their first contribution in #70.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.2.0...0.3.0

0.2.0

Notable Changes

  • Add Laravel 7 Support.
  • #67 - Add support to handle response from Telegram. Thanks @VladimirBerdnik.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.1.1...0.2.0

0.1.1

Notable Changes

  • #60 - Add PHP 7.1 Support.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.1.0...0.1.1

0.1.0

Notable Changes

  • New Helper Methods to work with file attachments.
  • Code cleanup.
  • Documentation updated with more examples and previews.
  • Micro optimization and improvements.
  • Typehint and return type declaration.
  • Fixed tests.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.6...0.1.0

0.0.6

Notable Changes

  • Laravel 6 Support.
  • #38 - Add Photo, Document, Audio, Sticker support + Additional error details in Exceptions. Thanks @irajtaghlidi.
  • #39 - Added Location support. Thanks @peregraum.
  • #40 - Add token getter and setter. Thanks @belguinan.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.5...0.0.6

0.0.5

Notable Changes

  • Add Laravel 5.7 Support.
  • #36 - Add ability to change button columns. Thanks @Lotuashvili.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.4...0.0.5

0.0.4

Notable Changes

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.3...0.0.4

0.0.3

Notable Changes

  • #21 - Add Laravel 5.5 support. Thanks @okaufmann.
  • Add Laravel Auto-Discovery support.

New Contributors

  • @okaufmann made their first contribution in #21.

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.2...0.0.3

0.0.2

Notable Changes

  • #9 - Add code coverage and badge(s). Thanks @casperboone.
  • #10 - Add missing custom composer command. Thanks @JayBizzle.
  • #12 - Fix bug missing register method in service provider. Thanks @enniel.
  • #13 & #14 - Add Tests for TelegramChannel and TelegramMessage. Thanks @bmitch.
  • #18 - Add Laravel 5.4 support. Thanks @ivanvermeyen.

New Contributors

Full Changelog: https://github.com/laravel-notification-channels/telegram/compare/0.0.1...0.0.2

0.0.1

Notable Changes

  • Experimental release.
  • #8 - QOL changes to README. Thanks @oyed.

New Contributors

  • @oyed made their first contribution in #8
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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib