Moderate new user posts in Firebase before they go live
Every new review, listing, or community post gets judged against your house rules, marked approved, held, or blocked, and only the risky ones reach your team.
Whenever a new document lands in my Firestore collection of user generated content (reviews, listings, and community posts), I want you to moderate it against my house policy before it can do any damage. Use the Firebase poll trigger for a new document in a collection, pointed at that collection.
Start by reading the submitted text and the author id off the triggering document. Remember that Firestore wraps every field in a typed value envelope, so a field arrives as something like {"fields": {"body": {"stringValue": "..."}, "authorId": {"stringValue": "..."}}}. Unwrap those before you reason about them, and keep hold of the document's full resource name, which looks like projects/{projectId}/databases/(default)/documents/{collection}/{docId}.
Before judging the post on its own, use Run Firestore Query on the same collection to pull that author's recent prior submissions: filter on the author id field equal to this author, order by the creation timestamp descending, and limit it to roughly the last twenty. The point is that repeat spammers get caught as a pattern rather than judged one post at a time. If the same author has been posting the same link, the same pitch, or the same abuse repeatedly, treat that as an aggravating factor and escalate the severity even when the single post in isolation looks marginal.
Judge the content against this house policy: scam and affiliate link spam, including referral link dumping and repetitive promotional posting; harassment, hate, and targeted abuse; adult or sexual content; exposed personal details such as phone numbers, home addresses, card numbers, or government id numbers, whether the author's own or someone else's; and attempts to take the transaction off platform, such as asking to pay directly, move to a private messaging app, or deal outside the marketplace.
Land on exactly one verdict: approved, needs_review, or blocked. Reserve blocked for content that clearly and unambiguously violates the policy. Whenever the call is genuinely borderline, prefer needs_review over blocked. It is much worse to silently take down a legitimate post than to route a grey area to a human.
Write the verdict back onto the triggering document with Update Firestore Document, patching a moderation status field set to approved, needs_review, or blocked, a short one-sentence reason explaining the call, a severity, and a moderation timestamp. This is important: a Firestore PATCH replaces the whole document unless you limit it with updateMask.fieldPaths, so pass an update mask naming only the moderation fields. The user's original content fields must never be clobbered. My app reads the status field itself to hide or hold the content, so this write is what actually enforces the decision.
Only when the verdict is needs_review or blocked, post it to my moderation channel using the Slack Bot Send a Message operation. Include the verdict, the reason, the severity, a short excerpt of the content (a couple of lines, enough to judge without reprinting the whole thing), the author id, a note if this author has prior flagged submissions, and the full Firestore document path so a human can jump straight to the record and override the call.
Keep clean items out of Slack entirely. Approved content still gets its status written to Firestore, but it must not generate a Slack message, so the moderation channel stays signal only and my team actually keeps reading it.
Additional information
What does this prompt do?
- Watches the collection where your user submitted content lands and picks up each new review, listing, or community post as it arrives
- Looks at the author's recent earlier submissions too, so repeat spammers get caught as a pattern instead of being judged one post at a time
- Checks the content against your house policy covering scam and affiliate spam, harassment and hate, adult content, exposed personal details, and attempts to move the deal off your platform
- Writes a verdict of approved, needs review, or blocked back onto the record along with a short reason, a severity, and a timestamp, so your app can hide or hold the content on its own
- Posts only the flagged and blocked items to your moderation channel in Slack, with enough context for a human to review and overturn the call
What do I need to use this?
- A Firebase project with the collection where your user generated content is stored
- The names of the fields on those records that hold the submitted text and the author id
- A Slack workspace and a moderation channel for the flagged items
- Your house rules for what counts as acceptable content, in whatever wording you already use
How can I customize it?
- Rewrite the house policy in your own words to match your community, and add or drop categories as your rules change
- Decide how far back to look at an author's history, and how much weight repeat offences should carry
- Rename the fields the verdict is written to so they line up with what your app already reads
- Change which channel gets the alerts, or split blocked items and borderline items into separate channels
FAQs
Does this delete or hide the content by itself?
Will it overwrite the rest of the record?
What happens with borderline content?
Will clean posts clutter my Slack channel?
Can a human overrule the decision?
Does it work for reviews, listings, and comments at the same time?
Related templates
Every weekday, find every unpaid JobNimbus invoice, email each customer one reminder that gets firmer as it ages, and post a receivables summary to Slack.
Every weekday at 7am, your active courses are checked for missing work, silent logins, and slipping grades, with a ranked list sent to your advising channel.
Every hour, find the tickets closest to breaching, leave a nudge on each one, and post a ranked at-risk list to your support channel.
Every weekday afternoon, each student who is behind gets a warm, personal message in their Canvas inbox listing exactly what they owe.
Every Monday at 8am, see exactly which assignments have work waiting, sorted worst first, posted to Slack and logged to a spreadsheet.
Every weekday morning we compare your password vault against your HR records and suspend access for anyone who has already left.
Stop reading every user post yourself.
Let the obvious spam and abuse get caught and marked automatically, and keep your team's attention on the calls that genuinely need a person.