# Post automations

> The automation object for schedule_post, publish_now and queue edits: auto-repost, auto-plug, auto-DM, auto-delete, audience and reply settings.

Source: https://docs.xholic.ai/api/automations/

`schedule_post`, `publish_now`, `edit_queued_post` and the other posting actions take an optional `automation` object. Leave it out to use the account's default automations (read them with `scheduler.get_settings`). When you send it, send the whole object: every block below, with `enabled: false` for the ones you don't want.

```json
{
  "autoRepost": {
    "enabled": true,
    "repostDelaysMinutes": [
      240
    ],
    "removeAfterMinutes": null
  },
  "autoPlug": {
    "enabled": true,
    "likesThreshold": 100,
    "templateId": null,
    "templateName": "Newsletter plug",
    "templateText": "If this was useful, I write about this every week.",
    "monitoringWindowMinutes": 4320
  },
  "autoDm": {
    "enabled": false,
    "replyKeyword": "guide",
    "requireRepost": false,
    "maxRecipients": 50,
    "batchMode": false,
    "messageTemplate": ""
  },
  "autoDelete": {
    "enabled": false,
    "afterMinutes": 1440,
    "viewsThreshold": 1000
  },
  "audience": "EVERYONE",
  "replySettings": "EVERYONE",
  "madeWithAi": false
}
```

This example reposts the post after 4 hours and adds a plug reply once it passes 100 likes within 3 days.

## Fields

Times are in minutes. Reposts and the removal must finish within 14 days of posting.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `autoRepost` | object | Yes |  |
| `autoRepost.enabled` | boolean | Yes |  |
| `autoRepost.repostDelaysMinutes` | array of integer 15–10080 (max 3) | Yes | Wait before each repost, after posting for the first and after the previous repost for the rest. Reposts after the first are scheduled at least 60 minutes apart. |
| `autoRepost.removeAfterMinutes` | integer 15–10080 or null | Yes |  |
| `autoPlug` | object | Yes |  |
| `autoPlug.enabled` | boolean | Yes |  |
| `autoPlug.likesThreshold` | integer 1–10000000 | Yes |  |
| `autoPlug.templateId` | string ≤ 80 chars or null | Yes |  |
| `autoPlug.templateName` | string ≤ 60 chars | Yes |  |
| `autoPlug.templateText` | string ≤ 4000 chars | Yes |  |
| `autoPlug.monitoringWindowMinutes` | integer 60–10080 | Yes |  |
| `autoDm` | object | Yes |  |
| `autoDm.enabled` | boolean | Yes |  |
| `autoDm.replyKeyword` | string ≤ 40 chars | Yes |  |
| `autoDm.requireRepost` | boolean | Yes |  |
| `autoDm.maxRecipients` | integer 1–100 | Yes |  |
| `autoDm.batchMode` | boolean | Yes |  |
| `autoDm.messageTemplate` | string ≤ 5000 chars | Yes |  |
| `autoDelete` | object | Yes |  |
| `autoDelete.enabled` | boolean | Yes |  |
| `autoDelete.afterMinutes` | integer 15–10080 | Yes |  |
| `autoDelete.viewsThreshold` | integer 1–1000000000 | Yes |  |
| `audience` | "EVERYONE" \\| "SUBSCRIBERS" | Yes |  |
| `replySettings` | "EVERYONE" \\| "FOLLOWING" \\| "MENTIONED_USERS" \\| "VERIFIED" \\| "SUBSCRIBERS" | Yes |  |
| `madeWithAi` | boolean | No | Default: `false`. |

To change automations on a post that is already live, use `queue.add_automation_step`, `queue.update_automation_step` and `queue.remove_automation_step`.
