Reference · Tools
Google Cloud Natural Language
Analyze sentiment of text documents using the Google Natural Language API.
The Google Cloud Natural Language node sends text to Google's Natural Language API and returns sentiment scores at both the document and sentence level. Use it to automatically classify customer feedback, support tickets, or any freeform text as positive, negative, or neutral. A common pattern is pairing it with a Split Out node to score a list of reviews one by one.
- Node type
- Action
- Parameters
- 11
- Outputs
- Output, Error
- Credentials
- Google Cloud Natural Language OAuth2 API
Google Cloud Natural Language
Analyze document sentiment using Google Cloud Natural Language.
Overview
Google Cloud Natural Language tool for analyzing document sentiment. Supports both inline text content and Google Cloud Storage URIs as input sources. Returns overall document sentiment and per-sentence sentiment scores and magnitudes.
Category: AI
Tool Name: google_cloud_natural_language
Version: 1
Appearance: Icon: lucide-Brain | 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 Cloud Natural Language OAuth2 API credentials. See the Credentials Guide for setup instructions.
Resources
| Resource | Value |
|---|---|
| Document | document |
Operations
| Operation | Value | Description |
|---|---|---|
| Document: Analyze Sentiment | analyzeSentiment | Analyze sentiment of a document |
Parameters
Document: Analyze Sentiment
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Source | options | Yes | content | The source of the document: a string containing the content or a Google Cloud Storage URI. |
Options: content, gcsContentUri (Google Cloud Storage URI) | ||||
| Content | string | Yes | — | The content of the input in string format. Cloud audit logging exempt since it is based on user data. (shown when Source is content) |
| Google Cloud Storage URI | string | Yes | — | The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. (shown when Source is gcsContentUri) |
| Options | collection | No | {} | — |
| — Document Type | options | No | PLAIN_TEXT | The type of input document. |
Options: HTML, PLAIN_TEXT | ||||
| — Encoding Type | options | No | UTF16 | The encoding type used by the API to calculate sentence offsets. |
Options: NONE, UTF8, UTF16, UTF32 | ||||
| — Language | options | No | en | The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. |
Options: ar (Arabic), zh (Chinese (Simplified)), zh-Hant (Chinese (Traditional)), nl (Dutch), en (English), fr (French), de (German), id (Indonesian), it (Italian), ja (Japanese), ko (Korean), pt (Portuguese (Brazilian & Continental)), es (Spanish), th (Thai), tr (Turkish), vi (Vietnamese) |
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) |
| Max Concurrency | number | No | 10 | Maximum number of items to process concurrently. |
Output Data
One output item per input item. The sentiment analysis response is merged onto the input item JSON, so the fields the item already carried stay addressable downstream. Binary data is not forwarded — attach files after this node, not before it.
The response is passed through exactly as the Google Cloud Natural Language API returns it: the overall document sentiment (a score and a magnitude), the per-sentence breakdown with a score and magnitude for each sentence, and the language the document was analysed in. Run the node once and inspect the output item to see the exact key names before you write expressions against it.
A sentiment score runs from -1 (negative) to 1 (positive). A magnitude is unbounded and grows with the amount of emotional content, so a long mixed document can have a score near zero and a high magnitude.
Usage Examples
- Analyze sentiment of a customer review
- Determine whether feedback is positive or negative
- Get per-sentence sentiment scores for a document
- Analyze sentiment of text stored in Google Cloud Storage
- Classify text as positive, neutral, or negative
Example Configuration
Analyse the sentiment of text carried on the item:
{
"type": "google_cloud_natural_language",
"parameters": {
"resource": "document",
"operation": "analyzeSentiment",
"source": "content",
"content": "{{ $json.review }}"
}
}
Analyse a document stored in Google Cloud Storage, in Spanish:
{
"type": "google_cloud_natural_language",
"parameters": {
"resource": "document",
"operation": "analyzeSentiment",
"source": "gcsContentUri",
"gcsContentUri": "gs://my-bucket/documents/review.txt",
"options": {
"documentType": "PLAIN_TEXT",
"encodingType": "UTF16",
"language": "es"
}
}
}
Analyse an HTML document and cap how many items run at once:
{
"type": "google_cloud_natural_language",
"parameters": {
"resource": "document",
"operation": "analyzeSentiment",
"source": "content",
"content": "{{ $json.html }}",
"options": {
"documentType": "HTML",
"encodingType": "UTF8",
"language": "en"
},
"maxConcurrency": 5
}
}
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 sentiment using the Google Cloud Natural Language API.
Behavior notes
- Pick the right document type. Choose
HTMLwhen the content is markup and the API will ignore the tags; leave it onPLAIN_TEXTand the tags are analysed as words. - Encoding type only affects offsets. It decides how the character offsets in the per-sentence results are counted, not how the text is read. Leave it at
UTF16unless a downstream node slices the original string using those offsets. - Leave Language unset to auto-detect. Set it explicitly only when you already know the language — a wrong value degrades the scores.
- One item per document. To score many documents, produce one item per document upstream (a Split Out node works well) rather than concatenating them into one string.
Frequently asked questions
What credentials do I need to connect this node?
You need a Google Cloud Natural Language OAuth2 API credential, configured in BusyBot as googleCloudNaturalLanguageOAuth2Api. This means you must have a Google Cloud project with the Natural Language API enabled and OAuth2 credentials set up before the node will authenticate successfully.
My text contains HTML tags — will they affect the sentiment scores?
Yes, unless you set the document type to HTML. When you choose HTML, the API strips the markup and scores only the visible text. If you leave it on PLAIN_TEXT, angle brackets and tag names are treated as words, which can skew the results.
What does the Encoding Type setting actually control?
Encoding type only affects how character offsets are counted in the per-sentence results — it does not change how the API reads or interprets the text itself. The default UTF16 is fine for most workflows. Only change it if a downstream node uses those offsets to slice into the original string and you need the counts to match your string's encoding.
I want to analyze a batch of documents. Can I pass them all in at once?
No — the node processes one document per item. To score multiple documents, generate one workflow item per document upstream (a Split Out node is the straightforward way to do this) rather than concatenating everything into a single string, which would collapse all the per-sentence scores together.
Should I set the Language parameter, or leave it blank?
Leave it unset unless you already know the language of the incoming text. The API auto-detects language reliably, and supplying a wrong language code actively degrades the quality of the sentiment scores rather than helping.
Build with the Google Cloud Natural Language node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Google Cloud Natural Language OAuth2 API credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.