Skip to main content

Customer Attribute Definitions (Attribute Master)

Overview

Attribute Master is where custom LINE user attributes are defined, per LINE OA — things like membership tier, date of birth, or preferred branch. It acts as the schema that tells the system what each attribute is called, what type of data it holds, whether it can be used to filter audiences, and whether it can appear in reports.

Attributes defined here surface throughout the platform: as target fields for Import Mapping, as merge tags in Template Message, as conditions in Audience Filter, and as columns in the all-friends report.

The standout feature is JSON schema import — paste in a sample JSON document and the system parses it into a set of attributes at once, rather than defining each one by hand.

Business Flow

  1. ListGET /api/attribute-master returns all attributes, paginated and filterable via AttributeMasterQueryParamDto.
  2. Filterable subsetGET /api/attribute-master/filterable returns only the attributes usable as audience filter conditions; the Audience Filter UI relies on this.
  3. Reportable subsetGET /api/attribute-master/reportable returns only the attributes that can appear as report columns; the report UI relies on this.
  4. CreatePOST /api/attribute-master creates a new attribute, always checking the plan's maxAttributes quota first.
  5. Parse JSON into attributesPOST /api/attribute-master/parse-json accepts a body containing a json field and an optional rootPath, and returns a preview of the attributes that would be produced without persisting anything.
  6. Confirm importPOST /api/attribute-master/import-json creates the whole set of attributes from the previewed schema in one operation.
  7. View and editGET /api/attribute-master/:id and PUT /api/attribute-master/:id.
  8. Check before deleting — always call GET /api/attribute-master/:id/check-attribute-usage?attributeKey=... first. It reports everywhere the attribute is currently used — audiences, reports, forms and import mappings — so that deleting it does not silently break other features.
  9. DeleteDELETE /api/attribute-master/:id.

Key Files & Functions

The code lives in internal/modules/attributemaster/, comprising controller.go, service.go, parser.go, ordered.go, time.go, dto.go and module.go.

  • parser.go converts a JSON schema into a set of attributes
  • ordered.go preserves key order so the JSON output matches the legacy system

All routes are registered on authed.Group("/attribute-master") and wrapped in modulegate.ModuleGate(d, "attribute-master").

MethodRouteHandlerPolicy
GET/api/attribute-mastersvc.getListHandlerreadAll attribute-master
GET/api/attribute-master/filterablesvc.getFilterableHandlerread attribute-master
GET/api/attribute-master/reportablesvc.getReportableHandlerread attribute-master
GET/api/attribute-master/:id/check-attribute-usagesvc.checkAttributeUsageHandlerread attribute-master
GET/api/attribute-master/:idsvc.getByIDHandlerread attribute-master
POST/api/attribute-mastersvc.createHandlercreate attribute-master
POST/api/attribute-master/import-jsonsvc.importJsonHandlercreate attribute-master
POST/api/attribute-master/parse-jsonsvc.parseJsonHandlerread attribute-master
PUT/api/attribute-master/:idsvc.updateHandlerupdate attribute-master
DELETE/api/attribute-master/:idsvc.deleteHandlerdelete attribute-master

Connections to Other Services

  • Permissions — requires ModuleGate("attribute-master") and carries PolicyModuleAttributeMaster as metadata.
  • Tablesattribute_master, line_user (its custom attribute payload), audience, form_builder, import_mapping_job and template_message.
  • Cross-module — calls Plan Limits to enforce the maxAttributes quota.
  • Error handlingthrowInstanceofError passes 401, 404, 400 and 409 responses through unchanged; anything else becomes a 500 with the APP_000 code.
  • Related modules — System Attribute (system-level attributes), LINE User Management, Audience Filter, Template Message, All Friend Listing and Import Mapping.