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.
PATCH
/v1/projects/:projectId/engagementPhase 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
projectIdstringrequiredProject the account belongs to.
Body
socialAccountIdstringrequiredThe account whose policy changes. From GET, or from the social accounts list.replyMode"off" | "draft" | "automatic"optionaloff: nothing is generated. draft: each reply waits for a human in the Comments tab. automatic: replies post on their own.replyDelayinteger (30 to 600)optionalSeconds 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
| Status | Code | When |
|---|---|---|
| 422 | VALIDATION | replyMode 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). |
| 401 | UNAUTHENTICATED | Missing or invalid key. |
| 403 | FORBIDDEN_SCOPE | Key lacks engagement:write. |
| 404 | NOT_FOUND | Project not in your organization, or the account is not a TikTok or Instagram account on this project. |
See also
GET /v1/projects/:id/engagement- read every account's policy