PHP code example of marshmallow / laravel-facebook-webhook
1. Go to this page and download the library: Download marshmallow/laravel-facebook-webhook library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marshmallow / laravel-facebook-webhook example snippets
FACEBOOK_CALLBACK_ROUTE= #Default set 'webhook-client-facebook-lead'
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_PAGE_ID=
FACEBOOK_REDIRECT_URI= #'/auth/facebook'
'configs' => [
[
/*
* This package supports multiple webhook receiving endpoints. If you only have
* one endpoint receiving webhooks, you can use 'default'.
*/
'name' => 'facebook-lead',
/*
* The class name of the job that will process the Facebook Lead Data.
*
* This should be set to a class that extends \Marshmallow\LaravelFacebookWebhook\Jobs\ProcessFacebookLeadJob,
*/
'process_facebook_webhook_job' => '',
/*
* The callback route name from Facebook Leads .
*/
'callback_route' => env('FACEBOOK_CALLBACK_ROUTE', 'webhook-client-facebook-lead'),
/*
* The graph api version for Facebook .
*/
'graph_api_version' => 'v14.0',
/*
* The App ID from the Facebook App.
*/
'app_id' => env('FACEBOOK_CLIENT_ID'),
/*
* The App Secret from the Facebook App.
*/
'app_secret' => env('FACEBOOK_CLIENT_SECRET'),
/*
* The Page ID to retrieve the leads from.
*/
'page_id' => env('FACEBOOK_PAGE_ID'),
],
],
use Marshmallow\LaravelFacebookWebhook\Jobs\ProcessFacebookLeadJob as MarshmallowWebhookJob;
class ProcessFacebookDataJob extends MarshmallowWebhookJob
{
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
ray($this->webhookData);
}
}