> ## 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 message deleted

> Starts when someone removes a direct message they sent to an Instagram professional account.

`metaAds.onInstagramMessageDeleted` starts when someone removes a direct message they sent to a selected Instagram professional account.

```ts automations/meta-ads-on-instagram-message-deleted.automation.ts theme={null}
import { automation, sendEmail } from "automate.ax"
import { metaAds } from "automate.ax/meta-ads"

export default automation("Forward removed Instagram messages", () => {
  const deleted = metaAds.onInstagramMessageDeleted({
    instagramAccountId: "instagram-account-id",
  })
  sendEmail({
    subject: "Delete this Instagram message",
    text: deleted.messageId,
  })
})
```

Find `instagramAccountId` with [List Instagram accounts](https://docs.automate.ax/reference/integrations/meta-ads/actions/list-instagram-accounts.md). Meta requires apps to delete stored copies of a message when the person removes it. Use `messageId` to remove the message wherever your automation saved it from [On Instagram message received](https://docs.automate.ax/reference/integrations/meta-ads/triggers/on-instagram-message-received.md). Optional `account` selects a static project account binding.

The event includes `instagramAccountId`, `messageId`, `senderId`, the person's Instagram-scoped ID, and `timestamp` in Unix milliseconds. Each `messageId` starts at most one run. The trigger needs the same permissions and account setup as [On Instagram message received](https://docs.automate.ax/reference/integrations/meta-ads/triggers/on-instagram-message-received.md).


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