Quick Overview
This workflow exposes a POST webhook that sends user text (and optional context) to Google Gemini for moderation, returning an allow/flag/block decision, toxicity level, matched categories, detected PII types, a short reason, and a cleaned version with slurs masked and PII redacted.
How it works
- Receives a POST request on a webhook endpoint with a JSON body containing
text and optional context.
- Sends the input to Google Gemini with instructions to classify safety (allow/flag/block), rate toxicity, identify categories, detect PII, and produce a redacted/masked
cleaned_text.
- Parses Gemini’s response into a structured JSON object with the required moderation fields.
- Returns the moderation result to the caller as the webhook response.
- If Gemini fails to classify the text, returns a fail-safe JSON response that flags the content for human review.
Setup
- Add a Google Gemini (PaLM) API credential for the Google Gemini Chat Model node.
- Activate the workflow and copy the production webhook URL from the webhook trigger.
- Configure your client/app to POST JSON (for example
{ "text": "...", "context": "..." }) to the /moderate endpoint and handle the JSON response.