<!-- BusyBot node reference — https://busybot.net/tools/google-perspective/ -->

> Node: Google Perspective (`google_perspective`) · Action · v1
> Category: Analytics · Credentials: Google Perspective OAuth2 API (`googlePerspectiveOAuth2Api`)
> Updated: 2026-08-16

# 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](https://busybot.net/credentials/google-perspective-oauth2-api/) 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:

```json
{
  "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:

```json
{
  "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:

```json
{
  "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 `0` returns 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.