ContentRunner Get State icon

ContentRunner Get State

Get user_bot_interactions state by tg_chat_id + tg_bot_id or by user_id + bot_id

ContentRunner Get State

AI-generated

Summary

Retrieve a user–bot interaction record from PostgreSQL, identified by Telegram chat and bot IDs or by UUIDs. Optionally filter by campaign and choose whether a missing record returns { found: false } or raises an error.

Inputs

  • Identify By (required) — Choose tg_chat_id + tg_bot_id or user_id + bot_id (UUID) to select the identifiers used for the lookup.
  • Telegram Chat ID (required) — Used for Telegram identification; defaults to the incoming item’s parsed.from_id, parsed.chat_id, or tg_chat_id, in that order.
  • Telegram Bot ID (required) — Used for Telegram identification; defaults to the incoming item’s botId, bot.id, or bot.external_id, in that order.
  • User ID (required) — Used for UUID identification; defaults to the incoming item’s user_id.
  • Bot ID (required) — Used for UUID identification; defaults to the incoming item’s bot_id.
  • Campaign ID — Optional campaign UUID filter. Without it, the lookup returns the most recently joined matching interaction.
  • Continue On Not Found — Defaults to true; when no interaction matches, return { found: false }. When false, raise an error.
  • PostgreSQL credentials (required) — Connect using the required ContentRunner PostgreSQL credentials.

Output shape

One output item per input item, containing the matching interaction row or a not-found/error result.

A match is returned as { found: true, ...row }. The row includes interaction fields plus joined user and bot details and, when available, channel details. A campaign-filtered lookup does not limit results, so it can return multiple matching rows; without a campaign filter, only the most recently joined match is returned. With Continue On Not Found enabled, no match yields { found: false }; input validation or database errors may instead yield { error: ... } when n8n Continue On Fail is enabled.

Links

Discussion