Audience
Overview
This domain has two tables. audience holds audience definitions built either from an uploaded CSV
or from filter conditions, together with their auto-refresh settings. audience_member_log records
every add/remove of a member so you can audit who entered or left a group, when, and why.
Table audience
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | SERIAL (INTEGER) | NO | nextval(...) | Primary key of the audience |
title | TEXT | NO | - | Audience name |
description | TEXT | YES | '' | Audience description |
data_source | "AudiencesDataSource" | NO | - | Source of the member list: csv (file upload) or filter (built from conditions) |
details | TEXT | NO | - | Audience details, e.g. the source file name or a summary of the conditions |
info | JSONB | YES | - | Extra audience metadata such as statistics or processing information |
slug | TEXT | YES | - | Human-readable slug for referencing the audience |
filter_info | JSONB | YES | - | Filter conditions used to select members (used when data_source = filter) |
organization_id | INTEGER | NO | - | Owning organization |
line_oa_id | INTEGER | NO | - | Owning LINE OA |
api_client_id | INTEGER | YES | - | API client that created the audience (when created via API) |
api_key_id | INTEGER | YES | - | API key used to create the audience |
auto_refresh_enabled | BOOLEAN | NO | false | Whether members are refreshed automatically |
last_refresh_date | TIMESTAMPTZ(3) | YES | - | Timestamp of the last member refresh |
refresh_status | VARCHAR(20) | NO | 'idle' | Current refresh state, e.g. idle, processing |
status | "CommonStatus" | NO | - | Audience status (active, inactive, processing, ...) |
created_by | INTEGER | NO | - | User who created the record |
updated_by | INTEGER | YES | - | User who last updated the record |
created_date | TIMESTAMPTZ(3) | NO | now() | Creation timestamp |
updated_date | TIMESTAMPTZ(3) | YES | - | Last update timestamp (maintained automatically) |
deleted_date | TIMESTAMPTZ(3) | YES | - | Soft-delete timestamp (NULL means not deleted) |
Table audience_member_log
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | SERIAL (INTEGER) | NO | nextval(...) | Primary key of the log entry |
audience_id | INTEGER | NO | - | Audience the event belongs to (FK to audience.id) |
line_user_id | VARCHAR(255) | NO | - | LINE user ID of the member added or removed |
action | "AudienceMemberAction" | NO | - | Event type: add (joined) or remove (left) |
trigger_type | "AudienceMemberTriggerType" | NO | - | What caused the change: auto_refresh, manual or api |
created_date | TIMESTAMPTZ(3) | NO | now() | When the event occurred |
organization_id | INTEGER | NO | - | Owning organization |
line_oa_id | INTEGER | NO | - | Related LINE OA |
Notes
audience_member_log.audience_idis an FK toaudience.id.audienceis referenced bycampaign.audience_id,rich_menu.audience_idandrich_menu_archive.audience_idto determine message recipients or rich menu visibility.- Indexes on
audience:line_oa_id,deleted_date. - Indexes on
audience_member_log:audience_id,created_date(descending),action,line_oa_id— tuned for querying a group's most recent history quickly. audience_member_loghas no soft-delete column because it is an append-only log.