Skip to content

Add an automation to a live post

POST
/queue/add-automation-step
curl -X POST https://api.xholic.ai/v1/queue/add-automation-step \
-H "Authorization: Bearer $XHOLIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"postId":"<postId>","type":"AUTO_REPOST","dryRun":true,"idempotencyKey":"my-unique-key-1"}'

Add one automation step to a post that is already live: repost, unrepost, delete, a plug reply after enough likes, or DMs to people who reply with a keyword. Call it only when the user asked for this in the conversation; never on your own initiative.

Media typeapplication/json
object
postId
required

Xholic scheduled post id, from get_queue.

string
>= 1 characters <= 120 characters
type
required

The step. Each type takes only its own fields.

string
Allowed values: AUTO_REPOST AUTO_UNREPOST AUTO_DELETE AUTO_PLUG AUTO_DM_DISCOVERY
delayMinutes

AUTO_REPOST, AUTO_UNREPOST, AUTO_DELETE: minutes after the post went live.

integer
<= 9007199254740991
viewsThreshold

AUTO_DELETE: delete only if the post has fewer views than this.

integer
>= 1 <= 9007199254740991
likesThreshold

AUTO_PLUG: likes that trigger the plug reply.

integer
>= 1 <= 9007199254740991
templateName

AUTO_PLUG: a short name for the plug.

string
>= 1 characters <= 60 characters
templateText

AUTO_PLUG: the plug reply text.

string
>= 1 characters <= 4000 characters
monitoringWindowMinutes

AUTO_PLUG: minutes after posting when watching for likes stops.

integer
>= 60 <= 10080
replyKeyword

AUTO_DM_DISCOVERY: one word repliers type.

string
>= 1 characters <= 40 characters
requireRepost

AUTO_DM_DISCOVERY: DM only people who also reposted.

boolean
maxRecipients

AUTO_DM_DISCOVERY: most DMs to send.

integer
>= 1 <= 100
messageTemplate

AUTO_DM_DISCOVERY: the DM to send.

string
>= 1 characters
account

X account to act on, as @handle. Leave it out to use the connection’s default account.

string
>= 1 characters <= 64 characters
dryRun

Return exactly what would happen without doing it.

boolean
idempotencyKey

A unique key for this write. Repeating a call with the same key returns the first result instead of acting twice.

string
>= 8 characters <= 200 characters

Example

{
"postId": "<postId>",
"type": "AUTO_REPOST",
"dryRun": true,
"idempotencyKey": "my-unique-key-1"
}

Success

Media typeapplication/json
object
ok
required
boolean
summary
required

One or two readable sentences about the result.

string
data
required

The result. Its shape depends on the action.

ids
object
key
additional properties
any
next
Array<string>
creditsCharged
number
dryRun
boolean

Example

{
"ok": true
}

Error

Media typeapplication/json
object
ok
required
boolean
error
required
object
code
required
string
Allowed values: UNAUTHENTICATED INVALID_CREDENTIAL SCOPE_MISSING ROLE_NOT_PERMITTED ACCOUNT_NOT_FOUND SUBSCRIPTION_REQUIRED FEATURE_NOT_INCLUDED APP_ONLY INVALID_INPUT NOT_FOUND CONFLICT CREDITS_CONFIRMATION_REQUIRED INSUFFICIENT_CREDITS RATE_LIMITED IDEMPOTENCY_KEY_REUSED IDEMPOTENCY_IN_PROGRESS X_DATA_LIMIT_REACHED UPSTREAM_UNAVAILABLE INTERNAL_ERROR
message
required
string
scope
required
string
Allowed values: account platform
retryAfterSeconds
integer
details

Example

{
"ok": false,
"error": {
"code": "UNAUTHENTICATED",
"scope": "account"
}
}