Reference · Tools
Google Perspective
Analyze text for toxic content using the Google Perspective API
The Google Perspective node sends text to Google's machine learning API and returns probability scores across up to eight toxicity attributes — including Toxicity, Insult, Threat, and Sexually Explicit. Use it to build automated comment moderation pipelines that flag or block submissions before they reach your users. Scores come back as floats between 0 and 1, ready to branch on in any downstream step.
- Node type
- Action
- Parameters
- 8
- Outputs
- —
- Credentials
- Google Perspective OAuth2 API
Google Perspective
Analyze text for toxic content with the Google Perspective API
Overview
Google Perspective uses machine learning to analyze text and score it across multiple toxicity attributes: Toxicity, Severe Toxicity, Insult, Profanity, Identity Attack, Threat, Sexually Explicit, and Flirtation. Each attribute returns a probability score between 0 and 1. The API supports English, Spanish, French, German, Portuguese, Italian, and Russian text. Content type is always PLAIN_TEXT and scoreType is always “probability”.
Category: Analytics
Tool Name: google_perspective
Version: 1
Appearance: Icon: lucide-Shield | Color: #4285F4
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | Output, Error |
Credentials
This tool requires Google Perspective OAuth2 API credentials. See the Credentials Guide for setup instructions.
Operations
| Operation | Value | Description |
|---|---|---|
| Analyze Comment | analyzeComment | Analyze text for toxic content and return attribute probability scores |
Parameters
Analyze Comment (analyzeComment)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Text | string | Yes | — | The text to analyze. Content type is always PLAIN_TEXT. |
| Attributes to Analyze | fixedCollection | Yes | {} | One or more toxicity attributes to score. At least one is required. |
| — Attribute Name | options | No | toxicity | The toxicity attribute to score. See https://developers.perspectiveapi.com/s/about-the-api-attributes-and-languages for details. |
Options: flirtation, identity_attack, insult, profanity, severe_toxicity, sexually_explicit, threat, toxicity | ||||
| — Score Threshold | number | No | 0 | Score above which to return results (0–1). At zero, all scores are returned. |
| Options | collection | No | {} | — |
| — Language | options | No | — | Language of the text input. If unspecified the API auto-detects the language. |
Options: "" (Auto-detect), en (English), es (Spanish), fr (French), de (German), pt (Portuguese), it (Italian), ru (Russian) |
All Operations
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Authentication | options | No | oAuth2 | Authentication method to use. |
Options: oAuth2 (OAuth2 (recommended)), serviceAccount | ||||
| Google Account | credential | No | — | Connect or select your Google account. (shown when Authentication is oAuth2) |
| Service Account Email | string | Yes | — | The email address of the Google service account. (shown when Authentication is serviceAccount) |
| Private Key | string | Yes | — | The private key from the service account JSON key file. (shown when Authentication is serviceAccount) |
Output Data
One output item per input item. The Perspective API response is merged onto the input item JSON — every field the item already carried is preserved — and binary data is forwarded unchanged.
The scores arrive under attributeScores, keyed by the attribute name in upper case (TOXICITY, SEVERE_TOXICITY, IDENTITY_ATTACK, INSULT, PROFANITY, THREAT, SEXUALLY_EXPLICIT, FLIRTATION), even though you pick them in lower case in the Attributes to Analyze list. Only the attributes you requested are present.
Every score is a probability between 0 and 1 — the modelled likelihood that a reader would perceive the comment as carrying that attribute. It is not a measure of how much of the attribute the text contains.
Reference a score downstream by expression, for example {{ $json.attributeScores.TOXICITY }}, and branch on it with an If or Switch node.
Usage Examples
- Check a comment for toxicity before publishing
- Analyze user-generated content for profanity
- Detect identity attack language in forum posts
- Score multiple toxicity dimensions with score thresholds
- Moderate content in English, Spanish, or French
Example Configuration
Score a comment for toxicity before publishing it:
{
"type": "google_perspective",
"parameters": {
"operation": "analyzeComment",
"text": "You are such an idiot!",
"attributes": {
"attributeValues": [
{
"attributeName": "toxicity",
"scoreThreshold": 0.5
}
]
}
}
}
Screen user-generated content across several attributes at once:
{
"type": "google_perspective",
"parameters": {
"operation": "analyzeComment",
"text": "This content might contain offensive language and threats.",
"attributes": {
"attributeValues": [
{
"attributeName": "toxicity",
"scoreThreshold": 0.7
},
{
"attributeName": "threat",
"scoreThreshold": 0.5
},
{
"attributeName": "insult",
"scoreThreshold": 0.6
}
]
}
}
}
Analyse Spanish text, returning every score regardless of how low it is:
{
"type": "google_perspective",
"parameters": {
"operation": "analyzeComment",
"text": "Este comentario podría ser tóxico",
"attributes": {
"attributeValues": [
{
"attributeName": "toxicity",
"scoreThreshold": 0
}
]
},
"options": {
"languages": "es"
}
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Analyze text for toxic content using the Google Perspective API across attributes like toxicity, insult, profanity, and threat. Use when you need to score user-generated content for moderation or safety filtering. Returns probability scores between 0 and 1 for each requested attribute.
Behavior notes
- Content type is always plain text. Markup is not stripped for you — strip HTML upstream if your source is rich text, or the tags themselves become part of the analysed comment.
- Score thresholds filter the response, they do not change the model. A threshold of
0returns every requested score; a higher threshold suppresses scores below it, so a downstream expression may find the attribute missing rather than low. - Pick attributes deliberately. Each one you request is scored, and requesting attributes you never read only makes the call slower.
- Supported languages are English, Spanish, French, German, Portuguese, Italian and Russian. Leave Language on auto-detect unless you already know the language of the text.
Frequently asked questions
What credentials does this node require?
It uses Google Perspective OAuth2 API credentials, configured as `googlePerspectiveOAuth2Api` in BusyBot. You'll need to enable the Perspective API in your Google Cloud project and complete the OAuth2 setup before the node can make requests. Standard API key auth is not supported here.
If I set a score threshold, what happens to attributes that score below it?
The threshold filters the response — it does not influence the model's scoring. Any attribute whose score falls below your threshold is simply omitted from the output entirely. That means a downstream expression checking for that attribute won't find a low number; it'll find nothing. Design your logic to handle a missing attribute rather than assuming a zero.
My source text is HTML. Will the node handle the markup?
No. The node always analyses plain text, and HTML tags are treated as literal characters. If your input comes from a rich-text editor or a web scrape, strip the markup upstream before passing the text to this node — otherwise angle brackets and tag names become part of what's being scored.
Do I need to request all eight attributes every time?
No, and you shouldn't unless you actually use all eight downstream. Every attribute you request is scored individually, so requesting ones you never read adds unnecessary latency to each call. Pick only the attributes relevant to your moderation policy.
Which languages does the API support, and should I set the language manually?
The API supports English, Spanish, French, German, Portuguese, Italian, and Russian. Leave the Language parameter on auto-detect unless you already know the language of the incoming text — auto-detect handles most cases correctly and avoids misclassifying multilingual content.
Build with the Google Perspective node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Google Perspective OAuth2 API credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.