Download the PHP package torgodly/messenger-bot without Composer

On this page you can find all versions of the php package torgodly/messenger-bot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package messenger-bot

torgodly/messenger-bot

Facebook Messenger webhooks for Laravel (messages, postbacks, quick replies, feed comments). API similar to BotMan (hears, payload, onComment) without BotMan.

PHP 8.3+ · Laravel 12 or 13

Install

One Facebook Page (default): the command above writes the usual .env keys, validates the token when possible, and subscribes webhooks. You do not configure tenant resolution.

Several Pages (multi-tenant): use the same install command with flags so .env is filled for you—no custom resolver class is required:

(--model= is optional in interactive mode; you can add MESSENGER_BOT_TENANCY_CONNECTION_MODEL later.) The package resolves incoming webhooks by loading that Eloquent model where facebook_page_id matches the Page ID (override column with MESSENGER_BOT_TENANCY_PAGE_ID_COLUMN). Set MESSENGER_BOT_TENANCY_RESOLVER only if you need a fully custom lookup.

Configure

Env / setting Purpose
APP_URL Public base URL (no trailing slash).
MESSENGER_BOT_APP_ID, MESSENGER_BOT_APP_SECRET Meta app.
MESSENGER_BOT_VERIFY_TOKEN Same string in Meta → Webhooks → Verify Token.
MESSENGER_BOT_PAGE_ACCESS_TOKEN Optional; leave empty and use OAuth for production.
MESSENGER_BOT_TENANCY_ENABLED, MESSENGER_BOT_TENANCY_CONNECTION_MODEL Multi-tenant mode and the Eloquent model used for Page → tenant mapping (see install --tenant).

Meta — Facebook Login: add redirect URI (exact match):

https://YOUR-DOMAIN/messenger-bot/oauth/facebook/callback
(or MESSENGER_BOT_OAUTH_REDIRECT_URI if set)

Meta — Webhooks (Page): callback https://YOUR-DOMAIN/webhook/messenger (or MESSENGER_BOT_WEBHOOK_PATH), same verify token.

Webhook and OAuth routes are registered outside the web middleware group (no CSRF 419 on Meta POSTs). Set MESSENGER_BOT_AUTO_REGISTER_ROUTES=false only if you register the webhook route yourself.

Usage — handlers

Register once at boot (e.g. App\Providers\AppServiceProvider::boot() or routes/web.php):

Priority (higher runs first): MessengerBot::hears('pattern', $handler, priority: 10);

Get Started: register payload() for MESSENGER_BOT_GET_STARTED_PAYLOAD or set MESSENGER_BOT_GET_STARTED_REPLY for a default when no handler matches.

Usage — OAuth (single Page)

Open in browser (as Page admin):

https://YOUR-DOMAIN/messenger-bot/oauth/facebook

Token is cached; profile sync runs on install. Clear with php artisan messenger-bot:clear-page-token.

Usage — multi-tenant

  1. Database row per Page — an Eloquent model implements MessengerBot\Contracts\MessengerConnectable and uses MessengerBot\Laravel\Concerns\InteractsWithMessengerConnection. By default it reads tenant_id, primary key (or id column) for the connection id, and facebook_page_id for the Graph Page id. Override messengerTenantIdColumn(), messengerConnectionKeyColumn(), or messengerFacebookPageIdColumn() if your columns differ.

  2. Turn it onphp artisan messenger-bot:install --tenant --model=Your\\Model or set MESSENGER_BOT_TENANCY_ENABLED=true and MESSENGER_BOT_TENANCY_CONNECTION_MODEL=Your\\Model. Webhooks then load that model with where(facebook_page_id, <Page id from Meta>). If no row matches, legacy behaviour depends on MESSENGER_BOT_TENANCY_FALLBACK_LEGACY / MESSENGER_BOT_TENANCY_SKIP_UNRESOLVED (see config comments).

  3. OAuth — after the user is logged into your app, send them to Facebook with the connectable model so the callback can store the token for that row:

  4. Posts and background jobs — same object everywhere:

  5. Inside webhook handlers — optional active resolution:

MESSENGER_BOT_OAUTH_DUAL_WRITE_LEGACY (default true) also fills the legacy global token cache for tools that still expect a single Page. MESSENGER_BOT_OAUTH_REQUIRE_MT_SIGNATURE=false is for local debugging only. Swap ConnectionTokenRepository in the container if you store tokens in the database instead of cache.

Usage — multi-tenant (advanced)

Usage — Page posts (Graph)

Inject MessengerBot\Kernel\Contracts\SyncsFacebookPagePosts.

Single-tenant: tenancy off; forConnectable() still works with any object implementing MessengerConnectable (stable keys + Page id). Legacy token must match pageId when a legacy page_id is cached.

Invalidate post list cache:

Background refresh (raw keys or connectable):

Example DB migration stub: stubs/migrations/create_mb_connections_table.php.stub.

Artisan

Command Purpose
messenger-bot:install Publish config, .env keys, token check, subscribe, menu.
messenger-bot:install --tenant [--model=] Same as above plus multi-tenant .env defaults (MESSENGER_BOT_TENANCY_*).
messenger-bot:sync-page Re-subscribe webhook fields, persistent menu.
messenger-bot:token-status Cached token / expiry hint.
messenger-bot:clear-page-token Clear legacy cached Page token.

--skip-token-check on install/sync skips Graph GET /me.

Events

WebhookReceived, MessageReceived, PostbackReceived, CommentCreated, PostsSynced, PostsCacheHit, PostsCacheMiss, plus outgoing send events.

References

403 webhook: wrong app secret vs Meta, or leave MESSENGER_BOT_SIGNATURE_ENABLED=false only in local tests.


All versions of messenger-bot with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-json Version *
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/events Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/cache Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/bus Version ^12.0|^13.0
illuminate/queue Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package torgodly/messenger-bot contains the following files

Loading the files please wait ...