Skip to content

Commit 4eb7c13

Browse files
authored
Add instructions for response handling.
1 parent 442d3d3 commit 4eb7c13

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![Join PHP Chat][ico-phpchat]][link-phpchat]
44
[![Chat on Telegram][ico-telegram]][link-telegram]
5-
[![Laravel Package][ico-laravel]][link-repo]
65
[![Latest Version on Packagist][ico-version]][link-packagist]
76
[![Software License][ico-license]](LICENSE.md)
87
[![SensioLabsInsight][ico-sensiolabs]][link-sensiolabs]
@@ -22,6 +21,8 @@ This package makes it easy to send Telegram notification using [Telegram Bot API
2221
- [Attach a Location](#attach-a-location)
2322
- [Attach a Video](#attach-a-video)
2423
- [Attach a Gif File](#attach-a-gif-file)
24+
- [Routing a Message](#routing-a-message)
25+
- [Handling Response](#handling-response)
2526
- [Available Message methods](#available-message-methods)
2627
- [Available Location methods](#available-location-methods)
2728
- [Available File methods](#available-file-methods)
@@ -183,7 +184,7 @@ Preview:
183184

184185
![Laravel Telegram Gif Notification Example](https://user-images.githubusercontent.com/1915268/66617071-109ed080-ebf1-11e9-989b-b237f2b9502d.jpg)
185186

186-
### Routing a message
187+
### Routing a Message
187188

188189
You can either send the notification by providing with the chat id of the recipient to the `to($chatId)` method like shown in the above example or add a `routeNotificationForTelegram()` method in your notifiable model:
189190

@@ -201,6 +202,12 @@ public function routeNotificationForTelegram()
201202
...
202203
```
203204

205+
### Handling Response
206+
207+
You can make use of the [notification events](https://laravel.com/docs/5.8/notifications#notification-events) to handle the response from Telegram. On success, your event listener will recieve a [Message](https://core.telegram.org/bots/api#message) object with various fields as appropriate to the notification type.
208+
209+
For a complete list of response fields, please refer the Telegram Bot API's [Message object](https://core.telegram.org/bots/api#message) docs.
210+
204211
### Available Message methods
205212

206213
- `to($chatId)`: (integer) Recipient's chat id.
@@ -267,7 +274,6 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
267274

268275
[ico-phpchat]: https://img.shields.io/badge/Slack-PHP%20Chat-5c6aaa.svg?style=flat-square&logo=slack&labelColor=4A154B
269276
[ico-telegram]: https://img.shields.io/badge/@PHPChatCo-2CA5E0.svg?style=flat-square&logo=telegram&label=Telegram
270-
[ico-laravel]: https://img.shields.io/badge/Laravel-5|6-FF2D20.svg?style=flat-square&logo=laravel&labelColor=black&logoColor=white
271277
[ico-version]: https://img.shields.io/packagist/v/laravel-notification-channels/telegram.svg?style=flat-square
272278
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
273279
[ico-travis]: https://img.shields.io/travis/laravel-notification-channels/telegram/master.svg?style=flat-square

0 commit comments

Comments
 (0)