LINE Friends (LINE User)
Overview
This domain has a single table, line_user, which stores the profile of each friend (follower) of
a LINE OA. One row represents one LINE-user-to-channel pair and combines LINE profile data,
customer-supplied details, follow/unfollow state, the linked rich menu, audience membership and
organization-defined custom attributes (custom_attribute).
Table line_user
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | UUID | NOT NULL | gen_random_uuid() | Internal primary key |
user_id | TEXT | NOT NULL | – | LINE user ID (Uxxxxxxxx...) from the LINE Platform |
display_name | TEXT | NOT NULL | – | Display name on the LINE profile |
picture_url | TEXT | NOT NULL | – | Profile picture URL from LINE |
user_info | JSONB | NULL | – | Raw profile payload returned by the LINE API |
language | TEXT | NOT NULL | 'th' | Language used to communicate with this friend |
firstname | TEXT | NULL | – | First name (from a registration form or a data import) |
lastname | TEXT | NULL | – | Last name |
email | TEXT | NULL | – | Email address |
mobile_no | TEXT | NULL | – | Mobile phone number |
follow | CommonConfirm (enum) | NOT NULL | – | Current friendship state: yes = still following, no = blocked/unfollowed |
rich_menu_id | INTEGER | NULL | – | Rich menu linked to this user (FK to rich_menu.id) |
registered_date | TIMESTAMPTZ(3) | NULL | – | Registration date (form submission / identity verification) |
unfollow_date | TIMESTAMPTZ(3) | NULL | – | Date the user unfollowed or blocked the OA |
status | CommonStatus (enum) | NOT NULL | active | Record status |
deleted_date | TIMESTAMPTZ(3) | NULL | – | Soft-delete timestamp |
created_by | INTEGER | NULL | – | User id of the creator (when created from the CMS or an import) |
updated_by | INTEGER | NULL | – | User id of the last editor |
created_date | TIMESTAMPTZ(3) | NOT NULL | CURRENT_TIMESTAMP | Record creation timestamp |
updated_date | TIMESTAMPTZ(3) | NULL | – | Last update timestamp |
organization_id | INTEGER | NOT NULL | – | Organization owning the record |
line_oa_id | INTEGER | NOT NULL | – | LINE OA channel this user is a friend of |
user_type | LineUserType (enum) | NULL | guest | Friend type: guest (not registered) or member (registered) |
last_activity_type | ActivityType (enum) | NULL | follow | Most recent activity type: follow, unfollow, message, tracking |
last_activity_period | ActivityPeriod (enum) | NULL | – | Time of day of the last activity: morning, afternoon, evening, night |
last_activity_date | TIMESTAMPTZ(3) | NULL | CURRENT_TIMESTAMP | Timestamp of the last activity |
last_activity_status | ActivityStatus (enum) | NULL | active | Engagement status: active or inactive |
audience_ids | JSONB | NULL | – | IDs of the audiences/segments this user belongs to (JSON array) |
rich_menu_archive_id | INTEGER | NULL | – | Archived rich menu previously linked to the user (FK to rich_menu_archive.id) |
custom_attribute | JSONB | NULL | {} | Organization-defined attributes, stored as key-value pairs declared in attribute_master |
Notes
- Unique constraint:
(user_id, line_oa_id, organization_id)— the same LINE user may be a friend of several channels, but only one row exists per channel. - Indexes:
line_user_line_oa_id_idx(btree online_oa_id) andline_user_audience_ids_idx(GIN onaudience_ids, for fast audience-membership queries). - Foreign keys:
rich_menu_id->rich_menu.id,rich_menu_archive_id->rich_menu_archive.id.organization_idandline_oa_idare logical references and are not declared as FK constraints in Prisma. custom_attributeis a key-value JSON object, e.g.{"member_tier":"gold","birth_month":"05"}. The allowed keys and their data types are defined per channel in theattribute_mastertable. The default is an empty object.audience_idsis a JSON array of audience ids refreshed whenever audiences are recalculated. The GIN index makes it possible to find an audience's members without joining a link table.- The
last_activity_*columns power behavioural segments, such as "friends with no activity for more than N days".