---
title: "Create a DM automation"
method: POST
path: "/v2/dm-automations"
tags: ["automations"]
---

# Create a DM automation

`POST /v2/dm-automations`

Creates a DM automation: when its trigger fires it sends one direct message (text plus up to 3 link buttons). Set `followGate` (Instagram only) to gate that message behind a follow check, and `emailGate` to gate it behind the contact replying with an email address. Set `webhook` to call an external endpoint once the message is sent; its payload carries the run's contact and identifiers.

## Request body

- object
  - `accountId` string, required
  - `buttons` object[], required
    - `title` string, required
    - `type` 'url', required
    - `url` string
  - `dmMessage` string, required
  - `emailGate` object, nullable
    - `message` string, required
  - `followGate` object, nullable
    - `buttonTitle` string
    - `message` string, required
  - `isActive` boolean
  - `name` string, required
  - `platform` 'facebook' | 'instagram', required
  - `target` union, required
    - object
      - `pageId` string, required
      - `targetType` 'facebook', required
    - object
      - `targetType` 'instagram', required
  - `trigger` union
    - object
      - `isActive` boolean
      - `keywords` string[], required
      - `postId` string, nullable
      - `type` 'comment-received', required
    - object
      - `isActive` boolean
      - `keywords` string[], required
      - `type` 'message-received', required
  - `webhook` object, nullable
    - `headers` object
    - `method` 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT', required
    - `url` string, required

## Response `201`

Default Response

- object
  - `flow` object, required
    - `accountId` string, required
    - `buttons` object[], required
      - `title` string, required
      - `type` 'url', required
      - `url` string
    - `createdAt` string, required
    - `dmMessage` string, required
    - `emailGate` object
      - `message` string, required
    - `followGate` object
      - `buttonTitle` string
      - `message` string, required
    - `id` string, required
    - `isActive` boolean, required
    - `name` string, required
    - `platform` 'facebook' | 'instagram', required
    - `publishedVersionId` string, nullable, required
    - `target` union, required
      - object
        - `pageId` string, required
        - `targetType` 'facebook', required
      - object
        - `targetType` 'instagram', required
    - `trigger` union
      - object
        - `isActive` boolean
        - `keywords` string[], required
        - `postId` string, nullable
        - `type` 'comment-received', required
      - object
        - `isActive` boolean
        - `keywords` string[], required
        - `type` 'message-received', required
    - `updatedAt` string, required
    - `webhook` object
      - `headers` object
      - `method` 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT', required
      - `url` string, required

## Other responses

- `404` — Not found
- `422` — Validation error
- `500` — Default Response

---

[API](https://skmtc.net/blotato/apis/blotato-api.md) · [All operations](https://skmtc.net/blotato/apis/blotato-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/blotato/blotato-api/revisions/c93447ba6b9d/schema)
