# n8n (/en/n8n)

[n8n](https://n8n.io) is a workflow automation tool. Tebar has two official n8n nodes:

- **Tebar**: creates and schedules posts, uploads media, reads accounts, and replies to or hides comments.
- **Tebar Trigger**: runs a workflow when something happens in Tebar, such as a post going live or failing, a new comment, or a new Instagram DM.

The source code and releases are at [github.com/tebarapp/n8n-nodes-tebar](https://github.com/tebarapp/n8n-nodes-tebar).

<Callout>
  The nodes use Tebar's API, so they need a paid plan: Starter, Basic, Pro, or Agency. See [Plans &
  limits](/en/paket).
</Callout>

## Install the nodes [#install-the-nodes]

1. In n8n, open the nodes panel (the **+** button) and search for **Tebar**.
2. If it is not there yet, install it by hand: **Settings** → **Community nodes** → **Install**, enter `n8n-nodes-tebar`, tick the agreement, and click **Install**.

## Connect your Tebar account [#connect-your-tebar-account]

1. In the Tebar dashboard, open the account menu (bottom left) → **API keys** → **Create an API key**. Tick **Allow writing** if your workflow posts or replies to comments. The key is shown only once.
2. In n8n, add a Tebar node, then under **Credential** choose **Create new credential** and paste the API key.
3. Save. n8n checks the key with Tebar right away.

| Field    | Description                                                                                                                                                                                 |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Key  | The `tb_live_…` key from the dashboard                                                                                                                                                      |
| Profile  | Optional. For an owner API key: the External ID of a [workspace](/en/profile), so the workflow only works in that workspace. Leave it empty to reach every workspace (new posts go to Main) |
| Base URL | Leave it as `https://api.tebar.app`                                                                                                                                                         |

If you have several workspaces and the workflow is for one client or brand, the easiest way is to pick that workspace in the **Workspace** field when you create the API key. Such a key cannot touch other workspaces, so the Profile field can stay empty.

<Callout type="warn">
  An API key works like a password. Keep it only in the n8n credential, never in workflow text or a
  sticky note.
</Callout>

## What the Tebar node does [#what-the-tebar-node-does]

| Resource | Operations                                                                                                           |
| -------- | -------------------------------------------------------------------------------------------------------------------- |
| Post     | **Create** (now or scheduled), **Get**, **Get Many**, **Cancel** (a scheduled post), **Retry** (the failed accounts) |
| Media    | **Upload** (a file from an earlier node, up to 100 MB), **Upload From URL**, **Get**, **Get Many**, **Delete**       |
| Comment  | **Get Many** (for example, only unreplied ones), **Get**, **Reply**, **Hide**                                        |
| Account  | **Get Many**, **Get**                                                                                                |

The Tebar node can also be used as a tool by n8n's **AI Agent**.

### Creating posts [#creating-posts]

- **Select Accounts**: the same text and media to every selected account.
- **Targets JSON**: write the account list yourself for different text, media, or options per account, such as a Threads poll, an Instagram Story, or a YouTube title. YouTube needs `title` and `made_for_kids`, and Pinterest needs `board_id`. Every option is in the [API Reference](/en/reference).

```json
[
  { "account_id": "THREADS_ACCOUNT_ID", "options": { "poll": { "options": ["Black", "Latte"] } } },
  { "account_id": "YOUTUBE_ACCOUNT_ID", "options": { "title": "New menu", "made_for_kids": false } }
]
```

Keep in mind:

- **Schedule At** is read in the workflow's timezone. Leave it empty to publish now.
- Set an **Idempotency Key** when a workflow might run twice for the same post. Tebar then returns the first post instead of creating another one.
- Instagram and TikTok need a photo or video. A text-only post to those accounts fails.
- Posts to X are paid from your balance (Rp400, or Rp4,000 when the text has a link). See [X](/en/x).

## Tebar Trigger [#tebar-trigger]

Choose the events to catch, then activate the workflow. Tebar Trigger registers a [webhook](/en/api/webhook) in Tebar for you and removes it when the workflow is deactivated. Every delivery's signature is checked, so forged deliveries are rejected.

| Event                                                                                         | When                                                                     |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `post.published`, `post.failed`                                                               | A post goes live or fails on one account (failed: after the last try)    |
| `comment.created`, `comment.replied`, `comment.hidden`, `comment.unhidden`, `comment.deleted` | A comment is new, replied to, hidden, shown again, or deleted            |
| `message.received`, `message.sent`                                                            | An Instagram DM comes in or goes out                                     |
| `account.connected`, `account.expired`, `account.disconnected`                                | An account is connected, needs reconnecting, or is disconnected          |
| `automation.run`, `profile.deleted`                                                           | An [automation](/en/automations) finished a run, a workspace was deleted |

Requirements:

- Use an **owner API key**. A key limited to one workspace cannot create webhooks. To limit events to one workspace, fill the **Profile ID** field of the Tebar Trigger node.
- Tebar only delivers to `https` addresses reachable from the internet. n8n Cloud works as is. Self-hosted n8n needs `WEBHOOK_URL` set to a public https address.
- The same event can arrive more than once. Use the event `id` to skip duplicates when it matters.

## Example workflows [#example-workflows]

Each example was tested on n8n 2.47 with Tebar node 0.1.2. To use one:

1. In n8n, create a workflow and click the **⋯** menu at the top right → **Import from URL**.
2. Paste the example's link below and click **Import**. You can also download the JSON file and choose **Import from file**.
3. Follow the yellow note in the workflow: choose the credentials, accounts, and other fields it mentions.
4. Activate the workflow.

### Post a photo or video from a form [#post-a-photo-or-video-from-a-form]

An n8n form with a caption and one photo or video. The file is uploaded to Tebar's [Media](/en/media), then posted right away to the chosen accounts. Handy for team members without dashboard access.

```txt
https://raw.githubusercontent.com/tebarapp/n8n-nodes-tebar/main/examples/form-to-post.json
```

In the **Create post** node, choose accounts that accept media (Instagram, Threads, TikTok, Facebook, and others). Once it is active, open the **Production URL** of the **Form** node.

### Share new articles from RSS [#share-new-articles-from-rss]

Every hour, each new article in an RSS feed is posted with its title and link. Articles already in the feed when you activate the workflow are skipped.

```txt
https://raw.githubusercontent.com/tebarapp/n8n-nodes-tebar/main/examples/rss-to-post.json
```

Change the feed URL in the **New item in feed** node, then choose accounts that take text posts: Threads, X, LinkedIn, Facebook, Telegram, or Discord. Keep X's price for posts with a link in mind.

### Telegram alert when a post fails [#telegram-alert-when-a-post-fails]

When a post fails on an account, you get a Telegram message with the platform and the reason.

```txt
https://raw.githubusercontent.com/tebarapp/n8n-nodes-tebar/main/examples/failed-post-alert.json
```

You need a Telegram bot (create one with [@BotFather](https://t.me/BotFather)) and your chat ID. The Tebar credential in the **Post failed** node must use an owner API key.

### Morning digest of unreplied comments [#morning-digest-of-unreplied-comments]

Every day at 9:00, Telegram gets the 20 newest comments you have not replied to, with a link to the [Comments](/en/komentar) page. No message when there are none.

```txt
https://raw.githubusercontent.com/tebarapp/n8n-nodes-tebar/main/examples/unreplied-comments-digest.json
```

Comments are written by other people, so this example shows them as plain text. Characters such as `<`, `&`, or `_` in a comment do not break the Telegram message.

## When something fails [#when-something-fails]

The node shows Tebar's error, such as `account_expired` (the account needs reconnecting) or `plan_required` (a paid plan is needed). The full list is in [Errors](/en/api/error).
