@extends('layouts.admin') @section('content')
@include('admin.partials.pro-hero', [ 'icon' => 'fas fa-book', 'title' => __('Facebook Webhook Setup Guide'), 'subtitle' => __('Step-by-step webhook configuration'), 'breadcrumbs' => [['label' => __('Dashboard'), 'url' => route('admin.dashboard')], ['label' => __('App Settings'), 'url' => route('admin.chatbot.app-settings.index')], ['label' => __('Webhook Guide'), 'url' => null]], ]) @include('includes.admin.form-error') @include('includes.admin.form-success')

{{ __('Setup Instructions') }}

{{-- Introduction --}}
What is a Webhook?

Webhooks allow Facebook to send real-time notifications to your server when users interact with your chatbot (messages, comments, etc.). This guide will help you set up the webhook connection between Facebook and your application.

{{-- Step-by-step Guide --}}

Setup Steps

{{-- Step 1 --}}
1 Create Facebook App
  1. Go to Facebook Developers
  2. Click "Create App"
  3. Select "Business" as the app type
  4. Fill in your app details and create the app
  5. Add "Messenger" product to your app
{{-- Step 2 --}}
2 Configure App Settings in Admin Panel
  1. Copy your App ID and App Secret from Facebook Developer Dashboard
  2. Go to Facebook App Settings in your admin panel
  3. Paste the App ID and App Secret
  4. Click "Generate" to create a Verify Token
  5. Click "Save Settings"
  6. Click "Test Connection" to verify credentials
Your Webhook Details:
Callback URL: {{ $webhookUrl }}
Verify Token: {{ $setting->verify_token ?? 'Not Generated' }} @if($setting->verify_token) @endif
{{-- Step 3 --}}
3 Setup Webhook in Facebook
  1. In your Facebook App Dashboard, go to Messenger > Settings
  2. Scroll to "Webhooks" section
  3. Click "Add Callback URL"
  4. Enter the following:
    • Callback URL: {{ $webhookUrl }}
    • Verify Token: {{ $setting->verify_token ?? 'Generate first!' }}
  5. Click "Verify and Save"
Important: Make sure your website is accessible via HTTPS and publicly reachable. Facebook won't be able to verify HTTP URLs or localhost.
{{-- Step 4 --}}
4 Subscribe to Webhook Fields

After webhook verification, subscribe to the following fields:

Messaging Events:
  • messages - Receive messages from users
  • messaging_postbacks - Button clicks
  • message_deliveries - Delivery confirmations
  • message_reads - Read receipts
Feed Events (Optional):
  • feed - Page post comments
  • mention - Page mentions
{{-- Step 5 --}}
5 Connect Facebook Page
  1. In Messenger > Settings, scroll to "Access Tokens"
  2. Click "Add or Remove Pages"
  3. Select the Facebook Page you want to connect
  4. Copy the Page Access Token
  5. Users will use this token to connect their pages in the user panel
{{-- Step 6 --}}
6 Test Your Setup
  1. Send a test message to your Facebook Page
  2. Check if the webhook receives the event (check logs if needed)
  3. Verify that auto-replies are working
  4. Test comment automation on a page post
Success! Your chatbot is now ready to receive and respond to messages!
{{-- Troubleshooting --}}

Troubleshooting

{{-- Issue 1 --}}
  • Make sure your website is using HTTPS
  • Check that the Verify Token matches exactly
  • Ensure your server is publicly accessible (not localhost)
  • Check server logs for incoming requests from Facebook
{{-- Issue 2 --}}
  • Verify that webhook fields are subscribed (messages, messaging_postbacks)
  • Check if the Page is connected to your app
  • Ensure Page Access Token is valid
  • Check application logs for errors
{{-- Issue 3 --}}
  • Double-check your App ID and App Secret
  • Make sure the app is not in Development Mode with restrictions
  • Verify Graph API version compatibility
  • Check if your server can make outbound HTTPS requests
{{-- Action Buttons --}}
@endsection @section('scripts') @endsection