|
8 | 8 | [](https://scrutinizer-ci.com/g/laravel-notification-channels/facebook)
|
9 | 9 | [](https://packagist.org/packages/laravel-notification-channels/facebook)
|
10 | 10 |
|
11 |
| -This package makes it easy to send notifications using [Facebook](https://developers.facebook.com/docs/messenger-platform/product-overview) with Laravel 5.3. |
| 11 | +This package makes it easy to send notifications using the [Facebook Messenger](https://developers.facebook.com/docs/messenger-platform/product-overview) with Laravel 5.3. |
12 | 12 |
|
13 | 13 | ## Contents
|
14 | 14 |
|
@@ -37,26 +37,29 @@ You must install the service provider:
|
37 | 37 | ```php
|
38 | 38 | // config/app.php
|
39 | 39 | 'providers' => [
|
| 40 | + // ... |
40 | 41 | NotificationChannels\Facebook\FacebookServiceProvider::class,
|
41 | 42 | ];
|
42 | 43 | ```
|
43 | 44 |
|
44 | 45 | ## Setting up your Facebook Bot
|
45 | 46 |
|
46 |
| -Follow the [Getting Started](https://developers.facebook.com/docs/messenger-platform/quickstart) guide and get a page token. |
| 47 | +Follow the [Getting Started](https://developers.facebook.com/docs/messenger-platform/quickstart) guide in order to create a Facebook Messenger app, a Facebook page and a page token, which is connecting both. |
47 | 48 |
|
48 |
| -Then, configure your Facebook Page Token: |
| 49 | +Next we need to add this token to our Laravel configurations. Create a new Facebook section inside `config/services.php` and place the page token there: |
49 | 50 |
|
50 | 51 | ```php
|
51 | 52 | // config/services.php
|
| 53 | +// ... |
52 | 54 | 'facebook' => [
|
53 | 55 | 'page-token' => env('FACEBOOK_PAGE_TOKEN', 'YOUR BOT TOKEN HERE')
|
54 | 56 | ]
|
55 | 57 | ```
|
56 | 58 |
|
57 | 59 | ## Usage
|
58 | 60 |
|
59 |
| -You can now use the channel in your `via()` method inside the Notification class. |
| 61 | +Let's take an invoice-paid-notification as an example. |
| 62 | +You can now use the Facebook channel in your `via()` method, inside the InvoicePaid class. The `to($userId)` method defines the Facebook user, you want to send the notification to. |
60 | 63 |
|
61 | 64 | ``` php
|
62 | 65 | use NotificationChannels\Facebook\FacebookChannel;
|
@@ -90,7 +93,7 @@ class InvoicePaid extends Notification
|
90 | 93 | }
|
91 | 94 | ```
|
92 | 95 |
|
93 |
| -Here's a screenshot preview of the above notification on Facebook Messenger: |
| 96 | +The notification will be sent from your Facebook page, whose page token you have configured earlier. Here's a screenshot preview of the notification inside the chat window. |
94 | 97 |
|
95 | 98 | 
|
96 | 99 |
|
|
0 commit comments