> ## 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 Instagram comment created

> Starts when someone comments on Instagram media or an Instagram ad.

`metaAds.onInstagramCommentCreated` starts when someone comments on a selected Instagram professional account's media, including ads.

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

export default automation("Answer Instagram comments privately", () => {
  const comment = metaAds.onInstagramCommentCreated({
    instagramAccountId: "instagram-account-id",
  })
  metaAds.privateReplyToInstagramComment({
    commentId: comment.commentId,
    instagramAccountId: comment.instagramAccountId,
    text: "Thanks for asking! Here are the details.",
  })
})
```

Find `instagramAccountId` with [List Instagram accounts](https://docs.automate.ax/reference/integrations/meta-ads/actions/list-instagram-accounts.md). The account must be public and linked to a Facebook Page the connection manages; Automate.ax installs delivery on that Page. Comments the account itself posts don't start the trigger. Optional `account` selects a static project account binding.

The event includes:

* `commentId`, `instagramAccountId`, `text`, and `occurredAt` in Unix seconds
* `parentId`, present when the comment replies to another comment
* `from`, with the comment author's Instagram-scoped `id` and `username`
* `media`, with `id` and `mediaProductType`, plus `adId` and `adTitle` for ad comments

Meta can send duplicate notifications for comments on boosted posts and ads; each `commentId` starts at most one run. Meta doesn't include ad IDs for dynamic ads. The trigger needs `instagram_basic`, `instagram_manage_comments`, `pages_manage_metadata`, `pages_read_engagement`, and `pages_show_list`, and the Meta app needs Advanced Access for comment notifications.


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