2017 © Pedro Peláez
 

project facebook-message

Facebook messenger-platform with Laravel

image

denise92/facebook-message

Facebook messenger-platform with Laravel

  • Saturday, December 17, 2016
  • by denise92
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Facebook Message

Laravel 5 Package for Facebook messenger-platform with Laravel., (*1)

This is package for Laravel and Lumen 5.0, 5.1, 5.2, & 5.3, (*2)

Note: Before you start, you should follow Facebook message setup., (*3)

  1. Create an App and a Page, (*4)

  2. Have a https:// url., (*5)

Installation

PHP 5.5.9+, and Composer are required., (*6)

Add the Laravel Facebook Message package to your composer.json file., (*7)

{
    "require": {
        "denise92/facebook-message": "dev-master"
    }
}

You'll then need to run composer update to download it and have the autoloader updated., (*8)

Service Provider

In your app config, add the FacebookMessageServiceProvider to the providers array., (*9)

'providers' => [
    Denise92\FacebookMessage\FacebookMessageServiceProvider::class,
    ];

For Lumen, add the provider to your bootstrap/app.php file., (*10)

$app->register(Denise92\FacebookMessage\FacebookMessageServiceProvider::class);

Configuration File

After Create an App and a Page, you'll need to provide the app ID, page ID and Access token. In Laravel you can publish the configuration file with artisan., (*11)

$ php artisan vendor:publish

Where's the file? Laravel 5 will publish the config file to /config/facebook_message.php., (*12)

In Lumen you'll need to manually copy the config file from vendor/denise92/facebook-message/src/config/FacebookMessage.php, and rename to facebook_message.php in your config folder. Lumen doesn't have a /config folder by default so you'll need to create it if you haven't already., (*13)

Required config values

You'll need to update the fb_app_id, fb_page_id and fb_access_token values in the config file with your app ID, page ID and access token., (*14)

By default the configuration file will look to environment variables for your app ID and secret. It is recommended that you use environment variables to store this info in order to protect your app secret from attackers. Make sure to update your /.env file with your app ID & secret., (*15)

FB_APP_ID=1234567890
FB_PAGE_ID=987654321
FB_VERIFY_TOKEN=any-string-you-like
FB_ACCESS_TOKEN=YourPagesAccessToken

How to setup webhook from Facebook:

Callback URL: https://your-web.com/fb/webhook, (*16)

This url is defined in src/route.php, you can rewrite it if you like:, (*17)

Route::get('test/webhook', '\Denise92\FacebookMessage\FacebookMessageController@webhook');
Route::post('test/webhook', '\Denise92\FacebookMessage\FacebookMessageController@conversation');

Verify Token: any-string-you-like, (*18)

Subscription Fields: You can checked all., (*19)

Then press Save button. If Facebook get the verify code from https://your-web.com/fb/webhook, than you can start chat with your Pages message bot now., (*20)

The Versions

17/12 2016

dev-master

9999999-dev

Facebook messenger-platform with Laravel

  Sources   Download

1.0

The Requires

 

by Denise

laravel facebook laravel5 webhook messenger