ContentRunner Bot Upsert icon

ContentRunner Bot Upsert

Insert or update a bot in n8n_content_runner by tg_bot_id

ContentRunner Bot Upsert

AI-generated

Summary

Insert or update a bot record in the PostgreSQL bots table, using its Telegram bot ID as the conflict key. Connect a Content Runner PostgreSQL credential and provide the bot ID; the operation returns the inserted or updated row.

Inputs

  • Telegram Bot ID (required) — Bot identifier, trimmed and converted to a string. Defaults to botId, bot.id, or bot.external_id from the incoming item.
  • Bot Username — Username to store; defaults to bot.name or bot_username from the incoming item. If omitted, preserves the existing username on update.
  • Is Active — Whether the bot is active; defaults to true. Sets is_active on insert or update.
  • Content Runner PostgreSQL credential (required) — Provides the database connection used to write the bot record.

Output shape

A list of items, one per input item, each containing the returned database row.

On a matching tg_bot_id, updates is_active and updates bot_username only when a username is supplied. If Continue On Fail is enabled, an item with a missing bot ID or another per-item error returns { "error": "..." } instead of a row.

Examples

Example 1: Insert a bot

Set tgBotId to a bot identifier and optionally provide botUsername and isActive.

Example 2: Update an existing bot

Use the existing tgBotId; the operation updates its active status and replaces the username only if a nonempty username is provided.

Links

Discussion