Configure auto-pilot engagement
First-comments at publish and auto-replies to incoming comments, tuned to brand voice and rate-limited per post.
What you'll build
A running auto-pilot for the comments under a customer's posts: a first-comment that drops at publish, and auto-replies on incoming comments. Both are tuned to the project's brand voice, and both pass through a moderation gate before anything goes out.
This is a configuration flow - you read the current engagement config, patch the fields you want, and the next post uses the updated settings. There's no separate job to start.
Read the current engagement config
Every project has a Social Engagement layer. Calling GET fetches the full config — every set field round-trips, including the advanced knobs (firstComment.strategy, replyToComments.tone, replyToComments.maxPerPostPerHour, replyToComments.ignoreCommentsMatching, replyToComments.escalateNegativeSentiment).
/v1/projects/:projectId/engagement- Auth
- Bearer
- Scope
- engagement:write
curl "https://api.layers.com/v1/projects/$PROJECT_ID/engagement" \
-H "Authorization: Bearer $LAYERS_API_KEY"{
"enabled": false,
"firstComment": {
"targets": [],
"commentTemplate": ""
},
"replyToComments": {
"targets": [],
"autoReplyDelay": "PT3M"
}
}Defaults are empty and enabled: false - nothing ships until you turn it on.
Enable first-comments
First-comments drop automatically after publish. Typical use: call-to-action that didn't fit the caption, app link, "DM for the recipe", etc.
/v1/projects/:projectId/engagement- Auth
- Bearer
- Scope
- engagement:write
curl -X PATCH "https://api.layers.com/v1/projects/$PROJECT_ID/engagement" \
-H "Authorization: Bearer $LAYERS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"firstComment": {
"targets": ["tiktok", "instagram"],
"commentTemplate": "Grab the app - link in bio. First order is on us ☕️"
}
}'const res = await fetch(
`https://api.layers.com/v1/projects/${projectId}/engagement`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.LAYERS_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
enabled: true,
firstComment: {
targets: ["tiktok", "instagram"],
commentTemplate: "Grab the app - link in bio. First order is on us ☕️",
},
}),
},
);import os
import requests
requests.patch(
f"https://api.layers.com/v1/projects/{project_id}/engagement",
headers={
"Authorization": f"Bearer {os.environ['LAYERS_API_KEY']}",
"Content-Type": "application/json",
},
json={
"enabled": True,
"firstComment": {
"targets": ["tiktok", "instagram"],
"commentTemplate": "Grab the app - link in bio. First order is on us ☕️",
},
},
)commentTemplate is a literal string - no interpolation today. The same template drops under every post on every target platform. If you need per-post customization, pass firstCommentOverride on the schedule call instead.
If you see VALIDATION with data.field: "targets", you passed a platform the project doesn't have a distribution layer for. Run GET /v1/projects/:id and check layers[] - only platforms with a distribution layer can be engagement targets.
Enable auto-replies
Auto-replies respond to incoming comments on published posts, passing every reply through a moderation gate before it goes live.
curl -X PATCH "https://api.layers.com/v1/projects/$PROJECT_ID/engagement" \
-H "Authorization: Bearer $LAYERS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"replyToComments": {
"targets": ["tiktok", "instagram"],
"autoReplyDelay": "PT5M"
}
}'autoReplyDelay is an ISO-8601 duration (PT30S, PT5M, PT1H) - short enough to feel responsive, long enough that replies don't stack up on the post's top shelf. PT3M is the default and works for most accounts.
Replies are LLM-generated, tuned to the project's brandContext.brandVoice, and filtered by a safety layer before posting. Nothing ships that fails moderation - the comment is silently skipped and logged for review. Escalating negative-sentiment comments to human review is planned.
Turn it off
Set enabled: false to stop everything. First-comments drop, auto-replies drop, in-flight replies cancel.
curl -X PATCH "https://api.layers.com/v1/projects/$PROJECT_ID/engagement" \
-H "Authorization: Bearer $LAYERS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "enabled": false }'Use the master switch rather than emptying the targets arrays - it's faster to restore, and it keeps the config intact so you can re-enable without re-patching everything.
Advanced knobs
Beyond the basic enable/template setup, the engagement config exposes finer-grained controls:
firstComment.strategy-literal(publishcommentTemplateverbatim, no LLM) orgenerated(default; LLM-written per post usingcommentTemplateas style examples).replyToComments.tone- per-action brand-voice override for replies. Falls back to the project-level engagement tone when omitted.replyToComments.maxPerPostPerHour- rolling-hour cap on owner-replies per post (1–60). Trips before the lifetime per-post cap when exceeded.replyToComments.ignoreCommentsMatching- regex allowlist of user-comment shapes to skip. Each entry must compile as a JS RegExp; the first match aborts the reply for that comment.replyToComments.escalateNegativeSentiment- whentrue, comments classified as negative sentiment route into draft mode (pending_engagement_comments) for human review instead of auto-publishing.
Example combining all advanced knobs:
curl -X PATCH "https://api.layers.com/v1/projects/$PROJECT_ID/engagement" \
-H "Authorization: Bearer $LAYERS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"firstComment": {
"targets": ["tiktok", "instagram"],
"commentTemplate": "Drop your favorite below.",
"strategy": "generated"
},
"replyToComments": {
"targets": ["tiktok", "instagram"],
"autoReplyDelay": "PT3M",
"tone": "professional",
"maxPerPostPerHour": 10,
"ignoreCommentsMatching": ["^/spam$", "^bot[0-9]+$"],
"escalateNegativeSentiment": true
}
}'