# n8n node

> Install and use the FluentC n8n community node. Credentials, the Translate, Detect and Get Many operations, batch polling, limits and common workflows.

Source: https://www.fluentc.ai/docs/integrations/n8n/

`n8n-nodes-fluentc` is the FluentC community node for [n8n](https://n8n.io). It translates text, HTML and JSON, detects languages, and lists the languages enabled for your key, all from the canvas. Source: [GitHub](https://github.com/FluentC/n8n-nodes-fluentc).

## Install

In n8n:

1. Open **Settings → Community Nodes** and choose **Install**.
2. Enter the package name `n8n-nodes-fluentc` and confirm.
3. The **FluentC** node is available straight away. You can also search for "FluentC" in the node panel.

Self-hosted n8n, from the command line:

```bash
cd ~/.n8n/nodes   # create it if it doesn't exist
npm install n8n-nodes-fluentc
# restart n8n
```

With Docker, add the same `npm install` to your image:

```dockerfile
FROM n8nio/n8n:latest
RUN cd ~/.n8n/ && mkdir -p nodes && cd nodes && npm install n8n-nodes-fluentc
```

## Add your credentials

1. In n8n, go to **Credentials → New** and choose **FluentC API**.
2. Paste your [API key](https://dashboard.fluentc.io/users/sign_up) into **API Key**.
3. Save. n8n tests the key by listing your languages.

The node sends the key in the `Authorization` header as-is, so you paste the bare key. See [Authentication](https://www.fluentc.ai/docs/authentication.md).

## Operations

Pick a **Resource**, then an **Operation**.

| Resource | Operation | What it does |
| --- | --- | --- |
| Translation | Translate | Translate text, HTML or JSON in real-time or batch mode |
| Language Detection | Detect | Detect the language of text or HTML |
| Language | Get Many | List the languages enabled for your key |

### Translate

| Field | Description |
| --- | --- |
| Mode | **Real-Time** for an immediate answer, **Batch** for large content. Real-time needs the Real-time plan. |
| Input | The content to translate. Up to 100,000 bytes. |
| Input Format | **Text**, **HTML** or **JSON**. |
| Target Language | A dropdown filled from the languages enabled for your key. |
| Source Language | Optional. Leave empty and the source language is worked out from the text. |
| Max Polling Attempts | Batch only, under **Additional Fields**. 1 to 100, default 60. |

In batch mode the node submits the job and then polls for you. It waits at least 5 seconds between polls (longer if the API asks), stops when the job completes, and fails the item with a clear error if the job fails or you run out of attempts.

**Output.** One item per input item, containing the API's response plus the settings used:

```json
{
  "status": "complete",
  "translation": "Tu pedido ha sido enviado.",
  "token_count": 9,
  "source_language_detected": "en",
  "mode": "real-time",
  "input_format": "text",
  "target_language": "es"
}
```

`source_language` is added when you set one. For `JSON` input, `translation` is a JSON-encoded string; parse it with n8n's **Edit Fields** or a Code node. See [Translate](https://www.fluentc.ai/docs/api/translate.md) for every field.

### Detect

Takes **Input** and **Input Format** (**Text** or **HTML**). The output is the API's response (the detected language and a confidence score, see [Detect language](https://www.fluentc.ai/docs/api/detect-language.md)) plus `input_format` and `input_length`.

### Get Many (languages)

No parameters. The output has two arrays, `supported_languages` and `source_languages`, each item `{ "code": "es", "name": "Spanish" }`. The Target Language and Source Language dropdowns in the Translate operation are filled from the same call.

## Workflows

### Translate one value

1. Add a **FluentC** node.
2. Set **Resource** to **Translation** and **Operation** to **Translate**.
3. Set **Mode** to **Real-Time** or **Batch**.
4. Enter the content in **Input**, or map it from the previous node, and set **Input Format**.
5. Pick a **Target Language** and run the node. The translation is in `translation`.

### Detect, then translate

1. Add a **FluentC** node set to **Language Detection → Detect**.
2. Connect it to a second **FluentC** node set to **Translation → Translate**.
3. In the Translate node, map the detected language to **Source Language** with an expression.
4. Add an **IF** node before Translate if you only want to translate when the language isn't your own, or when confidence is low.

### Translate a list

n8n runs a node once per input item, so feed it a list and it translates each item. Use **Batch** mode for long lists. Identical items are answered from [translation memory](https://www.fluentc.ai/docs/concepts.md#translation-memory), so duplicates in a list cost little.

## Errors and limits

- **Continue On Fail.** Turn it on in the node settings and a failed item comes out as `{ "error": "..." }` instead of stopping the workflow.
- **Input size.** A single input over 100,000 bytes fails before it is sent. Split large content, or send it as a list of items.
- **Languages fallback.** If listing languages fails with Continue On Fail on, the Get Many operation returns a built-in list of ten common languages with the error. Don't treat it as your enabled set.
- **Plan.** Real-time mode on a Batch plan key fails with `Realtime translation is not supported for this agent.` Switch the node to Batch.
- **API errors** such as `401`, `403` and `422` pass through with the API's message. See [Errors](https://www.fluentc.ai/docs/api/errors.md).

## Ideas that work well

- **Multilingual chatbot:** detect the user's language, translate the question to yours, translate the answer back.
- **Support triage:** translate every incoming ticket so one team can read and route them.
- **Catalog translation:** run a product feed through Batch once; reruns are answered from memory.
- **Newsletter localisation:** translate a campaign into each segment's language before it sends.
