> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hookmyapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Personal AI agent

> Connect your Facebook Page to your own AI agent.

## What you need

* A HookMyApp account
* A connected Facebook Page, or a Facebook sandbox for testing
* A channel token and Page id for that channel
* An agent runtime that can read incoming Messenger messages and send outgoing replies

If your Page is already connected, skip to [Configure your agent](#configure-agent).

## Connect Facebook Page

For testing, start a Facebook sandbox session:

```bash theme={null}
hookmyapp sandbox start facebook
```

The CLI opens a Messenger thread with the HookMyApp test Page.
Send the prefilled message from your Facebook account.
See [Sandbox](/facebook/sandbox) for the full flow.

To use your own Page, connect it through Meta:

```bash theme={null}
hookmyapp channels connect facebook
```

The Instagram account linked to the Page connects in the same step.
See [Connect a Page](/facebook/connect) for the full connect flow.

## Configure agent

Pull credentials into a `.env` file your agent runtime can load.

For a sandbox session:

```bash theme={null}
hookmyapp sandbox env --write .env
```

For a connected channel:

```bash theme={null}
hookmyapp channels env <channel> --write .env
```

Your agent reads these values:

* `FACEBOOK_GRAPH_API_URL`: full send URL for this channel
* `FACEBOOK_ACCESS_TOKEN`: channel token for sending messages
* `FACEBOOK_PAGE_ID`: connected Page ID used in the send URL
* `WEBHOOK_HMAC_SECRET`: webhook signing secret for your receiver

The receiver shape is identical between the sandbox and your own Page.

## Agent capabilities

Your agent can receive Messenger messages, send replies, answer Page comments, and use the CLI to inspect the connected Page.

### Send messages

Use the send URL and token from the env values.
See [Send messages](/facebook/send-messages) for the message shape.

### Listen to conversations

For local development, listen for messages on your laptop:

```bash theme={null}
hookmyapp sandbox listen --path /webhook/facebook
```

For your own Page, set the public URL where HookMyApp sends messages and comment events:

```bash theme={null}
hookmyapp channels webhook set <channel> \
  --url https://your-agent.example.com/webhook/facebook \
  --verify-token $(openssl rand -hex 32)
```

## Use with agent framework

If your personal agent runs on a framework like [OpenClaw](https://openclaw.ai) or [Hermes](https://hermes-agent.org), you do not have to write any transport code.<br />
These runtimes can run shell commands, so give them the HookMyApp CLI and your agent can send and receive messages from your connected Page.

Give your agent a prompt like this to wire it up:

```text Agent prompt theme={null}
You can send and receive Facebook Messenger messages and answer Page comments on
my behalf through the HookMyApp CLI (npm package @gethookmyapp/cli).

Setup:
1. Install the HookMyApp skills globally:  npx skills add hookmyapp/agent-skills --all --global
2. Install the CLI:  npm install -g @gethookmyapp/cli
3. Authenticate: run `hookmyapp login --email <my-email>` (a 6-digit code arrives in my inbox, and I will read it back to you), or I will run `hookmyapp login` myself in a browser
4. List my connected channels:  hookmyapp channels list --json
5. Set my alert phone so HookMyApp can text me if this ever breaks: run `hookmyapp alerts phone status` first, and if no verified number is shown, ask me for my number, run `hookmyapp alerts phone set <number>`, then `hookmyapp alerts phone verify <code>` with the code I read back. Never invent the number or the code. If I decline, skip it.

To send a message:
1. Pull the channel credentials:  hookmyapp channels env <channel> --json
2. Send through the HookMyApp API URL from those values, using the Messenger message body shape.

Always run `hookmyapp <command> --help` before using a command.
Only message the people I explicitly ask you to, and never contact anyone without my confirmation.
```

For deeper, framework-specific wiring, point your agent at the [agent skills](/facebook/agent-skills) and the [CLI reference](/facebook/cli).<br />
For other runtimes (Python, Go, Rust), use the same env values and adapt the transport on your side.

## Next steps

* [Build with AI](/facebook/build-with-ai): Use Cursor, Codex, or Claude Code to wire all this for you.
* [CLI](/facebook/cli): Command reference for everything above.
* [Send messages](/facebook/send-messages): Send a Messenger message.
* [Receive webhooks](/facebook/receive-webhooks): Inbound webhook handling and signature verification.
