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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# On Page comment created

> Starts when someone comments on a Facebook Page post or ad post.

`metaAds.onPageCommentCreated` starts when someone comments on, or replies to a comment on, a selected Facebook Page's organic posts and ad posts.

```ts automations/meta-ads-on-page-comment-created.automation.ts theme={null}
import { automation } from "automate.ax"
import { metaAds } from "automate.ax/meta-ads"

export default automation("Answer ad comments privately", () => {
  const comment = metaAds.onPageCommentCreated({ pageId: "page-id" })
  metaAds.privateReplyToPageComment({
    commentId: comment.commentId,
    pageId: comment.pageId,
    text: "Thanks for asking! Here are the details.",
  })
})
```

Pass the Page ID from [List Pages](https://docs.automate.ax/reference/integrations/meta-ads/actions/list-pages.md). Meta sends comments on ad posts through the Page that runs the ad. The Page's own comments, comment edits, deletions, and reactions don't start the trigger. Optional `account` selects a static project account binding.

The event includes:

* `commentId`, `postId`, and `pageId`
* `parentId`, present only when the comment replies to another comment
* `from`, with the comment author's `id` and `name` when Meta includes them
* `message`, plus `photo` or `video` when the comment has media
* `createdTime` in Unix seconds
* `post`, with post context such as `statusType`, `permalinkUrl`, and `promotionStatus` when Meta includes it

Meta retries deliveries; each `commentId` starts at most one run. The trigger needs `pages_manage_metadata`, `pages_read_user_content`, and `pages_show_list`. Until the app has Advanced Access, Meta only delivers activity from people with a role on the Meta app.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.