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 details — line_oa_name, channel_id, channel_secret_id, channel_access_token, channel_name, bot_basic_id, premium_id and cover.
Public identifier — line_oa_hash is the hash used in tracking links and public pages so the real channel id is never exposed.
Webhook — webhook_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 / LIFF — line_login_info JSONB, consumed by client-web.
Follower sync — sync_follower_status (enum SyncFollowerStatus), sync_follower_logs and last_sync_followers_date.
Audience auto-refresh — audience_refresh_enabled and audience_refresh_interval (in minutes).
Google Analytics — ga_tracking_enabled and ga_identity_param (default lid).
Message-handling policy — message_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.
Quotas — plan_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.
Related Files
prisma/schema.prisma:295— modelLineOaprisma/schema.prisma:1675— modelLineOaAppprisma/migrations/20260726180000_add_line_oa_plan_limits/migration.sql— theplan_limitscolumnseed-data/06.line_oa.sql— seeds one test channelschema-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 withchannel_secret_id, calls the LINE API withchannel_access_token, and forwards toforward_webhook_url. - cms-api-go — channel CRUD, follower sync, and configuration of GA, message handling and plan limits.
- client-api-go — uses
line_oa_hashandline_login_infofor LIFF and public pages. - worker-go — reads
audience_refresh_enabledandaudience_refresh_intervalto schedule audience refreshes. - This table is the parent of nearly every other domain: campaigns, rich menus, audiences, content, forms and loyalty.