madewithlove/facebook-messenger-platform

This package is abandoned and no longer maintained. The author suggests using the pimax/fb-messenger-php package instead.

Easily communicate with the facebook messenger platform

0.1.0 2016-04-15 20:43 UTC

This package is auto-updated.

Last update: 2019-11-15 15:26:27 UTC


README

Build Status Latest Stable Version Total Downloads Scrutinizer Quality Score Code Coverage

A set of helpers to communicate with the Facebook Messenger Platform

Goals

Install

Via Composer

$ composer require madewithlove/facebook-messenger-platform

Usage

Creating a client

This package assumes you have followed the getting started guide and have received an access token for the Facebook page.

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.

$client->send()->generic('recipient_id', []);

Buttons Template

Takes the recipient ID, an array of buttons and a text. Refer to the documentation for what the elements can consist of.

$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.

$client->send()->buttons('recipient_id', []);

TODO

  • Welcome message configuration
  • User Profile

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.