LINE Friend Management (LINE User)
Overview
line_user is the follower database for each LINE OA, and it is the foundation everything else
rests on — audiences, campaigns, reports, and triggers all query this table.
The module provides tools for searching friends, viewing individual records, inspecting a person's GA journey, syncing followers from LINE, importing friends from CSV, and editing custom attributes and profiles on a per-person basis.
Business Flow
Search and detail
GET /api/line-users/searchperforms a paginated search driven byFilterGetLineUserDto, supporting queries by name, follow status, tag, and custom attributes, scoped to thelineOaIdin CLS.GET /api/line-users/:idreturns a single friend's details: profile, attributes, and history.GET /api/line-users/:id/ga-journey?days=30retrieves the tracked usage path recorded in GA, defaulting to 30 days, for analysing individual behaviour.
Syncing from LINE
POST /api/line-users/sync-follower-usersrequests a full follower pull from LINE by publishing a job to the RabbitMQ queueline_sync_follower_userfor a worker to process in the background.GET /api/line-users/last-synced-follower-users-statuslets cms-web poll the status of the most recent sync run.
Importing from CSV
POST /api/line-users/import-all-friendsaccepts multipart/form-data for uploading a CSV of friends. The file is stored in object storage, rows are created inline_user_importandline_user_import_detail, and a job is published to theline_import_csv_userqueue for a worker to process.- Past import results can be reviewed at
GET /api/report/import-history.
Editing individual records
PUT /api/line-users/:id/custom-attributeupdates custom attribute values, whose schema comes from the attribute master module.PUT /api/line-users/:id/profileupdates the profile stored on our side.
Key Files & Functions
The code lives in internal/modules/lineuser/, consisting of controller.go, service.go,
repository.go, csv.go, gajourney.go, lineoa.go, dto.go, and module.go.
All routes are registered on authed.Group("/line-users").
| Method | Route | Handler | Policy (metadata) |
|---|---|---|---|
| GET | /api/line-users/search | svc.searchHandler | readAll line-user |
| GET | /api/line-users/last-synced-follower-users-status | svc.lastSyncedFollowerUsersStatusHandler | read line-user |
| GET | /api/line-users/:id | svc.getLineUserDetailHandler | read line-user |
| GET | /api/line-users/:id/ga-journey | svc.getGaJourneyHandler | read line-user |
| POST | /api/line-users/sync-follower-users | svc.syncFollowerUsersHandler | update line-user |
| POST | /api/line-users/import-all-friends | svc.importLineUsersHandler | create line-user |
| PUT | /api/line-users/:id/custom-attribute | svc.updateCustomAttributeHandler | update line-user |
| PUT | /api/line-users/:id/profile | svc.updateProfileHandler | update line-user |
Cross-module entry point: the report module reuses the lineuser service so both share the same
query builder.
Connections to Other Services
- Permissions — policy metadata
PolicyModuleLineUser; because the routes sit on theauthedgroup, the token must already carry alineOaId. - Tables —
line_user,line_user_import,line_user_import_detail,tracking_line_users,attribute_master,line_oa - RabbitMQ — the
line_sync_follower_userandline_import_csv_userqueues - Storage — CSV uploads go to MinIO/S3
- External — the LINE Messaging API for follower ids and profiles, and Google Analytics for the GA journey
- Consumers of this data — audience management, campaign management, the all-friend listing report, import mapping, and the dashboard