How to add comment moderation to your SaaS: hide spam on Instagram, Facebook and TikTok
A SaaS adds comment moderation by checking each new comment on its customers' accounts and hiding the bad ones through each network's official API. easyCoexistence's Partner API does it with no app review on your side: a comment_received automation hides comments that match keywords, that your model flags or that your classifier marks, and signed webhooks feed your queue, priced per connected account, not per comment.
easyCoexistence is social media infrastructure for AI agents: its Partner API connects your customers' WhatsApp, Instagram, Facebook and TikTok accounts to your product, with no app review on your side.
Who still sees a comment hidden on an Instagram post; Instagram does not tell the author it was hidden.
Who still sees a comment hidden on a Facebook Page post; everyone else stops seeing it.
TikTok's status for a comment hidden from public viewership, which stays on the video.
What Instagram's API allows on a hidden comment: it refuses any reply to it.
The automation step in which your own model picks the path that fits a comment by its meaning.
How a forwarded comment event is delivered: relayed in memory, never stored, with no retries.
How does a hide_comment automation work?
It acts on the comment that started it. Your backend creates a comment_received automation on the customer's Instagram account, Facebook Page or TikTok account with POST /channels/{id}/automations, for any comment or only one with a keyword, up to 30 keywords matched as contains, starts_with or exact, on any post or a single post_id. Its hide_comment step hides that comment through the network's own API: hide set to true on Instagram, is_hidden on a Facebook Page comment, and TikTok's HIDE action.
A keyword filter costs no AI call and suits the spam a word list catches, such as links or follower offers. Only one automation acts on each comment, keyword matches before catch-alls, so a keyword automation can hide the obvious cases while a catch-all with an AI check judges the rest. Automations see the comments that arrive after they are switched on, and they skip the account's own comments.
How does a model, or your own classifier, decide what to hide?
In an ai_decide step, on your own Anthropic, OpenAI or OpenRouter key. You give it 2 to 6 paths, each a name and a description of up to 500 characters, plus optional instructions of up to 4,000; the model reads the comment and names the path that fits, or none, which runs otherwise. A Spam path holds hide_comment, an Abuse path can hide and call your webhook, and a Question path can answer with ai_reply, all in one automation.
If your SaaS already runs its own classifier, use it instead. An http_request step POSTs the comment to your endpoint and saves its JSON answer, and a condition step hides the comment when the verdict says so. Your endpoint has 20 seconds to answer. Put the customer's ID in the URL when you create the automation, since you create one per channel:
curl -X POST https://easycoexistence.com/api/v1/channels/$CHANNEL_ID/automations \
-H "Authorization: Bearer $EC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Moderation by our classifier",
"trigger": { "type": "comment_received", "match": "any" },
"steps": [
{
"type": "http_request",
"method": "POST",
"url": "https://api.example.com/moderate/customer_4821",
"headers": [{ "name": "Authorization", "value": "Bearer <your-secret>" }],
"body": "{ \"text\": \"{{message}}\", \"author\": \"{{name}}\" }",
"save_as": "verdict"
},
{
"type": "condition",
"paths": [{
"name": "Hide",
"match": "all",
"rules": [{ "source": "var", "key": "verdict.action", "op": "equals", "value": "hide" }],
"steps": [{ "type": "hide_comment" }]
}],
"otherwise": []
}
]
}'
Your classifier answers:
{ "action": "hide" }How do webhooks feed your own moderation queue?
PUT /channels/{id}/webhook sets a destination per channel and returns its signing secret once. From then on each comment is forwarded as it arrives, signed with X-EC-Signature: Meta's webhook entry for an Instagram comment, the Page's feed change for a Facebook comment, and TikTok's comment.update, which also reports deletes and visibility changes such as set_to_hidden. Each POST carries platform, account_id, external_id and the network's entry, so your queue can show a customer their comments beside what the automation did with them.
Forwards are relayed in memory with no retries and no copy kept, so answer 2xx at once and store the event before anything slower. Decisions taken later in your queue act on TikTok through its API with the channel's token. On Instagram and Facebook, where the token stays with easyCoexistence, the hide happens inside the automation as the comment arrives, which is why the classifier route above runs in the flow itself.
What does hidden mean on each network?
On none of the three is a hidden comment deleted, but who still sees it differs, and so does what the API allows afterwards. Tell your customers which one applies before they switch moderation on:
- Instagram: the comment stays visible to the account and its author, and Instagram does not tell the author. The API then refuses replies to it, never hides the owner's own comments, and does not hide Live comments.
- Facebook Page: the comment stays visible to its author and their friends and disappears for everyone else. Meta's
is_hiddenfield applies to Page comments, and setting it back to false shows the comment again. - TikTok: the comment keeps its place on the video with the status HIDDEN, out of public view. comment.update reports
set_to_hidden, and an unhide may not take effect when TikTok's moderation or filters keep it hidden.
How do you test and review what was hidden?
POST /automations/{id}/test runs a sample comment through the flow and hides nothing: the hide step reports that it would hide the comment, while the AI step and any http_request or webhook really run, so you see the path a real comment would take. Run a spam sample and a normal one before the automation goes live.
GET /automations/{id}/runs then lists each comment the automation handled, for 30 days, with the path a branching step chose and each step's result, which is how your product can show a customer what was hidden and why. A comment hidden by mistake comes back through TikTok's API with the channel's token, or when the customer unhides it in the Instagram or Facebook app.
How to set it up
- Connect the customer's accountsCreate a connect session per network, Instagram, Facebook or TikTok, with your customer's external_ref, and keep each channel_id.
- Pick how comments are judgedKeywords for spam a word list catches, an ai_decide step on your AI key for meaning, or an http_request to your own classifier.
- Create the hiding automationPOST /channels/{id}/automations with comment_received and hide_comment on the spam path, leaving otherwise empty or replying there.
- Send comments to your queuePUT /channels/{id}/webhook so each comment, and on TikTok each later hide or delete, reaches your moderation view signed.
- Test, launch and reviewTest spam and normal samples, switch the automation on, and show customers its runs so wrongly hidden comments get restored.
Common mistakes
- Running separate hide and reply automations on the same comments. Only one automation acts on each comment, so put the spam path and the reply path in one ai_decide step.
- Describing a path in one word. The model routes by your descriptions, so spell out what spam looks like for that customer: follower sales, links to other shops, fake giveaways.
- Putting a reply after hide_comment on an Instagram path. Meta refuses replies to hidden comments, so that reply step fails; reply first or leave it out.
- Storing nothing when the forward arrives. Each comment is relayed once, with no retries and no copy kept, so write it to your queue before any slower work.
easyCoexistence moderates your customers' Instagram, Facebook and TikTok comments from automations your backend creates: keywords, your own model in an ai_decide step or your classifier's verdict decide, hide_comment acts through each network's official API, and signed webhooks copy each comment to your queue. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.
easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook, Google Business Profile and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.
Frequently asked questions
Does hiding a comment delete it?
No. On Instagram, Facebook and TikTok a hidden comment stays where it was, out of public view, and can be shown again, unless TikTok's own moderation keeps it hidden.
Does the author know their comment was hidden?
Instagram does not tell them. On a Facebook Page they and their friends still see it, and on TikTok it is hidden from public viewership.
Can it check comments posted before the automation existed?
No. Automations act on comments that arrive while they are on. Your backend can still read and hide a TikTok account's older comments through TikTok's API with the channel's token.
What does moderation cost?
easyCoexistence charges per connected account, US$ 9 to US$ 0.75 a month, not per comment. An AI check is one short call to your model, billed by your provider to your key.
Keep reading
Connect your first channel in two minutes.
No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.
- 3 days free
- Cancel any time
- Official APIs only
- Monitored 24/7
Verified on