madewithlove/
, (*1)
A set of helpers to communicate with the Facebook Messenger Platform, (*2)
Goals
Install
Via Composer, (*3)
``` bash
$ composer require madewithlove/facebook-messenger-platform, (*4)
## Usage
### Creating a client
This package assumes you have followed the [getting started](https://developers.facebook.com/docs/messenger-platform/quickstart) guide and
have received an access token for the Facebook page.
```php
use Madewithlove\FacebookMessengerPlatform\Api\HttpClient;
use Madewithlove\FacebookMessengerPlatform\Api\Client;
$httpClient = new HttpClient('your_access_token');
$client = new Client($httpClient);
Sending Messages
Text
$client->send()->message('recipient_id', 'hello world');
Image
$client->send()->image('recipient_id', 'http://url-to-image.com');
Generic Template
Takes the recipient ID and an array of elements. Refer to the documentation
for what the elements can consist of., (*5)
$client->send()->generic('recipient_id', []);
Takes the recipient ID, an array of buttons and a text. Refer to the documentation
for what the elements can consist of., (*6)
$client->send()->buttons('recipient_id', []);
Receipt Template
Takes the recipient ID and an payload for the receipt. Refer to the documentation
for what the receipt can consist of., (*7)
$client->send()->buttons('recipient_id', []);
TODO
- [ ] Welcome message configuration
- [ ] User Profile
Testing
bash
$ composer test, (*8)
License
The MIT License (MIT). Please see License File for more information., (*9)