PHPackages                             ernestdefoe/flarum-facebook-post - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ernestdefoe/flarum-facebook-post

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

ernestdefoe/flarum-facebook-post
================================

Automatically push new Flarum discussion posts to a Facebook Page

v2.1.6(1mo ago)081MITPHP ^8.3

Since May 9Compare

[ Source](https://github.com/ernestdefoe/flarum-facebook-post)[ Packagist](https://packagist.org/packages/ernestdefoe/flarum-facebook-post)[ RSS](/packages/ernestdefoe-flarum-facebook-post/feed)WikiDiscussions Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (22)Used By (0)

Flarum Facebook Auto-Post
=========================

[](#flarum-facebook-auto-post)

[![Floxum](https://camo.githubusercontent.com/f631b57db44245a7ca759c7463c36b7f5739b791f16d353f3403943f94af3871/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f666c6172756d2d66616365626f6f6b2d706f73742f62616467652f6e616d65)](https://floxum.com/extension/ernestdefoe/flarum-facebook-post)[![Version](https://camo.githubusercontent.com/6a50d722545b0c92a43d56359a97619ce12748ffdda44b103b6aae0cb658344f/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f666c6172756d2d66616365626f6f6b2d706f73742f62616467652f686967686573742d76657273696f6e)](https://floxum.com/extension/ernestdefoe/flarum-facebook-post)[![Downloads](https://camo.githubusercontent.com/705703b7077be912da794038c6bdf4502c51745561e2197194602580567bc1ec/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f666c6172756d2d66616365626f6f6b2d706f73742f62616467652f646f776e6c6f616473)](https://floxum.com/extension/ernestdefoe/flarum-facebook-post)[![Review](https://camo.githubusercontent.com/cb2b78539a26f30329f0a137dc7a2a7dbf189de93e54622e3c507242af736de6/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f666c6172756d2d66616365626f6f6b2d706f73742f62616467652f726576696577)](https://floxum.com/extension/ernestdefoe/flarum-facebook-post)[![License](https://camo.githubusercontent.com/526e2909fe3b54e3e95c04a9d08b1be739ad9203c7c740f7ec8c67152470f584/68747470733a2f2f666c6f78756d2e636f6d2f657874656e73696f6e2f65726e6573746465666f652f666c6172756d2d66616365626f6f6b2d706f73742f62616467652f6c6963656e7365)](https://floxum.com/extension/ernestdefoe/flarum-facebook-post)

Automatically publishes an excerpt and link to a Facebook **Page** or **Group** whenever a new discussion is created on your Flarum 2 forum.

---

Features
--------

[](#features)

- Posts the discussion title, a short excerpt, and a link to your chosen Facebook destination
- **Image always displays** — posts as a photo upload so the image appears regardless of Facebook domain verification
- Supports both **Facebook Pages** (Page Access Token) and **Facebook Groups** (User Access Token)
- Toggle on/off from the Admin panel — no code changes needed
- Credentials stored securely in Flarum's settings store
- Optional tag filter — only post discussions in specific categories
- Works with [ernestdefoe/og-image](https://github.com/ernestdefoe/og-image) to use a default image when the post has no embedded images
- Logs success and errors to Flarum's application log (`storage/logs/`)

---

Requirements
------------

[](#requirements)

DependencyVersionPHP8.3+Flarum^2.0PHP extension`curl`---

Installation
------------

[](#installation)

```
composer require ernestdefoe/flarum-facebook-post
php flarum migrate
php flarum cache:clear
```

---

Configuration Overview
----------------------

[](#configuration-overview)

In the Flarum Admin panel go to **Extensions → Facebook Auto-Post** and set:

SettingDescription**Enable Facebook Auto-Post**Master on/off switch**Destination Type**`Facebook Page` or `Facebook Group`**Facebook Page ID**Numeric Page ID *(Page destination only)***Page Access Token**Never-expiring Page token *(Page destination only)***Facebook Group ID**Numeric Group ID *(Group destination only)***Group Access Token**Long-lived User Access Token *(Group destination only)*Only the fields for the selected Destination Type are used — the others are ignored at runtime.

---

Facebook Setup — Page
---------------------

[](#facebook-setup--page)

This section covers posting to a **Facebook Page** you manage.

### Step 1 — Create a Facebook Developer Account

[](#step-1--create-a-facebook-developer-account)

1. Go to **developers.facebook.com**
2. Click **Get Started** and log in with the Facebook account that manages your Page
3. Complete the free developer registration

---

### Step 2 — Create a Facebook App

[](#step-2--create-a-facebook-app)

1. Go to **My Apps → Create App**
2. When asked what the app will do, select **Other → Next**
3. For app type select **None → Next**
4. Give it any name (e.g. "My Forum") and click **Create App**

---

### Step 3 — Add Facebook Login to the App

[](#step-3--add-facebook-login-to-the-app)

1. Inside the App Dashboard click **Add Product**
2. Find **Facebook Login** and click **Set Up → Web**
3. Enter your forum URL and save

This step is required before permissions can be granted to tokens.

---

### Step 4 — Get Your Page ID (Important — read carefully)

[](#step-4--get-your-page-id-important--read-carefully)

The numeric ID in your Facebook Page URL (`profile.php?id=XXXXXXX`) is **not** always the correct API Page ID. To get the real API Page ID:

1. In the App Dashboard go to **Tools → Graph API Explorer**
2. Click **Generate Access Token** and add these permissions:
    - `pages_show_list`
    - `pages_read_engagement`
    - `pages_manage_posts`
    - `business_management`
3. Approve and log in
4. Set the method to **GET**, type `me/businesses` in the query box and click **Submit**
5. Note the `id` of each Business Account listed
6. For each business ID, run: `{business-id}/owned_pages?fields=id,name,access_token`
7. Find your Page — the `id` field is your **API Page ID** and `access_token` is your **Page Access Token**

> **Why this matters:** New Page Experience pages have a different internal API ID from the number shown in the browser URL. Using the wrong ID causes `(#100) The global id is not allowed` errors.

---

### Step 5 — Extend the Page Token

[](#step-5--extend-the-page-token)

The token from Step 4 may be short-lived. To get a long-lived token:

1. Copy the `access_token` from the `owned_pages` results
2. Go to **developers.facebook.com/tools/debug/accesstoken** and paste it in
3. Click **Extend Access Token** and copy the new token

Page Access Tokens generated this way do not expire as long as the user who generated them remains an admin of the Page.

---

### Step 6 — Configure the Extension (Page)

[](#step-6--configure-the-extension-page)

1. Go to **Admin → Extensions → Facebook Auto-Post**
2. Set **Destination Type** to **Facebook Page**
3. Fill in:
    - **Facebook Page ID** — the `id` from the `owned_pages` results
    - **Page Access Token** — the extended token from Step 5
4. Toggle **Enable Facebook Auto-Post** to ON and click **Save**

---

Facebook Setup — Group
----------------------

[](#facebook-setup--group)

This section covers posting to a **Facebook Group** you administer.

### Step 1 — Create a Developer App

[](#step-1--create-a-developer-app)

Follow the same Steps 1–3 from the Page setup above. If you already have an app from the Page setup, you can reuse it.

---

### Step 2 — Connect the App to Your Group

[](#step-2--connect-the-app-to-your-group)

Facebook requires the app to be installed on the Group before it can post to it:

1. Go to your Facebook Group
2. Click **More → Settings → Apps** (or **Manage Group → Apps** depending on your group layout)
3. Click **Add Apps** and search for your app by name
4. Add it and confirm

> If you do not see an Apps section, make sure the Group type allows third-party integrations. Private groups may restrict this.

---

### Step 3 — Get Your Group ID

[](#step-3--get-your-group-id)

The Group ID is the numeric segment of the Group URL:

```
https://www.facebook.com/groups/123456789012345
                                └─────────────┘ this is your Group ID

```

If your group uses a custom URL (e.g. `/groups/mygroupname`), go to the group, open the page source, and search for `"groupID"` to find the numeric value.

---

### Step 4 — Get a User Access Token with publish\_to\_groups

[](#step-4--get-a-user-access-token-with-publish_to_groups)

1. In the App Dashboard go to **Tools → Graph API Explorer**
2. Make sure your app is selected in the top-right dropdown
3. Click **Generate Access Token** and add the permission:
    - `publish_to_groups`
4. Approve and log in (you must log in as a Group admin or member)
5. Copy the token shown — this is your **User Access Token**

---

### Step 5 — Extend the User Token

[](#step-5--extend-the-user-token)

User Access Tokens expire after approximately 60 days even when extended. To get the maximum lifespan:

1. Copy your User Access Token
2. Go to **developers.facebook.com/tools/debug/accesstoken** and paste it in
3. Click **Extend Access Token** and copy the result

> **Important:** Unlike Page tokens, long-lived User Access Tokens cannot be made permanent. You will need to regenerate and update this token every ~60 days. Set a calendar reminder.

---

### Step 6 — Configure the Extension (Group)

[](#step-6--configure-the-extension-group)

1. Go to **Admin → Extensions → Facebook Auto-Post**
2. Set **Destination Type** to **Facebook Group**
3. Fill in:
    - **Facebook Group ID** — the numeric ID from Step 3
    - **Group Access Token** — the extended User Access Token from Step 5
4. Toggle **Enable Facebook Auto-Post** to ON and click **Save**

---

How It Works
------------

[](#how-it-works)

```
New discussion created (Flarum)
        │
        ▼
PostDiscussionToFacebook::handle()
        │
        ├── Is this post number 1? (only new discussions, not replies)
        ├── Is the extension enabled?
        ├── Destination Type = page or group?
        ├── Are the matching ID + token set?
        ├── Does the discussion pass the tag filter?
        │
        ▼
Is an image available?
(first  in post content, or ernestdefoe/og-image default image)
        │
        ├── YES ──► POST /{id}/photos  { url, caption, access_token }
        │                  │
        │           success? ──► Photo post with image on Facebook ✓
        │           failure? ──► falls back to link post (see below)
        │
        └── NO ───► POST /{id}/feed  { message, link, access_token }
                           │
                    Facebook Page/Group feed post with link preview ✓

```

Only the **first post** of each discussion triggers a Facebook update. Replies are ignored.

### Why photo posts?

[](#why-photo-posts)

Facebook suppresses link preview images for API posts from apps that have not completed Meta Business Manager domain verification. Posting via the `/photos` endpoint uploads the image directly to Facebook, so the image always appears regardless of whether your domain is verified.

If the photo upload fails (e.g. the image URL is not publicly accessible), the extension automatically falls back to a standard link post and logs the reason.

---

Troubleshooting
---------------

[](#troubleshooting)

SymptomLikely CauseNothing posted, no log entryExtension not enabled or credentials not saved`API error (HTTP 400): Malformed access token`Token copied incorrectly — re-copy with no extra spaces`API error (HTTP 400): The global id is not allowed`Wrong Page ID — use the `id` from `owned_pages`, not the URL number`API error (HTTP 403): Missing permission`Page token missing `pages_manage_posts` / `pages_read_engagement` — regenerate`API error (HTTP 400): #240 Requires a valid user`Token has expired — generate and extend a new one`API error (HTTP 200)` but nothing appears in GroupApp not connected to the Group — complete Step 2 of the Group setup`API error (HTTP 403): publish_to_groups not granted`Token missing `publish_to_groups` — regenerate with that permission`API error (HTTP 400): User must be an admin`The account that generated the Group token is not an admin of the Group`me/accounts returns empty`Page managed via Business Suite — use `me/businesses` then `{business-id}/owned_pages`cURL errorsServer cannot reach `graph.facebook.com` on port 443Post created but no imagePost has no embedded images and no default image is set — install `ernestdefoe/og-image` and configure a default image URL`Photo post API error` then `Falling back to link post` in logsImage URL is not publicly accessible or Facebook could not fetch it — check the URL works without authenticationLogs are written to `storage/logs/flarum.log`. Search for `[FacebookPost]` to find relevant entries.

---

Image display
-------------

[](#image-display)

When a new discussion is posted the extension looks for an image in this order:

1. The first `` found in the post content
2. The **Default OG Image** from the [ernestdefoe/og-image](https://github.com/ernestdefoe/og-image) extension settings

If an image is found it is posted via Facebook's `/photos` endpoint, which uploads the image directly and guarantees it displays on the Page or Group post. If no image is found (or the photo upload fails) it falls back to a standard link post, which relies on Facebook scraping the OG tags from your forum URL.

To ensure a fallback image is always available, install `ernestdefoe/og-image` and set a **Default OG Image URL** in its settings.

---

Support
-------

[](#support)

Questions, bug reports, and feature requests:

- **Support forum:**
- **Issues:**

License
-------

[](#license)

MIT © Ernestdefoe

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

21

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9978664264055711c21fbcf73c937f758df771d9cb40f6a25370b10123e7abc?d=identicon)[ernestdefoe](/maintainers/ernestdefoe)

### Embed Badge

![Health badge](/badges/ernestdefoe-flarum-facebook-post/health.svg)

```
[![Health](https://phpackages.com/badges/ernestdefoe-flarum-facebook-post/health.svg)](https://phpackages.com/packages/ernestdefoe-flarum-facebook-post)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k46](/packages/neuron-core-neuron-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[oat-sa/tao-core

TAO core extension

65143.7k124](/packages/oat-sa-tao-core)[flarum-lang/russian

Russian language pack for Flarum.

12128.3k](/packages/flarum-lang-russian)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
