# Facebook on boxd

> Facebook is a social media and advertising platform used by individuals and businesses to connect, share content, and promote products or services. Only supports Facebook Pages, not Facebook Personal accounts.

- Page: https://boxd.sh/integrations/facebook/
- CLI: `run facebook` (43 commands, 18 marked common)
- SDK: `import { facebook } from "@boxd/run"`; every parameter and response type is at `@boxd/run/facebook`
- Triggers: none
- Connect: `run auth facebook` (Sign in with Facebook), or https://app.boxd.sh/integrations/detail/facebook
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth facebook      # once: prints a link to connect your account
run facebook           # list its commands
run facebook get-comments --help
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, facebook } from "@boxd/run";

every("1 hour", async () => {
  const result = await facebook.getComments({ object_id: "…" });
  console.log(result);
});
```

Run it with `run facebook.run.ts`. Facebook has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run facebook <command> --help` lists the optional ones. "common" marks what `run facebook` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `assign-page-task` | `facebook.assignPageTask()` | `--page-id` `--tasks` `--user` | 0 | Assigns tasks/roles to a business-scoped user or system user for a specific Facebook Page |
| `create-comment` ·common | `facebook.createComment()` | `--message` `--object-id` | 3 | Creates a comment on a Facebook post or replies to an existing comment |
| `create-photo-album` ·common | `facebook.createPhotoAlbum()` | `--name` `--page-id` | 3 | Creates a new photo album on a Facebook Page |
| `create-photo-post` ·common | `facebook.createPhotoPost()` | `--page-id` | 8 | Creates a photo post on a Facebook Page |
| `create-post` ·common | `facebook.createPost()` | `--message` `--page-id` | 4 | Creates a new text or link post on a Facebook Page |
| `create-video-post` ·common | `facebook.createVideoPost()` | `--page-id` | 7 | Creates a video post on a Facebook Page |
| `delete-comment` | `facebook.deleteComment()` | `--comment-id` | 1 | Deletes a Facebook comment |
| `delete-post` | `facebook.deletePost()` | `--post-id` | 0 | Permanently deletes a Facebook Page post |
| `get-comment` | `facebook.getComment()` | `--comment-id` | 1 | Retrieves details of a specific Facebook comment |
| `get-comments` ·common | `facebook.getComments()` | `--object-id` | 4 | Retrieves comments from a Facebook post or comment (for replies) |
| `get-conversation-messages` ·common | `facebook.getConversationMessages()` | `--conversation-id` `--page-id` | 2 | Retrieves messages from a specific conversation |
| `get-current-user` | `facebook.getCurrentUser()` | — | 1 | Validates the access token and retrieves the authenticated user's own profile via /me |
| `get-message-details` | `facebook.getMessageDetails()` | `--message-id` | 1 | Retrieves details of a specific message sent or received by the Page |
| `get-page-conversations` ·common | `facebook.getPageConversations()` | `--page-id` | 2 | Retrieves a list of conversations between users and the Page |
| `get-page-details` | `facebook.getPageDetails()` | `--page-id` | 1 | Fetches details about a specific Facebook Page |
| `get-page-insights` | `facebook.getPageInsights()` | `--page-id` | 4 | Retrieves analytics and insights for a Facebook Page |
| `get-page-photos` | `facebook.getPagePhotos()` | `--page-id` | 3 | Retrieves photos from a Facebook Page |
| `get-page-posts` ·common | `facebook.getPagePosts()` | `--page-id` | 5 | Retrieves posts from a Facebook Page |
| `get-page-roles` | `facebook.getPageRoles()` | `--page-id` | 3 | Retrieves a list of people and their tasks/roles on a Facebook Page |
| `get-page-tagged-posts` ·common | `facebook.getPageTaggedPosts()` | `--page-id` | 4 | Retrieves posts where a Facebook Page is tagged or mentioned |
| `get-page-videos` | `facebook.getPageVideos()` | `--page-id` | 3 | Retrieves videos from a Facebook Page |
| `get-post` ·common | `facebook.getPost()` | `--post-id` | 1 | Retrieves details of a specific Facebook post |
| `get-post-insights` | `facebook.getPostInsights()` | `--post-id` | 2 | Retrieves analytics and insights for a specific Facebook post |
| `get-post-reactions` | `facebook.getPostReactions()` | `--post-id` | 3 | Retrieves reactions (like, love, wow, etc.) for a Facebook post |
| `get-scheduled-posts` | `facebook.getScheduledPosts()` | `--page-id` | 2 | Retrieves scheduled and unpublished posts for a Facebook Page |
| `get-user-pages` ·deprecated | `facebook.getUserPages()` | — | 5 | Use list-managed-pages instead |
| `like-post-or-comment` | `facebook.likePostOrComment()` | `--object-id` | 1 | Adds a LIKE reaction to a Facebook post or comment |
| `list-managed-pages` | `facebook.listManagedPages()` | — | 5 | Retrieves a list of Facebook Pages that the user manages (not personal profiles), including page details, access tokens, and tasks |
| `mark-message-seen` | `facebook.markMessageSeen()` | `--page-id` `--recipient-id` | 0 | Marks a user's message as seen by the Page, visibly updating the read status in the user's conversation |
| `publish-scheduled-post` | `facebook.publishScheduledPost()` | `--post-id` | 1 | Publishes a previously scheduled or unpublished Facebook post immediately |
| `remove-page-task` | `facebook.removePageTask()` | `--page-id` `--user` | 0 | Removes a user's tasks/access from a specific Facebook Page |
| `reschedule-post` | `facebook.reschedulePost()` | `--post-id` `--scheduled-publish-time` | 0 | Changes the scheduled publish time of an unpublished Facebook post |
| `search-pages` ·common | `facebook.searchPages()` | `--query` | 2 | Searches for Facebook Pages based on a query string |
| `send-media-message` ·common | `facebook.sendMediaMessage()` | `--media-type` `--media-url` `--page-id` `--recipient-id` | 3 | Sends a media message (image, video, audio, or file) from the Page to a user |
| `send-message` ·common | `facebook.sendMessage()` | `--message-text` `--page-id` `--recipient-id` | 2 | Sends a text message from a Facebook Page (not personal profiles) to a user via Messenger |
| `toggle-typing-indicator` | `facebook.toggleTypingIndicator()` | `--page-id` `--recipient-id` `--typing-on` | 0 | Shows or hides the typing indicator for a user in Messenger |
| `unlike-post-or-comment` ·common | `facebook.unlikePostOrComment()` | `--object-id` | 0 | Removes a like from a Facebook post or comment |
| `update-comment` | `facebook.updateComment()` | `--comment-id` `--message` | 2 | Updates an existing Facebook comment |
| `update-page-settings` | `facebook.updatePageSettings()` | `--page-id` | 6 | Updates settings for a specific Facebook Page |
| `update-post` | `facebook.updatePost()` | `--post-id` | 6 | Updates an existing Facebook Page post |
| `upload-photo` ·common ·deprecated | `facebook.uploadPhoto()` | `--page-id` | 7 | Use create-photo-post instead |
| `upload-photos-batch` ·common | `facebook.uploadPhotosBatch()` | `--page-id` | 4 | Uploads multiple photo files in batch to a Facebook Page or Album |
| `upload-video` ·common ·deprecated | `facebook.uploadVideo()` | `--page-id` | 9 | Use CreateVideoPost instead |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
