Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Driver Facebook Laravel Package

botman/driver-facebook

Facebook Messenger driver for BotMan, letting PHP and Laravel developers connect chatbots to Messenger. Handle incoming messages, buttons, quick replies, attachments, and webhook integration through BotMan’s clean, familiar API.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require (check the package's README for the exact vendor/name), then publish any config with php artisan vendor:publish --tag=<package-config> if the package exposes one. In Laravel 5.5+ service provider and facade/alias discovery is automatic; on older versions register them in config/app.php.
  • Add the required credentials to .env (typically a page access token / app secret / verify token) and mirror them in config/services.php or the package config file. Never commit these; use per-environment values.
  • Look first at the package's main entry class (facade or manager) and its README examples for sending a Generic Template. That is the core object this release touches, so it is the best smoke test.
  • First use case: send a Generic Template with a Quick Reply button. Build the template, attach one or more quick replies, and dispatch it through the package's send method or a Laravel Notification channel. Verify the payload arrives by inspecting the outgoing request (log or HTTP client fake) before hitting the live Graph API.

Implementation Patterns

  • Template builder pattern. Construct Generic Template elements (title, subtitle, image_url, buttons) as arrays or value objects, then append Quick Replies with the newly added helper. Keep template construction in a dedicated class or method so button/quick-reply variations stay testable.
  • Notification-driven sends. Wrap the package in a Laravel Notification (toMessenger/channel method) so sending is queued, retried, and testable like any other notification. This keeps controllers thin and centralizes recipient resolution.
  • Quick Replies as a UX router. Use the new Quick Reply button to drive conversational flows: each quick reply carries a payload your webhook handler switches on. Treat payload strings as a contract—define them as constants/enums shared between sender and webhook handler.
  • Composition over duplication. Build helper methods like genericTemplate(array $elements) and quickReply(string $title, string $payload) so every send reuses validated structures rather than hand-rolling payload arrays.
  • Webhook integration. Pair outbound sends with an inbound webhook controller that verifies the signature, parses postback/message.quick_reply payloads, and routes to handlers. Keep verification middleware separate from business logic.
  • Testing. Fake the HTTP layer (Http::fake()) or the package's client to assert the JSON payload—especially the quick_replies array—without calling Facebook. Snapshot the payload for template-shape regressions.

Gotchas and Tips

  • Quick Reply limits. Messenger caps quick replies per message (commonly 11) and enforces title length limits. Validate counts/lengths in your builder so a UI change doesn't silently break sends.
  • Payload round-trip. Quick Reply payload values are echoed back in webhook events. Namespace them (e.g. flow:step:action) so handlers don't collide as flows grow.
  • PHP 7.4 null-offset fix (1.11.0). This release resolves Trying to access array offset on value of type null. If you previously worked around missing optional template fields with defensive defaults, you can often simplify—but keep guards on genuinely required fields and confirm behavior on your PHP version before removing them.
  • Generic Template vs. Button Template. Not every button type is valid on every template; attaching a Quick Reply alongside template buttons is supported, but misplacing a button type yields opaque Graph API errors. Validate against the API's template rules.
  • Config caching. After changing tokens or config, run php artisan config:clear in local/dev; stale cached config is a common "why is it sending as the wrong page" cause.
  • Queues and rate limits. Send via queued notifications and honor Graph API rate limits/backoff; synchronous sends in request cycles will bite under load.
  • Extension points. Prefer overriding the template/payload builder or binding a custom client in the container over editing vendor files, so upgrades (like this one) stay painless. Pin the version in composer.json and read release notes for payload-shape changes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource