Skip to main content

LINE Official Account (Channel)

Overview

line_oa is the second-level tenant unit, sitting directly below the organization, and it is the hub of the whole system: almost every feature table carries a line_oa_id to bind its rows to a specific channel.

The table gathers everything about a single LINE Official Account — LINE Messaging API credentials, webhook configuration, follower-sync state, Google Analytics settings, the message-handling policy, and channel-level usage quotas.

Core Data Structure

line_oa (model LineOa)

Channel detailsline_oa_name, channel_id, channel_secret_id, channel_access_token, channel_name, bot_basic_id, premium_id and cover.

Public identifierline_oa_hash is the hash used in tracking links and public pages so the real channel id is never exposed.

Webhookwebhook_id and forward_webhook_url. webhook-go resolves the channel from webhook_id in the URL LINE calls, and can then forward the payload on to the customer's original endpoint.

LINE Login / LIFFline_login_info JSONB, consumed by client-web.

Follower syncsync_follower_status (enum SyncFollowerStatus), sync_follower_logs and last_sync_followers_date.

Audience auto-refreshaudience_refresh_enabled and audience_refresh_interval (in minutes).

Google Analyticsga_tracking_enabled and ga_identity_param (default lid).

Message-handling policymessage_handling_config JSONB, defaulting to {"priority":"auto_response_only"}. It decides whether an incoming user message is answered by auto-response, a trigger rule, or AI.

Quotasplan_limits JSONB (added by migration) sets usage ceilings for this channel specifically.

Structurally, the table has an organization_id FK to organization.id, soft delete through deleted_date, and two key indexes: (webhook_id, status, organization_id) and (line_oa_hash, status, organization_id).

line_oa_app (model LineOaApp)

An on/off switch for optional "apps" at the organization level, with a unique constraint on (organization_id, app_id) plus enabled and a config JSONB column.

app_id is the app name — appointment, bulletin, loyalty and so on — and the API uses this table as the basis for its AppEnabledGuard.

otp_config

OTP settings for both SMS (ThaiBulkSMS) and email, one row per OA enforced by a unique constraint on line_oa_id. It is used mainly by the form builder; see Form Builder.

  • prisma/schema.prisma:295 — model LineOa
  • prisma/schema.prisma:1675 — model LineOaApp
  • prisma/migrations/20260726180000_add_line_oa_plan_limits/migration.sql — the plan_limits column
  • seed-data/06.line_oa.sql — seeds one test channel
  • schema-dumps/2026-07-24/schema.sql:2151 (line_oa) and :2187 (line_oa_app)

Connections to Other Services

  • webhook-go — resolves the channel from webhook_id, verifies signatures with channel_secret_id, calls the LINE API with channel_access_token, and forwards to forward_webhook_url.
  • cms-api-go — channel CRUD, follower sync, and configuration of GA, message handling and plan limits.
  • client-api-go — uses line_oa_hash and line_login_info for LIFF and public pages.
  • worker-go — reads audience_refresh_enabled and audience_refresh_interval to schedule audience refreshes.
  • This table is the parent of nearly every other domain: campaigns, rich menus, audiences, content, forms and loyalty.