Comment-to-DM Automations API: Instagram, Facebook and X keyword DMs
A comment-to-DM automation answers a keyword with a private message. When somebody comments "guide" on your post, the account sends them the guide in a DM, once per person, and can post a public reply under the comment ("Sent you a DM!"). The same automation can listen to a keyword in a DM to the account, and on Instagram to a keyword in a reply to a story.
An automation runs on one channel, set by platform:
instagram(the default): the connected Instagram account.facebook: the connected Facebook Page. The DM lands in the person's Messenger.x: the connected X account. It answers DMs only, never a post. See On X.
Automations are managed with the Automations endpoints (GET/POST /automations, GET/PATCH/DELETE /automations/:id, GET /automations/:id/events, GET /automations/:id/results, GET /automations/:id/events/:event_id/story), or attached to a new post with comment_dm_automation on POST /posts/create. Everything you create here shows up on the Automations page in the dashboard, and the other way round.
Enabling automation access
The scopes are opt-in, like the inbox scopes: an automation sends DMs in your account's name, and its activity carries what people wrote. When you create an API key, turn on Automations to grant automations:read (list, get, activity, results, one person's story) and automations:write (create, update, delete, and comment_dm_automation on posts). Existing keys are not given these scopes automatically; without them every endpoint answers 403 insufficient_scope.
The activity, the results and one person's story also need a role, the same as on these pages in OmniSocials: the person who made the key (or who connected the app or the AI assistant) must be allowed to create and schedule posts or to use the social inbox in the workspace. This is checked on every request, so a key stops reading them when its maker loses both permissions; the answer is then 403 insufficient_permission. Listing and reading an automation need only automations:read.
Creating an automation
JSON
| Field | Meaning |
|---|---|
platform | instagram (default), facebook (the connected Facebook Page) or x (the connected X account, DMs only). Set at create; it never changes. instagram_media_id implies instagram and facebook_post_id implies facebook. |
trigger.kinds | What starts the automation: comment (default) = a comment on a post or reel, dm = a keyword in a DM to the account (on Facebook: a Messenger message to the Page), story_reply = a keyword in a reply to an Instagram story. One automation can listen to several. Facebook has no story replies: story_reply on a Facebook automation answers 400 validation_error. On X only dm exists: pass ["dm"], since comment or story_reply there answers 400 validation_error. |
trigger.scope | For the comment kind: post (default) = one post, next_post = the next post the workspace publishes on the automation's platform, any = every post of the account or Page. |
post_id | For scope post: an OmniSocials post that goes to the automation's platform, scheduled or already live. A scheduled post starts listening once it is live. One automation per post and platform: a post that goes to Instagram and Facebook can have one of each. |
instagram_media_id | For scope post on Instagram: the numeric id of a post or reel that was published outside OmniSocials (from Instagram's API, GET /me/media). OmniSocials reads it from Instagram to check it belongs to the connected account. |
facebook_post_id | For scope post on Facebook: the id of a post that was published on the Page outside OmniSocials, as {page-id}_{post-id} or the post id alone (OmniSocials puts the Page id in front). OmniSocials reads it from Facebook to check it belongs to the connected Page. |
trigger.keywords | Up to 20 keywords, matched case-insensitively. Required unless match is any. |
trigger.match | word (default): the keyword as a whole word, in the forms people write it: capitals, accents, fancy letters, longer letter runs ("guideee"), a plural or common ending ("guides"). Never part of another word ("linkedin" does not match "link"), and no typos. contains: the keyword appears anywhere. any: every comment, also one without text (a photo, GIF or sticker comment), and every message with text. See Keyword matching. |
actions.dm.text | The DM, max 1000 characters (640 with a button). Sent once per person per automation. |
actions.dm.button | Optional link button under the DM, Instagram and Facebook: title (1 to 20 characters) and url (https:// only, max 900 characters). OmniSocials counts the taps. See Link button. |
actions.public_reply | A public reply under the comment, for the comment kind only. One of variations (up to 10) is picked at random per comment. |
actions.follow_gate | Follow first, Instagram only: the DM goes out only to people who follow the account. See Follow first. |
actions.follow_up | Follow-up, Instagram and Facebook: one more DM 1 to 23 hours after the answer. See Follow-up. |
limits.max_sends | Stop after this many DMs; the automation becomes completed. |
limits.stop_at | Stop at this time (ISO 8601). |
status | active (default) or paused to create it without turning it on. An active X automation needs X DMs on for the workspace (409 x_dms_off); paused always saves. |
Pass at most one of post_id, instagram_media_id and facebook_post_id. All three need scope post.
The response is the automation with platform, the live id of the post (instagram_media_id on Instagram, facebook_post_id on Facebook; set once the post is live, null on the other channel), a post snapshot (source is omnisocials, instagram or facebook, with caption, thumbnail_url, permalink), actions.dm (text, and button or null), actions.follow_gate (with its texts; null on Facebook and X), actions.follow_up (null on X) and stats (matched, sent, skipped, failed, followed, follow_ups_sent, follow_ups_skipped, linked, clicked, follow_up_clicks, answered, last_event_at; see Totals on the automation).
A keyword in any DM or story reply, no post needed:
JSON
On a Facebook Page
The same body with platform: "facebook". For a Page post that was published outside OmniSocials, pass facebook_post_id:
JSON
A keyword in a Messenger message to the Page, no post needed:
JSON
On X
On X an automation answers a DM. When somebody sends your X account a DM with one of the keywords, the account answers with actions.dm.text, once per person. With "match": "any" it answers the first message of every person who writes.
JSON
- DMs only. X allows an automated DM only after the person wrote to you first, so
trigger.kindsis["dm"]. Acommentorstory_replytrigger answers400 validation_error. An X automation has no post fields (post_id,scope) and no public reply. - X DMs must be on. The automation answers the DMs that X sends to OmniSocials, so the workspace needs X DMs turned on in the dashboard: the X DMs card in the Social Inbox, or the automation editor. See X direct messages. Without them, creating an active X automation, or a
PATCHtostatus: "active", answers409 x_dms_off.status: "paused"always saves, so you can create the automation first and turn it on later. No X account in the workspace answers409 x_not_connected. - The stop line and the stop list. Every X answer ends with the line "Reply STOP to stop automatic messages." A person who replies with only "stop" (or "unsubscribe", "opt out", "cancel", "end", "quit") goes on the stop list of that X account: no automation sends them a DM from that account again. The stop list belongs to the X account, not to one automation: it holds after the automation is deleted, for automations made later, and in every workspace that has the same X account. Another X account still answers the person. Their message shows in the activity with outcome
opted_out, and an answer that was waiting in the queue when they said stop is skipped with reasonopted_out. - Send caps. OmniSocials sends at most 15 automatic answers per 15 minutes and 450 a day per X account (X's own limit is 500 DMs a day, the team's DMs included). An answer over a cap waits in the queue (see Send caps and the queue).
- Credits. X DMs run on credits: each received DM uses 1 credit and each answer 2, like a reply from the inbox. When the credits ran out before an answer, it is skipped with reason
no_credits: top up, then answer that person in the Social Inbox. See What it costs. - Encrypted chats get no answer. X does not give apps the messages of a conversation that runs in its encrypted X Chat, so an automation never sees those messages. See Encrypted chats.
- No buttons. X has no buttons in DMs, so an X automation has no link button:
actions.dm.buttonwith a title or address answers400 dm_button_not_supported. Put the link in the DM text.button: nullis fine, and the response always showsnull.
Keyword matching
trigger.match decides which comments and messages count:
match | What counts |
|---|---|
word (default) | The keyword as a whole word, in the forms people write it (see below). |
contains | The keyword anywhere in the text, also inside another word ("link" matches "linkedin"). |
any | Every comment, also one without text (a photo, GIF or sticker), and every message with text. No keywords needed. |
With word, OmniSocials cleans each word of the comment or message before it compares:
- Capitals, accents and fancy letters count as plain letters: "GUIDE", "Guíde" and "𝐆𝐔𝐈𝐃𝐄" are "guide".
- Longer letter runs count: "guideee", "liiink". A double letter of the keyword stays at least double, so "god" does not match GOOD.
- One ending may follow: -s on any word ("guides"), and -es, -ies, -ie, -y, -ey, -je, -jes, -tje, -tjes, -pje or -pjes when 4 or more letters stay.
- A plural keyword also takes its singular when 4 or more letters stay: LINKS matches "link", NEWS does not match "new".
- Punctuation and emoji split words: "Guide!", "#guide" and "guide🙏" match. An underscore joins a word, as in a handle: "@my_guide" does not match.
It still compares whole words only: a keyword never matches a part of another word, and there is no typo rule.
| Keyword | Matches | Does not match |
|---|---|---|
| GUIDE | "Guide!", "guides", "guideee", "𝐆𝐔𝐈𝐃𝐄" | "guidebook", "gude", "guise" |
| LINK | "link", "LINKS", "liiink" | "linkedin", "blink", "unlink" |
| LINKS | "links", "link" | "blinks" |
| NEWS | "news", "NEWS!" | "new" |
An event that matched another form of a keyword carries match with the keyword and the word the person wrote ({ "keyword": "link", "word": "LINKS" }, see Activity), and the results count these as variants. contains and any work as before.
Link button
A link button sits under the DM: the person taps Get the guide instead of a long web address, and OmniSocials counts the taps.
JSON
| Field | Meaning |
|---|---|
dm.button.title | The text on the button, 1 to 20 characters (Meta's limit for a button title). |
dm.button.url | The address the button opens: https:// only, max 900 characters. It is stored and returned as the parsed address (a space becomes %20). |
With a button, dm.text holds 640 characters (Meta's button template); without one, 1000.
Where the button shows:
| Channel | The button |
|---|---|
| On every answer: the private reply to a comment, the answer to a DM or story reply, the link after a Follow first tap, and the link after the follow-up's tap step. | |
| On the answer to a Messenger message. The private reply to a comment has no button: the address goes on its own line under the text, and taps on it are not counted. | |
| X | None. X has no buttons in DMs: put the link in the DM text. A button answers 400 dm_button_not_supported. |
How taps are counted:
- The button opens a short link on the OmniSocials backend (
https://backend.omnisocials.com/l/and 12 characters). It counts the tap and sends the person on to yoururlat once. People see the button, not the short address. - The first tap per answer counts:
stats.clicked, the event'sclicked_at, andclickedin the results. Link checkers, preview bots and HEAD requests are sent on without a count. - The short link works for 60 days after the DM, and only while your organisation has a plan; after that it answers 404.
- The follow-up's button (
follow_up.button) is counted the same way when its address is https:stats.follow_up_clicksandfollow_up.clicked_aton the event. An http:// follow-up button goes out as is and is not counted. - A link you write in the DM text itself goes out as you wrote it and is never counted. To count taps, put the link in the button.
stats.linkedcounts the answers that went out with a counted button: the base of the click rate. When the short link cannot be stored, the button carries your plain address, so the DM still goes out; that answer is not counted as linked.
A title that is empty or over 20 characters answers 400 validation_error ("dm.button.title needs 1 to 20 characters"), an address that is not https or is longer than 900 characters "dm.button.url must be a web address that starts with https:// (at most 900 characters)", and a DM text over 640 characters with a button "A DM with a link button can hold 640 characters".
On PATCH, a body without button keeps the stored button, null (or an empty title and url) removes it, and a new object replaces it: send title and url together. The response shows actions.dm.button as { "title", "url" } or null, always null on X.
A post's comment_dm_automation does not take a button (see On a new post): set it on each automation with PATCH /automations/:id. A later update of the post keeps it.
Follow first
Follow first sends the link only to people who follow your Instagram account. It works on Instagram only: Facebook and X do not tell apps who follows an account.
What the person sees:
- They comment the keyword. The private reply is a short first message with one button, for example "Tap the button and I'll send you the link 👇" with the button Send me the link. The public reply under the comment goes out at once, as always.
- They tap the button. OmniSocials asks Instagram whether they follow the account.
- They follow: the DM with the link (
actions.dm.text) goes out. They do not follow yet: they get the not-following message with its own button ("Almost there! Follow us first, then tap the button again.", I follow now). Every later tap checks again.
Why a button first: Meta lets an app read whether someone follows only after that person messaged the account or tapped a button. A private reply alone is not enough.
A DM or story reply trigger needs no first message: the person wrote first, so the check runs at once. A follower gets the link at once; anyone else gets the not-following message with its button.
When Instagram gives no answer to the check, the link goes out anyway, marked not checked. After 10 taps that say "not yet", that person's taps get no answer.
JSON
| Field | Meaning |
|---|---|
follow_gate.enabled | true turns Follow first on. null or false in place of the object turns it off and keeps the texts. |
follow_gate.first_message | text (max 640 characters) and button (max 20 characters, Meta's limit for a button title). Default: "Tap the button and I'll send you the link 👇" and "Send me the link". |
follow_gate.not_following | The answer to a tap from someone who does not follow yet, with the same limits. Default: "Almost there! Follow us first, then tap the button again." and "I follow now". Naming the account reads better: "Follow @yourbrand first". |
Every key is optional, and a text or button you leave out is the default. A text over 640 characters or a button over 20 answers 400 validation_error with the field in the message (follow_gate.first_message.button can hold 20 characters). enabled: true on a Facebook or X automation answers 400 follow_gate_instagram_only.
The response always shows the gate with its texts filled in, null on Facebook and X:
JSON
Good to know:
- Waiting people. Someone who got the first message but has no link yet shows in the activity with outcome
waiting; the event'sfollow_gatesays how far they got (see Activity).stats.followedcounts the people who followed after the ask, then got the link. - One DM per person. That rule stays. A second comment from someone who is waiting is skipped with reason
already_waiting("Already asked to follow. The link goes out after the follow"). A new keyword DM from them checks again. - The send cap. The first message counts as one DM against the hourly cap, as before. The follow ask and the link go out inside the 24-hour window that the tap opens.
- Paused automations. A tap on a paused automation is skipped with reason
automation_off, and nothing is sent. - No active plan. While your organisation has no active plan or trial, a tap gets no answer. The person keeps waiting and gets the link on a tap after the plan is back.
Follow-up
A follow-up is one more DM, 1 to 23 hours after the answer went out: "Did the guide help? Book a call here". It works on Instagram and on a Facebook Page. X has none: X allows an automatic DM only as the answer to a DM.
Meta allows an automatic message only within 24 hours after the person's last DM, button tap or quick reply. The comment and the private reply to it do not open that window. So:
- An Instagram comment gets a tap step. With a follow-up on (and Follow first off), the first DM is a short message with one button, for example "Tap the button and I'll send you the link 👇" with the button Send me the link. The tap sends the link (
actions.dm.text) and opens Meta's window. People who never tap get no link and no follow-up. With Follow first on, its own tap does this. - A DM or story reply trigger needs no tap step. The person's own message opened the window, so the link goes out at once, as always.
- A Facebook comment has no button. Only people who answer the DM in Messenger can get the follow-up; for the rest it is skipped with
window_closed.
JSON
| Field | Meaning |
|---|---|
follow_up.enabled | true turns the follow-up on. null or false in place of the object, or { "enabled": false }, turns it off and keeps the texts. |
follow_up.text | The follow-up, max 1000 characters (640 with a button). Required to turn it on. |
follow_up.delay_hours | Hours after the answer, a whole number from 1 to 23. Default 23, the end of Meta's window. |
follow_up.button | Optional link button under the follow-up: title (1 to 20 characters) and url (https:// or http://, max 2000 characters). null removes it. |
follow_up.tap | Instagram only: the tap step's text (max 640 characters) and button (max 20). Default: "Tap the button and I'll send you the link 👇" and "Send me the link". Facebook ignores it. |
A text that is too long, a delay outside 1 to 23, a button without a title or with a web address that is not http(s) answers 400 validation_error with the field in the message (follow_up.button.title needs 1 to 20 characters). enabled: true on an X automation answers 400 follow_up_not_supported.
The response shows the follow-up with the tap step texts filled in (tap is null on Facebook; the whole field is null on X):
JSON
When a follow-up is due, OmniSocials checks again and skips it when:
| Reason | Why |
|---|---|
window_closed | No tap or message from the person in the last 24 hours (with a 15 minute margin): Meta allows no automatic message then |
team_answered | A team member wrote to the person by hand after the answer (in the Social Inbox, the Instagram app or Messenger) |
opted_out | The person's latest message is "stop" |
follow_up_off | You switched the follow-up off |
automation_off | You paused or deleted the automation |
plan_inactive | Your organisation had no active plan or trial |
cannot_message | Meta refused: the person's settings block messages |
Good to know:
- The DM limit. A person who waits for the tap counts against
limits.max_sends. An automation finished by its DM limit or stop date still sends the follow-ups of the people it answered. - Waiting people. Someone who got the tap step and has not tapped yet shows in the activity with outcome
waitingandfollow_gate.mode: "tap"(see Activity). - The send cap. Follow-ups do not count against the 700 private replies an hour; the tap step does, as one DM.
- Counts.
stats.follow_ups_sentandstats.follow_ups_skipped.
Meta rules
The rules are the same on Instagram and on a Facebook Page:
- One private reply per comment, and only within 7 days of the comment. A comment older than 7 days is skipped (
window_passed). - Meta refuses a private reply to a comment made by a Page (a Page cannot message another Page) and to a person whose settings block messages. That comment is skipped (
cannot_message). To test an automation, comment from a personal profile, not as a Page. - An automatic message is possible only within 24 hours after the person's last DM, button tap or quick reply. A comment does not open that window, so a follow-up after a comment needs a tap (Follow first's tap, or the tap step).
- The DM goes to each person once per automation (
already_sent). - OmniSocials sends at most 700 DMs an hour per account and platform; Meta's own limit for private replies is 750 calls an hour, and it counts the calls it refuses too. An answer over the cap waits in the queue (see below).
- Public replies belong to comments; a DM or story-reply trigger has none.
- Facebook has no story replies. On a Page,
dmmeans a keyword in a Messenger message.
Send caps and the queue
Each channel has a send cap per account: 700 answers an hour on Instagram and on a Facebook Page, and 15 per 15 minutes plus 450 a day on X. An answer over the cap is not dropped: it waits in a queue (outcome queued) and goes out as soon as there is room. The queue runs every minute and gives each account its own turn. On Instagram and Facebook an answer can wait for about a day: 24 hours for the answer to a comment, 23 hours for the answer to a DM or story reply (Meta's 24-hour message window). On X it can wait an hour. When the platform itself answers with its rate limit (HTTP 429 on X, a rate limit error from Meta), the answer goes back to the queue until the platform's wait time is over. An answer that found no room in that time becomes skipped with reason rate_limited; answer that person by hand in the Social Inbox. An answer that waits while the automation is paused or finishes is skipped with reason automation_off, one to a person who said stop meanwhile with reason opted_out, and one whose organisation's plan or trial ended meanwhile with reason plan_inactive.
Updating, pausing, deleting
PATCH /automations/:id takes the same fields. status: "paused" pauses, "active" resumes. trigger, actions and limits are merged into the stored sections: keys you omit keep their value, so { "trigger": { "keywords": ["pdf"] } } keeps the kinds, the scope and the match, and a new dm.text keeps the public reply. dm merges key by key: a new dm.text keeps the link button, a new dm.button keeps the text (a stored text over 640 characters then answers 400 validation_error), and dm.button: null removes the button. public_reply.enabled: false (or variations: []) turns the public reply off; limits.max_sends: null removes that limit. follow_gate merges too: { "enabled": false } keeps the texts, new texts keep the switch, null turns it off, and a body without follow_gate keeps the stored one. follow_up merges the same way: { "enabled": false } or null turns it off and keeps the texts, keys you leave out keep their value ({ "delay_hours": 12 } changes only the delay), tap merges key by key, button: null removes the button and a new button replaces the stored one (send title and url together). Another post_id, instagram_media_id or facebook_post_id moves the automation to that post. The platform cannot change: a body that names another platform (or instagram_media_id on a Facebook automation, facebook_post_id on an Instagram one) answers 400 platform_immutable; create a new automation instead. A completed automation starts again when its limits or trigger change. DELETE /automations/:id removes it and its activity; DMs already sent stay sent.
Setting an X automation to status: "active" needs X DMs on for the workspace (409 x_dms_off).
GET /automations takes ?status=, ?post_id= and ?platform=instagram|facebook|x.
Activity
GET /automations/:id/events returns one row per comment or message the automation acted on, newest first, with counts per outcome (plus clicked and answered) and offset pagination:
JSON
| Field | Meaning |
|---|---|
linked | true when the answer went out with a link button that counts taps. |
clicked_at | The first tap on the DM's link button, else null. |
replied_at | When the person first wrote back to the account (a DM, on Facebook a Messenger message) within 7 days of the answer, else null. When they got several answers in those 7 days, the newest one gets it. A Follow first tap is no answer, and neither is "stop" on X. |
match | How the comment or message matched: { "keyword", "word" } when the person wrote another form of the keyword (keyword link, written as LINKS), null when it matched the keyword as written or the automation uses contains or any. word comes from the person's text, so on a dm or story_reply row it is null for a key without inbox:read, like trigger_text. See Keyword matching. |
Two filters list the people behind the results: ?filter=clicked the people who tapped the DM's link button, ?filter=answered the people who wrote back within 7 days of the answer. A filter combines with outcome, limit and offset; another value is ignored. counts.clicked and counts.answered count over every event of the automation, like the outcome counts. They overlap the outcome counts (a tapped answer is also sent), so do not add them up.
Text
outcome is sent, skipped (with reason: already_sent, limit_reached, stopped, window_passed, rate_limited (the send cap stayed full: for a day on Instagram and Facebook, for an hour on X), cannot_message, already_replied, dm_window_passed, and on X dms_closed (X refused: the person does not accept DMs from your account), no_credits (credits ran out before the answer), opted_out (the person replied STOP before, or while the answer waited), plus automation_off (the automation was paused or finished while the answer waited) and plan_inactive (your organisation had no active plan or trial, so nothing was sent; automations send only while the plan runs), with reason_label in plain words), failed (with the platform's error in reason), pending, queued (waits in the queue, see Send caps and the queue), opted_out (the person replied STOP on X) or waiting (Follow first: asked to follow, the link goes out after the follow; or the tap step of a follow-up: the link goes out after the tap). Follow first adds the skip reason already_waiting. queued and opted_out rows carry a reason_label too ("Waiting for room under the send limit. It goes out as soon as there is room", "Said stop. No automatic DMs to this person from this account"). Filter with ?outcome=; ?outcome=not_sent lists skipped and failed rows together (everyone who got no DM, the Not sent tab in the dashboard). A row's id is its event id: one person's story takes it. The text of a DM or story reply is private: trigger_text on dm and story_reply rows is returned only to a key with the inbox:read scope; a comment is public and always returned.
With Follow first on, an event carries follow_gate (else null):
JSON
state is waiting (asked, no link yet), done (the link went out) or null (the row was skipped or failed). taps counts the button taps. followed is true when a confirmed follower got the link and null when the link went out unchecked because Instagram gave no answer. checked says whether Instagram answered. after_ask is true when the person followed after the ask, and false with followed: true when they already followed. counts gets a waiting key, and ?outcome=waiting lists the people still waiting. A person who waits counts against limits.max_sends, so "stop after 50" asks at most 50 people, and still gets the link when the limit or the end date finishes the automation, or when you switch Follow first off (then without a check). Only a paused or deleted automation leaves their tap without an answer.
With a follow-up, the tap step's event carries follow_gate with "mode": "tap" (Follow first's events have "mode": "follow"); after the tap checked stays false and followed is null, since there was no follow check. Each answer that went out with a follow-up carries follow_up (else null):
JSON
state is scheduled (waits for due_at), sending, sent, skipped (with a reason from the table in Follow-up) or failed (with the platform's error in reason, or interrupted when the send was cut off; it is not sent again). clicked_at is the first tap on the follow-up's link button, else null.
On Facebook, person.id is the person's id as the Page sees it, and person.username is their name: Facebook has no @handle. kind is comment or dm. On X, person.username is the X handle and kind is always dm.
Results
GET /automations/:id/results adds up what happened in a period, step by step: how many people commented, got the DM, tapped, clicked and wrote back, why the others got no DM, every step per day, and the posts that went live in the period. It is the Results tab of the automation in the dashboard. It needs automations:read.
Text
| Query | Meaning |
|---|---|
period | 7d, 30d (default) or all (since the automation was made). Another value answers 400 validation_error. |
time_zone | An IANA name such as Europe/Amsterdam (default UTC). The days of series are counted in it. An unknown zone falls back to UTC; time_zone in the answer says which one was used. |
JSON
from is now minus 7 or 30 days (for all, when the automation was made) and to is now. The steps count the comments and messages that came in during the period, with everything that happened to them since:
| Step | What it counts |
|---|---|
commented | Every comment or message that matched (a "stop" on X not included) |
got_dm | The first answer went out: the DM, or the Follow first or tap step message that waits for a tap |
tapped | People who tapped the Follow first or tap step button |
got_link | The link went out after that tap |
followed | People who followed after the follow ask (Follow first) |
linked | Answers that went out with a link button that counts taps |
clicked | Those link buttons tapped (the first tap per answer) |
follow_ups | Follow-ups that went out |
follow_up_clicked | Follow-up link buttons tapped |
answered | People who wrote back within 7 days of the answer |
variants | Matched as another form of a keyword (see Keyword matching) |
public_replies | Public replies posted under comments |
tapped, got_link and followed stay 0 without Follow first or a follow-up's tap step. A tap today on a DM from 8 days ago is not in clicked for 7d, since the comment came in before the period, but it is in today's entry of series.
commentsis every comment on the automation's posts in the period, from the Social Inbox (for scopeany: every comment on the account or Page). It isnullfor an automation without a comment trigger, and 0 while the post is not live yet.not_sentsays why people got no DM, most first:labelin plain words (the same words asreason_labelin the activity),outcome(skippedorfailed) andcount.serieshas every step per day (see the table below), with every day of the period present (0 when none). Forall,unitisweekand each entry is a week that starts on Monday (dayis that Monday).postsare the posts that went live through OmniSocials on the automation's channel in the period, oldest first, at most 9 (the newest 9 when there were more). An automation on one post lists that post only, when it went live in the period. Each haspost_id,day(the day it went live, intime_zone),platform,kind(post,reel,story,carouseland so on),title(the first line of the caption, 80 characters, empty when there is none) andthumbnail(the first picture, or the still of the first video;nullwhen there is none). Put a post'sdaynext toseriesto see which post brought the comments. The list is empty on X and for an automation without a comment trigger. Posts published outside OmniSocials are not in it.
The day each series count falls on:
| Field | Counted on the day of |
|---|---|
sent | The answer going out (its send time) |
clicked | The first tap on the DM's link button |
answered | The person's first message back (within 7 days of the answer) |
commented | The comment or message: every match (a "stop" on X not included) |
not_sent | The comment or message: no DM (skipped or failed) |
tapped | The comment or message: the Follow first or tap step button was tapped |
got_link | The comment or message: the link went out after that tap |
follow_ups | The comment or message: its follow-up went out |
So a comment from Monday whose answer waited in the queue until Tuesday is in Monday's commented and Tuesday's sent.
How to read the rates:
| Rate | Divide | What it tells you |
|---|---|---|
| Keyword share | commented / comments | How many commenters used the keyword (here 412 of 1,290, 32%) |
| DM share | got_dm / comments | How many of all commenters got a DM (29%) |
| Reach | got_dm / commented | How many who asked got the DM (90%); not_sent says why the rest did not |
| Tap rate | tapped / got_dm | With Follow first or the tap step: how many tapped the button |
| Click rate | clicked / linked | How many DMs with a button were tapped (44%). Divide by linked, not got_dm: an answer without a counted button cannot be clicked |
| Reply rate | answered / got_dm | How many people wrote back (10%) |
| Follow-up click rate | follow_up_clicked / follow_ups | How many follow-up buttons were tapped |
When a divisor is 0, there is no rate. A 404 not_found means no automation with that id in the key's workspace.
Totals on the automation
Next to the period results, every automation's stats keep running totals since the automation was made:
| Key | What it counts |
|---|---|
linked | Answers sent with a counted link button |
clicked | Those buttons tapped (the first tap per answer) |
follow_up_clicks | Follow-up link buttons tapped (the first tap per follow-up) |
answered | People who wrote back within 7 days of the answer |
The other keys (matched, sent, skipped, failed, followed, follow_ups_sent, follow_ups_skipped, last_event_at) are unchanged. Each key is 0 when there is nothing to count.
One person's story
GET /automations/:id/events/:event_id/story shows one person's whole story with the automation, like the person panel in the dashboard: what they commented or wrote, the post the comment is on, the DM the automation sends, and the DM conversation with them after it (the answer, the link, the follow-up, their replies and your team's). Take event_id from the id of a row in the activity; ?filter=clicked and ?filter=answered find the people who tapped or wrote back. It needs automations:read.
Text
JSON
| Field | Meaning |
|---|---|
event | The same row as in the activity (outcome, reason, taps, replied_at, follow-up and so on). |
kind | comment, dm or story_reply. |
said | What the person commented or wrote (1,000 characters). For a dm or story_reply only with the inbox:read scope, else null. |
post | The post the comment is on (caption: the first line, 120 characters; thumbnail), as the Social Inbox stored it. null for a DM or story reply, or when the inbox has no copy. |
dm | What the automation sends now: its DM text and the label of its link button (null when none). What really went out is in messages. |
messages | The DM conversation with the person from 5 minutes before the comment to 8 days after it (the 7 days in which a reply counts, and a day for the follow-up), oldest first, at most 60 messages, as the Social Inbox stored it. direction is incoming (the person wrote it) or outgoing (the account sent it); automation is true for a message an automation sent (the answer, the link, the follow-up) and false for one a person typed. null without the inbox:read scope: DMs are private. |
Without inbox:read the story still has the event, the comment, the post and the DM setup. A 400 validation_error means event_id is not a number; a 404 not_found means no automation with that id in the key's workspace, or no event with that id in this automation.
On a new post
Pass comment_dm_automation on POST /posts/create to bind automations to the post you are creating (Instagram or Facebook must be in accounts; an X automation answers DMs and is never bound to a post, so create it with POST /automations). It is the create body without post_id, scope and kinds (always this post, comment trigger), plus an optional platforms: ["instagram"], ["facebook"] or both. Each listed channel gets its own automation with the same keywords, DM, public reply and limits. Without platforms the post gets one automation: on Instagram when the post goes there, else on Facebook. actions.follow_gate works here too: with platforms: ["instagram", "facebook"] it applies to the Instagram automation, and the Facebook one sends the DM at once (no error). actions.follow_up works here too, for every listed channel. A link button is not set from a post: actions.dm.button is left out here, so add the button to each automation with PATCH /automations/:id.
The post comes back with comment_dm_automation: the first automation's fields (Instagram first), plus platforms and automations (id, platform and status of each). GET /posts/:id returns it. PATCH /posts/:id replaces the setup with a new object (a channel no longer in platforms loses its automation, and an object without follow_gate turns Follow first off; an object without follow_up keeps each automation's stored follow-up, and each automation keeps its link button) or removes every automation with null. See Creating posts.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | validation_error | Bad input; the message says what (for example "Write the DM", "Add at least one keyword, or choose any comment", "Facebook has no story replies", "Pass one of post_id, instagram_media_id or facebook_post_id.", "A DM with a link button can hold 640 characters", "dm.button.title needs 1 to 20 characters"), also a comment or story_reply trigger on X, a period other than 7d, 30d or all on the results, and an event_id that is not a number on the story |
| 400 | post_not_instagram, post_not_facebook | The post does not go to the automation's platform |
| 400 | post_required | Scope post without post_id, instagram_media_id or facebook_post_id |
| 400 | platform_immutable | A PATCH names another platform |
| 400 | follow_gate_instagram_only | follow_gate.enabled: true on a Facebook or X automation: "Follow first works on Instagram only: Facebook does not tell apps who follows an account" |
| 400 | dm_button_not_supported | actions.dm.button on an X automation: "X has no buttons in DMs: put the link in the DM text" |
| 400 | follow_up_not_supported | follow_up.enabled: true on an X automation: "A follow-up works on Instagram and Facebook only: X allows an automatic DM only as the answer to a DM" |
| 403 | insufficient_scope | The key has no automations:read / automations:write |
| 404 | post_not_found, instagram_media_not_found, facebook_post_not_found, not_found | No such post, Instagram media, Page post or automation in this workspace (on the story also: no such event in this automation) |
| 409 | instagram_not_connected, instagram_needs_reauth | Connect or reconnect Instagram first |
| 409 | facebook_not_connected, facebook_needs_reauth | Connect or reconnect a Facebook Page first |
| 409 | x_not_connected | Connect an X account first |
| 409 | x_dms_off | X DMs are off for the workspace: turn them on in the Social Inbox (or the automation editor), or save the automation with status: "paused" |
| 409 | automation_exists | The post already has an automation on this platform; the response carries its automation_id |
Using it from an AI assistant
The MCP server has list_automations, get_automation, create_automation, update_automation, delete_automation and get_automation_activity (each takes platform where it applies, x included; the activity also takes filter: clicked or answered, and the outcome not_sent, and shows each row's event id), the read tool get_automation_results (automation_id, period, time_zone) for the results (with a table of every step per day and the posts of the period), the read tool get_automation_story (automation_id, event_id) for one person's story, and create_post takes comment_dm_automation with platforms. The link button is two flat fields on create_automation and update_automation: dm_button_title and dm_button_url (null on either removes the button). Follow first is flat fields there: follow_gate (true or false), follow_gate_text, follow_gate_button, not_following_text and not_following_button. So is the follow-up: follow_up_text (turns it on), follow_up (true or false), follow_up_delay_hours, follow_up_button_title and follow_up_button_url (null removes the button), follow_up_tap_text and follow_up_tap_button. The CLI has the automations:* commands (link button: --dm-button-title with --dm-button-url, --no-dm-button; activity: automations:events <id> --filter clicked|answered, --outcome not_sent; results: automations:results <id> [--period 7d|30d|all] [--time-zone <IANA>]; one person's story: automations:story <id> <event_id>; Follow first: --follow-first on|off; follow-up: --follow-up-text, --follow-up-delay, --follow-up-button-title with --follow-up-button-url, --no-follow-up-button, --follow-up-tap-text, --follow-up-tap-button, --no-follow-up) and the --dm-* flags on posts:create (Follow first: --dm-follow-first).