Skip to main content

Quick Reply

Overview

Quick Reply is a set of option buttons rendered above the keyboard in a LINE chat, letting users tap a choice instead of typing. This module acts as a central library for the button sets an organisation has authored, so they can be attached to messages from several places.

It is a module written fresh for the Go implementation with no NestJS predecessor. Its structure follows existing lightweight modules such as Content Category and Template Message. What sets it apart is the references endpoint, which reports where a button set is currently in use before anyone deletes it.

Business Flow

  1. GET /api/quick-reply lists button sets with pagination, scoped to the user's lineOaId. Every query specifies deleted_date IS NULL explicitly, because the entity does not use gorm.DeletedAt.
  2. POST /api/quick-reply creates a new set, taking a set name plus the list of buttons and the action attached to each one.
  3. GET /api/quick-reply/:id returns the details. An id that does not exist, or that belongs to a different OA, returns httpx.NotFound rather than an empty result.
  4. GET /api/quick-reply/:id/references reports where the set is referenced, so the UI can warn about the impact before deletion.
  5. PUT /api/quick-reply/:id updates a set.
  6. DELETE /api/quick-reply/:id performs a soft delete by stamping the deleted_date column.
  7. When a message is actually sent, the selected button set is attached to the payload delivered to LINE.

Key Files & Functions

Core code lives in internal/modules/quickreply/, comprising controller.go, service.go, and dto.go.

MethodRouteHandlerPolicy (metadata)
GET/api/quick-replyct.listreadAll quick-reply
POST/api/quick-replyct.createcreate quick-reply
GET/api/quick-reply/:idct.getread quick-reply
GET/api/quick-reply/:id/referencesct.referencesread quick-reply
PUT/api/quick-reply/:idct.updateupdate quick-reply
DELETE/api/quick-reply/:idct.deletedelete quick-reply

Routes are registered on the authed group, which applies global JWT authentication; no ModuleGate wraps them.

Connections to Other Services

  • Access control — requests must pass global JwtAuth and the token must carry a lineOaId. The PolicyModuleQuickReply = "quick-reply" enum is aligned with cms-web's MODULE_URL.QUICK_REPLY so policy enforcement can be switched on later without renaming.
  • Tablesquick_reply, which uses a plain deleted_date soft-delete column rather than gorm.DeletedAt.
  • Context — reads lineOaId from CLS to scope every query.
  • Design specdocs/superpowers/specs/2026-07-25-quick-reply-design.md
  • Related modules — Auto Response, Rich Message, and Workflow.