First-party app
Messenger Messenger

Facebook Messenger

Send Messenger messages, read conversations, manage the Messenger profile and route threads for a Facebook Page through the Messenger Platform.

stable Communication

About

Facebook Messenger ships in the w6w first-party pack. It declares 19 actions, 3 health checks, and the host runs its code in a sandbox that never sees the credential.

App id
io.w6w.facebook-messenger
Version
0.1.1
Author
w6w
Licence
MIT
Categories
Communication

Overview

This app talks to people who message a Facebook Page, through the Messenger Platform’s Send API. It sends text, images, audio, video and files, button and generic (carousel) templates, and quick replies, and it shows typing, read and emoji-reaction indicators — everything a Page needs to hold a conversation from a workflow.

It also reads what has already been said: it lists a Page’s conversations, lists the messages inside one, and fetches a single message with its sender, recipient and reply context. The Messenger profile — greeting text, Get Started button, ice breakers and the persistent menu — can be read, set and cleared, and media can be uploaded once and reused by attachment id. When more than one app is connected to a Page, thread control can be passed to or taken back from another app.

Messenger enforces a messaging window: a Page may only message a person who has contacted it first, and outside the standard window a message needs an approved message tag. This app does not work around that — Meta’s errors are returned verbatim so a workflow can see exactly why a send was refused. It authenticates with a Page access token, because every Messenger endpoint is Page-scoped.

Build with Facebook Messenger

Three routes to the same 19 actions. The Workflow tab is generated from Facebook Messenger's own manifest and carries its real ids, so it is copy-pasteable; the Code and CLI examples are the same call for any action on any app, so every app-specific value in them is a blank you fill in.

Delete Messenger Profile Properties

delete-messenger-profile-fields

Remove properties such as the greeting, ice breakers or persistent menu.

Get Message

get-message

Get a message's sender, recipient, text and reply context.

Get Messenger Profile

get-messenger-profile

Read the Page's greeting, Get Started button, ice breakers, persistent menu and other profile properties.

Get Page Status

get-page-status

Read the Page's integrity status, violations and messaging restrictions.

List Conversation Messages

list-conversation-messages

List the message IDs (and times) in a conversation.

List Conversations

list-conversations

List the Page's Messenger conversations, or find the one with a specific person.

Pass Thread Control

pass-thread-control

Pass a conversation to another app (Conversation Routing).

Send Attachment

send-attachment

Send an image, audio, video or file, from a URL or a previously saved attachment.

Send Button Template

send-button-template

Send a text message with up to three buttons.

Send Generic Template (Carousel)

send-generic-template

Send a card, or a carousel of up to ten cards, with an image and buttons.

Send Quick Replies

send-quick-replies

Send a text message with quick-reply buttons.

Send Sender Action

send-sender-action

Show typing, mark messages as seen, or react to a message.

Send Text Message

send-text-message

Send a text message to a person who has messaged the Page.

Set Greeting

set-greeting

Set the greeting text on the Page's Messenger welcome screen.

Set Ice Breakers

set-ice-breakers

Set the FAQ questions shown to people who open a new conversation.

Set Messenger Profile

set-messenger-profile

Set one or more Messenger Profile properties (Get Started, allowlisted domains …).

Set Persistent Menu

set-persistent-menu

Set the menu that is always visible in a Messenger conversation with the Page.

Take Thread Control

take-thread-control

Take control of a conversation that is idle or owned by another app.

Upload Attachment

upload-attachment

Save an image, audio, video or file from a URL and get a reusable attachment ID.

A workflow step names the app and the action, and the editor fills in the connection when you pick one. This is the Step shape from the workflow spec, carrying Facebook Messenger's real ids.

{
  "manifestVersion": "2",
  "name": "facebook-messenger-example",
  "steps": [
    {
      "id": "get-message",
      "uses": {
        "app": "io.w6w.facebook-messenger",
        "action": "get-message",
        "connection": "conn_YOUR_CONNECTION_ID"
      },
      "with": {
        "messageId": "<messageId>"
      }
    }
  ]
}

Here are some of the things you can do

  • Get Message

    read
    get-message
  • Get Messenger Profile

    read
    get-messenger-profile
  • Get Page Status

    read
    get-page-status
  • List Conversation Messages

    read
    list-conversation-messages
  • List Conversations

    read
    list-conversations

+14 more actions available

Every app-specific value here is a blank you have to fill in. An app action is reached through the connection that authenticates it, so the address is a connection id, not the app id — and connections belong to your account, so a public page cannot know yours. Create one for Facebook Messenger, then fill in the three blanks: conn_YOUR_CONNECTION_ID, the action key, and the parameters that action declares. The call itself is real — the shape is transcribed from the studio's own snippet builder, which prints the same kind of blanks — but nothing in it is specific to Facebook Messenger. The Workflow tab is where this app's real ids are.

Install
npm install @w6w/sdk
yarn add @w6w/sdk
pnpm add @w6w/sdk
deno add npm:@w6w/sdk
Code
import { W6wClient, isActionRun } from "@w6w/sdk";

// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
const client = new W6wClient();

const envelope = await client.run({
  urn: "conn_YOUR_CONNECTION_ID",
  action: "get-message",
  payload: {
    messageId: "<value>",
    // fields: "<value>",
  },
});

if (isActionRun(envelope)) console.log(envelope.value);
Install the CLI
npm install -g @w6w/cli
CLI
w6w run conn_YOUR_CONNECTION_ID --action get-message --payload '{"messageId":"<value>"}'

Give an AI agent Facebook Messenger — without giving it Facebook Messenger's credentials. One MCP endpoint exposes every app, function and workflow the caller is entitled to, as tools it can discover and run. Access is granted per team while we onboard.

One tool call
{
  "name": "w6w_invoke",
  "arguments": {
    "ref": "app:io.w6w.facebook-messenger#get-message",
    "input": {
      "messageId": "<messageId>"
    }
  }
}

Every tool names its target with a single ref. The app: form above doesn't name a connection at all — the host resolves which of the caller's Facebook Messenger connections to sign with, and refuses rather than guesses when the answer is ambiguous.

What the agent gets

Credentials it can't read

The token is attached host-side, at the moment of the call. It is never a tool argument, never in the model's context, and never in a transcript — so a prompt injection has nothing to exfiltrate.

A tool surface scoped to the caller

Tools are derived per end user from what that person has actually connected and is entitled to — not one shared bot identity carrying the union of everyone's access.

A durable workflow in one call

Multi-step work runs on the workflow engine and returns a run handle the agent can poll — retries, branching and state survive the conversation that started them.

Health-aware discovery

Facebook Messenger's declared health checks are on the surface too, so an agent can tell "the vendor is down" from "your credential expired" before it burns a retry on either.

The MCP surface is part of the hosted platform. Facebook Messenger itself is MIT, and the runtime that executes it is source-available (FSL).

Request MCP access

Health checks

Facebook Messenger declares its own checks, so its health is a property of the app rather than something the host guesses at.

dependency

Graph API reachable

Unauthenticated GET /me?fields=id on graph.facebook.com. Graph's own OAuth error envelope passes — it proves the API is answering. Token validity is the derived `auth:*` check's job.

service

Meta platform status

quota

App usage headroom

Percentage of the app's call-count, CPU-time and total-time allowances consumed, read off `X-App-Usage`. Meta throttles when any meter reaches 100.