---
title: "Update a DM automation"
method: PATCH
path: "/v1/dm-automations/{id}"
---

# Update a DM automation

`PATCH /v1/dm-automations/{id}`

## Request

- Base URL: `https://api.breakreach.com`
- URL: `https://api.breakreach.com/v1/dm-automations/{id}`
- Auth: HTTP bearer

Only the fields given change; steps replaces the whole flow (keep the ids of unchanged steps so people in the flow carry on). active false pauses it and stops the people in it.

## Path parameters

- `id` string, required

## Request body

- DmAutomationInput
  - `accountId` string: Instagram account or Facebook Page id from /v1/accounts (create only)
  - `name` string
  - `trigger` DmTrigger
    - `type` 'keyword' | 'any_message' | 'story_mention' | 'story_reply' | 'ref', required: keyword = a DM containing a keyword; any_message = any DM (welcome or away reply); story_mention = someone mentions the account in their story (Instagram); story_reply = a reply to one of its stories, optionally with keywords (Instagram); ref = someone opens ig.me/m/<username>?ref=<ref> or m.me/<page id>?ref=<ref> and writes
    - `keywords` string[]: keyword (required) and story_reply (optional); case and accents ignored
    - `match` 'contains' | 'exact'
    - `ref` string, nullable
  - `steps` DmStep[]: Required on create. On update, the whole list
    - `id` string: Kept across edits so people in the flow carry on; generated when omitted
    - `type` 'message' | 'wait' | 'condition' | 'handoff', required
    - `text` string: message: up to 1000 bytes (640 characters with a button). {username} = their @handle on Instagram, first name on Messenger; {first_name}
    - `button` object, nullable: message: a link button; clicks are counted (the link goes through api.breakreach.com/l/...)
      - `title` string
      - `url` string, uri
    - `choices` object[]: message: quick-reply choices, each with its own steps. Not with a button
      - `id` string
      - `label` string
      - `steps` DmStep[]
    - `otherwise` object, nullable: message with choices: a typed answer that isn't a choice, or no answer within afterMinutes
      - `afterMinutes` integer
      - `steps` DmStep[]
    - `minutes` integer: wait
    - `check` 'replied' | 'keyword' | 'clicked' | 'follows': condition: a reply, a reply containing keywords, a click on an earlier link button (each waited for up to withinMinutes), or whether they follow the account (Instagram, checked at once)
    - `keywords` string[]
    - `match` 'contains' | 'exact'
    - `withinMinutes` integer
    - `yes` DmStep[]
    - `no` DmStep[]
    - `note` string: handoff: shown in the Inbox
  - `reentry` 'once' | 'always': once = a person goes through it once; always = each time they trigger it, at most once per cooldownHours
  - `cooldownHours` integer
  - `active` boolean
  - `workspace` string

## Response `200`

Updated

- object
  - `automation` DmAutomation
    - `id` string
    - `accountId` string
    - `platform` 'instagram' | 'facebook'
    - `account` object
      - `displayName` string
      - `avatarUrl` string, nullable
    - `name` string
    - `trigger` DmTrigger
      - `type` 'keyword' | 'any_message' | 'story_mention' | 'story_reply' | 'ref', required: keyword = a DM containing a keyword; any_message = any DM (welcome or away reply); story_mention = someone mentions the account in their story (Instagram); story_reply = a reply to one of its stories, optionally with keywords (Instagram); ref = someone opens ig.me/m/<username>?ref=<ref> or m.me/<page id>?ref=<ref> and writes
      - `keywords` string[]: keyword (required) and story_reply (optional); case and accents ignored
      - `match` 'contains' | 'exact'
      - `ref` string, nullable
    - `refLink` string, nullable: For a ref trigger: the link to share (link in bio, QR code, ad)
    - `steps` DmStep[]
      - `id` string: Kept across edits so people in the flow carry on; generated when omitted
      - `type` 'message' | 'wait' | 'condition' | 'handoff', required
      - `text` string: message: up to 1000 bytes (640 characters with a button). {username} = their @handle on Instagram, first name on Messenger; {first_name}
      - `button` object, nullable: message: a link button; clicks are counted (the link goes through api.breakreach.com/l/...)
        - `title` string
        - `url` string, uri
      - `choices` object[]: message: quick-reply choices, each with its own steps. Not with a button
        - `id` string
        - `label` string
        - `steps` DmStep[]
      - `otherwise` object, nullable: message with choices: a typed answer that isn't a choice, or no answer within afterMinutes
        - `afterMinutes` integer
        - `steps` DmStep[]
      - `minutes` integer: wait
      - `check` 'replied' | 'keyword' | 'clicked' | 'follows': condition: a reply, a reply containing keywords, a click on an earlier link button (each waited for up to withinMinutes), or whether they follow the account (Instagram, checked at once)
      - `keywords` string[]
      - `match` 'contains' | 'exact'
      - `withinMinutes` integer
      - `yes` DmStep[]
      - `no` DmStep[]
      - `note` string: handoff: shown in the Inbox
    - `reentry` 'once' | 'always'
    - `cooldownHours` integer
    - `active` boolean
    - `stats` object
      - `started` integer
      - `completed` integer
      - `handedOff` integer
      - `clicks` integer
      - `failed` integer
    - `lastTriggeredAt` string, date-time, nullable
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `400`: Invalid field
- `401`: Missing, invalid or expired API key
- `402`: No active Breakreach subscription or trial
- `403`: Not a member of the requested workspace
- `404`: Automation or workspace not found

---

[API](https://skmtc.dev/breakreach/apis/breakreach-api.md) · [All operations](https://skmtc.dev/breakreach/apis/breakreach-api/llms.txt) · [OpenAPI document](https://skmtc.dev/breakreach/apis/breakreach-api/revisions/290d285f8d73?raw)
