Docs
APIAPI referenceEngagement

PATCH /v1/projects/:projectId/engagement

Change one social account's reply policy - switch replies off, to review, or to automatic, and set the delay before a reply posts.

View as Markdown
PATCH/v1/projects/:projectId/engagement
Phase 1stable
Auth
Bearer
Scope
engagement:write

Changes the reply policy of one account. Name the account and send only what changes; anything you omit stays as it is.

Path
  • projectId
    stringrequired
    Project the account belongs to.
Body
  • socialAccountId
    stringrequired
    The account whose policy changes. From GET, or from the social accounts list.
  • replyMode
    "off" | "draft" | "automatic"optional
    off: nothing is generated. draft: each reply waits for a human in the Comments tab. automatic: replies post on their own.
  • replyDelay
    integer (30 to 600)optional
    Seconds a connected account waits before posting a generated reply.

Send at least one of replyMode and replyDelay.

Example request

curl -X PATCH https://api.layers.com/v1/projects/prj_254a4ce1-f4ca-42b1-9e36-17ca45ef3d39/engagement \
  -H "Authorization: Bearer lp_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7a1b1c3e-0a54-4d1a-9e2b-3d8b7f2a1c90" \
  -d '{
    "socialAccountId": "sa_e4fc4f78-0d04-4896-b391-272757b077fe",
    "replyMode": "automatic"
  }'
const policy = await layers.engagement.patch({
  projectId: "prj_254a4ce1-f4ca-42b1-9e36-17ca45ef3d39",
  socialAccountId: "sa_e4fc4f78-0d04-4896-b391-272757b077fe",
  replyMode: "automatic",
});
policy = layers.engagement.patch(
    project_id="prj_254a4ce1-f4ca-42b1-9e36-17ca45ef3d39",
    social_account_id="sa_e4fc4f78-0d04-4896-b391-272757b077fe",
    reply_mode="automatic",
)

Response

200The account's policy after the change
{
  "socialAccountId": "sa_e4fc4f78-0d04-4896-b391-272757b077fe",
  "platform": "tiktok",
  "handle": "marcusmoveson",
  "replyMode": "automatic",
  "replyDelay": 60
}

Errors

StatusCodeWhen
422VALIDATIONreplyMode is not off, draft or automatic; replyDelay is not an integer in 30 to 600; neither was sent; the body carries an unknown key; or the account is a managed Instagram account and replyMode is not off (replies on a managed account post through its manager, and that is TikTok only for now).
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks engagement:write.
404NOT_FOUNDProject not in your organization, or the account is not a TikTok or Instagram account on this project.

See also

On this page