Skip to main content

Message Library (Rich/Template/Quick Reply)

Overview

This domain has three tables: rich_message (message content sent by campaigns and auto-responses, supporting text, image, tappable image and flex message), template_message (ready-made messages built from a showcase template), and quick_reply (sets of quick reply buttons that can be attached to a message).

Table rich_message

ColumnTypeNullableDefaultDescription
idSERIAL (INTEGER)NOnextval(...)Primary key of the message
titleTEXTNO-Message name used for reference inside the system
contentJSONBNO-Message body as JSON, shaped according to type
line_oa_idINTEGERNO-Owning LINE OA (FK to line_oa.id)
type"RichMessageType"NO-Message kind: text, image, tappable_image, flex_message
quick_reply_idUUIDYES-Quick reply set attached to this message (refers to quick_reply.id)
status"CommonStatus"NO-Message status (active, inactive, draft, ...)
created_dateTIMESTAMPTZ(3)NOnow()Creation timestamp
created_byINTEGERNO0User who created the record
updated_dateTIMESTAMPTZ(3)YES-Last update timestamp (maintained automatically)
updated_byINTEGERYES0User who last updated the record
deleted_dateTIMESTAMPTZ(3)YES-Soft-delete timestamp

Table template_message

ColumnTypeNullableDefaultDescription
idUUIDNOgen_random_uuid()Primary key of the template message
organization_idINTEGERNO0Owning organization
line_oa_idINTEGERNO-Owning LINE OA (FK to line_oa.id)
titleTEXTNO-Template message name
template_message_showcase_idINTEGERNO-Showcase template this record was built from
line_template_messageJSONBYES-Send-ready message structure in LINE Messaging API format
form_template_messageJSONBYES-Form data entered in the editor, used to compose line_template_message
status"CommonStatus"NOactiveTemplate status
created_dateTIMESTAMPTZ(3)NOnow()Creation timestamp
created_byINTEGERNO0User who created the record
updated_dateTIMESTAMPTZ(3)YES-Last update timestamp (maintained automatically)
updated_byINTEGERYES0User who last updated the record
deleted_dateTIMESTAMPTZ(3)YES-Soft-delete timestamp

Table quick_reply

ColumnTypeNullableDefaultDescription
idUUIDNOgen_random_uuid()Primary key of the quick reply set
line_oa_idBIGINTNO-Owning LINE OA
organization_idBIGINTNO-Owning organization
nameTEXTNO-Quick reply set name
itemsJSONBNO[]Quick reply buttons (label and action for each button)
statusTEXTNO'active'Usage status of the quick reply set
created_dateTIMESTAMPTZ(3)NOnow()Creation timestamp
created_byBIGINTNO0User who created the record
updated_dateTIMESTAMPTZ(3)YES-Last update timestamp (maintained automatically)
updated_byBIGINTYES-User who last updated the record
deleted_dateTIMESTAMPTZ(3)YES-Soft-delete timestamp

Notes

  • rich_message.line_oa_id and template_message.line_oa_id are FKs to line_oa.id.
  • rich_message is referenced by campaign.rich_message_id and auto_response.rich_message_id.
  • rich_message.quick_reply_id is stored as a UUID and indexed, but is not declared as an FK constraint in the schema (it logically points at quick_reply.id).
  • Key indexes: rich_message on line_oa_id and quick_reply_id; template_message on (line_oa_id, template_message_showcase_id, status) and created_date; quick_reply on (line_oa_id, status) and created_date.
  • quick_reply uses BIGINT for its reference id columns (line_oa_id, organization_id, created_by, updated_by), unlike the other two tables which use INTEGER.