OpenCodeFacebook Pages

Post to a Facebook Page from OpenCode

Give OpenCode your release notes and the name of the Facebook Page. Review the text, approve it once, and check the Page post through PubNio.

Connect OpenCode

opencode mcp add writes the same entry. Remote servers sit under mcp.servers with type remote.

Add PubNio to opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "pubnio": {
        "type": "remote",
        "url": "https://pubnio.com/mcp"
      }
    }
  }
}
opencode.json

Sign in

  1. Run opencode mcp auth pubnio, or run /mcps inside OpenCode and select pubnio.
  2. Your browser opens PubNio sign-in; approve the workspace.

Connect your Facebook account

Open PubNio, choose your workspace, and go to Accounts. Use the same workspace when you sign in from OpenCode.

  • Choose a Facebook Page you can manage.
  • Connect the Page in PubNio through Meta OAuth and grant Page publishing access.
  • Check that PubNio lists the Page as ready before asking OpenCode to publish.
  • Open the repository with your changelog in OpenCode.

Check the destination

Read-only destination check
List the Facebook Pages in my PubNio workspace. Show their names and which ones are ready to publish. Do not create, schedule, or publish a post.

Post a release announcement to a Facebook Page

Paste the prompt into OpenCode. It runs the job through PubNio's search and execute tools, as in the Code Mode flow below. Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

Read the latest entry in CHANGELOG.md and draft a short Facebook Page update for customers. Find my ready Pages in PubNio and ask me if the destination is ambiguous. Show me the Page and exact text. After I approve, publish one text-only feed post. Check the existing delivery and return the Facebook permalink, or the PubNio post ID if it is still pending.
Post a release announcement to a Facebook Page

Check delivery and get the link

If delivery is still pending, keep the PubNio post ID and check the same post. A published delivery with a provider reference confirms the result.

  1. Save the post ID after PubNio accepts the request.
  2. Check that the delivery is for the same Facebook Page you approved.
  3. Read the same delivery until it is published and returns its Page permalink.
  4. If the result is unresolved, inspect the Page before retrying the existing target.

From approval to delivery

Illustrative conversation and result with sample data.

  1. OpenCode

    I found two ready Facebook Pages. For Example Studio, the proposed feed post is “Weekly queues are here. Pick a posting schedule once, then add releases to the next available slot.”

  2. You

    Use the Example Studio Page. The text is approved.

  3. OpenCode

    PubNio accepted one feed post. I checked that post again and got a confirmed Facebook permalink.

Example delivery result

Status
published
Destination
Example Studio · Facebook Page feed
Sample URL
https://www.facebook.com/101/posts/77

Facebook rules OpenCode runs into

Account kinds: social page. Connection scopes: pages_manage_posts, pages_read_engagement, pages_show_list.

Facebook placements from the capability catalog
PlacementMedia typesMax per targetCaption limit
feed (default)image, video1063,206
reelimage, video1063,206
storyimage, video1063,206
  • A Page feed update can be text-only.
  • A feed post takes up to 10 images or videos.
  • A Reel takes up to 10 images or videos.
  • A Story takes up to 10 images or videos.
  • Use the Reel or Story placement when you want that native format.
  • Stage attachments before publishing. Use an H.264 MP4 with AAC audio for video.

Failures and recovery

Match the error before asking OpenCode to retry.

Facebook Pages publishing failures and safe retry behavior
CodeCauseFixRetry
account_not_readyThe connected account's OAuth token is expired, revoked, or disconnected.Reconnect the account in the PubNio workspace, then re-validate.After reconnect
publish_permission_requiredThe OAuth grant is missing a required publishing scope.Re-authorize the account in the workspace with publish permissions enabled.After reconnect
media_requiredPlacement (such as Instagram Feed/Reel, Pinterest Pin, TikTok, or YouTube) requires media.Import or upload media and attach its mediaId to the target.No
media_mime_typeFile MIME type is rejected by the provider (for example, unsupported codec or container).Convert to a supported MIME type (such as image/jpeg, image/png, video/mp4, or application/pdf).No

OpenCode setup problems

Calls start failing with 401.
Run opencode mcp auth pubnio again to renew the PubNio sign-in.
OpenCode does not list pubnio in /mcps.
Check that the entry is under mcp.servers with type remote in opencode.json.
Writes fail with 403 read_only_mode.
PubNio returns 403 read_only_mode when the server URL ends in ?readOnly=1. Point the entry at https://pubnio.com/mcp to allow writes.

OpenCode quirks

  • You can sign in from the CLI (opencode mcp auth pubnio) or from /mcps inside a session.
  • A remote server needs type remote under mcp.servers; a bare url entry is not enough.

What it won't do

  • Publish to a personal Facebook profile. PubNio connects Pages only.
  • Publish a Reel or Story without media.
  • Connect accounts, create API keys, or manage webhooks from an MCP session that uses an API key. Those operations need a person signed in, so connect the MCP server with browser OAuth or use the PubNio web app.
  • Stream binary uploads through execute. Import media from an HTTPS URL, or send a file of up to 8 MiB inline as base64.
  • Run one execute call past 30 seconds or past its request limit. The script returns the post ID so the next call can check it.

Frequently asked questions

Can OpenCode publish to my personal Facebook profile?

This guide publishes to a connected Facebook Page. Select the Page you have permission to manage.

Can I post an update without an image?

Yes. Use a text-only feed post on the selected Page.

How do I avoid posting to the wrong Page?

Ask OpenCode to list the ready Pages, then approve the Page name alongside the text.

Does accepted mean the Page post is public?

Accepted means PubNio queued the delivery. Check the same post for a confirmed Facebook permalink.

Where does OpenCode keep the PubNio server?

In opencode.json under mcp.servers.pubnio with type remote and url https://pubnio.com/mcp. opencode mcp add writes it for you.

Can I sign OpenCode in without leaving the session?

Yes. Run /mcps, select pubnio, and approve the workspace in your browser.

Also works with

Get started with PubNio

Connect unlimited accounts at $0 per account. Pay as you go includes 50 free confirmed publishes a month on your first workspace, then $20 per 1,000. X API fees are separate.

REST API reference

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post. A 202 response includes the post ID and initial delivery status. Use the settled status to confirm publishing.

POST /api/v1/posts?workspaceId=00000000-0000-4000-8000-000000000006
Authorization: Bearer pn_live_***
Idempotency-Key: opencode-facebook-release-2026-12-04
Content-Type: application/json

{
  "text": "Weekly queues are here. Pick a posting schedule once, then add releases to the next available slot.",
  "publishNow": true,
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "facebook",
      "placement": "feed"
    }
  ]
}
create-post.http