LINE Integration
Overview
Ocriva integrates with LINE — Thailand's most popular messaging platform. The integration covers three distinct features that work together to provide a seamless mobile document processing experience:
- LINE Login — sign in to Ocriva using your LINE account
- LIFF Scanner — scan and upload documents directly from the LINE app camera
- Rich Menu — a branded chatbot menu that gives users instant access to Ocriva features
NOTE
LINE integration is especially useful for Thai users who already use LINE daily. All three features can be used independently — you do not need to use Rich Menu to use LINE Login, and vice versa.
LINE Login
LINE Login lets users sign in to Ocriva using their existing LINE account. No separate password is required and no new account needs to be created.
How It Works
- Click Sign in with LINE on the Ocriva login page
- You are redirected to the LINE authorization page (
https://access.line.me/oauth2/v2.1/authorize) - Grant the requested permissions (profile, email, OpenID)
- LINE redirects back to Ocriva with an authorization code
- Ocriva exchanges the code for tokens at
https://api.line.me/oauth2/v2.1/token - Your LINE profile is linked to your Ocriva account and a JWT session is issued
Permissions Requested
| Permission | Purpose |
|---|---|
profile | Display name and avatar for your Ocriva profile |
email | Account identification and recovery |
openid | Secure, standards-based authentication |
NOTE
Ocriva uses your LINE profile data only for authentication. Ocriva does not post anything to your LINE timeline, read your chats, or contact your LINE friends.
LIFF Scanner (Mobile Document Scanning)
What is LIFF?
LIFF (LINE Front-end Framework) allows web applications to run inside the LINE app browser. Ocriva's scan page (/scan) is deployed as a LIFF app, which gives it access to the LINE camera and LINE authentication — making it possible to scan, upload, and process documents entirely within LINE.
Scanning Flow
- Open the LIFF URL in the LINE app (via Rich Menu, a shared link, or a direct URL)
- The LIFF app initializes and authenticates with LINE automatically
- If you are logged in to LINE but not yet registered with Ocriva, the system auto-registers your account using your LINE profile
- Select the Project you want to file the document under
- Select the Template that matches your document type
- Tap Scan with LINE Camera to open the LINE in-app camera
- Capture your document — try to fill the frame and avoid shadows
- Preview the captured image — tap Retake if the image is unclear
- Tap Upload to send the image to Ocriva for processing
- The document is processed using the selected template
- View extracted results in Processing History
Supported Capture Methods
| Method | When Available |
|---|---|
| LINE Camera | Inside LINE app with LIFF initialized |
| Device Camera | Any mobile browser (automatic fallback) |
WARNING
LINE Camera access requires the page to be opened inside the LINE app. If you open the scan URL in a standard mobile browser, the app automatically falls back to the device camera. All other features (template selection, upload, processing) work the same in both modes.
Template Selection
- You must select a template before scanning
- The template determines what fields are extracted from the document
- You can switch projects and templates between scans without closing the app
- The same templates available on the web upload page are available in the LIFF scanner
TIP
For best scan quality: use good lighting, hold the camera steady, and position the document so it fills most of the frame. Avoid photographing documents on glossy surfaces that cause glare.
Rich Menu
What is a Rich Menu?
A Rich Menu is a custom graphical menu displayed at the bottom of a LINE chat with your organization's bot. It provides large tap targets that link directly to Ocriva features, so users can launch the scanner or open the dashboard with a single tap.
Rich Menu Specifications
| Property | Value |
|---|---|
| Image size | 2400 × 809 pixels |
| Max file size | 1 MB |
| Supported formats | PNG, JPEG |
| Action areas | Configurable tap zones (up to 6 areas) |
What a Rich Menu Typically Contains
- Scan Document — opens the LIFF scanner page
- Dashboard — opens the Ocriva web dashboard
- Processing History — opens the results page
Setting Up Rich Menu
Rich Menu configuration is handled by your system administrator via the LINE Messaging API. The LineService in the Ocriva backend manages Rich Menu CRUD operations. Setup requires:
- A LINE Messaging API channel (separate from the LINE Login channel)
MESSAGE_CHANNEL_IDandMESSAGE_CHANNEL_SECRETcredentials configured in the environment- A correctly sized Rich Menu image (2400 × 809 px, < 1 MB)
- Defined action areas pointing to your LIFF URL and web dashboard
IMPORTANT
LINE Login and Rich Menu use different LINE channels. LINE Login requires a LINE Login channel, while Rich Menu requires a Messaging API channel. Both must be created separately in the LINE Developers Console.
Environment Setup (for Administrators)
Required Environment Variables
| Variable | Purpose |
|---|---|
LINE_CLIENT_ID | LINE Login channel ID (from LINE Developers Console) |
LINE_CLIENT_SECRET | LINE Login channel secret |
LINE_CALLBACK_URL | OAuth2 callback URL (e.g., https://your-domain.com/auth/line/callback) |
NEXT_PUBLIC_LIFF_ID | LIFF application ID (configured on the web frontend) |
MESSAGE_CHANNEL_ID | Messaging API channel ID (for Rich Menu) |
MESSAGE_CHANNEL_SECRET | Messaging API channel secret (for Rich Menu) |
LINE Developer Console Setup
- Go to LINE Developers Console and create or select a provider
- Create a LINE Login channel — copy the Channel ID and Channel Secret into
LINE_CLIENT_IDandLINE_CLIENT_SECRET - Set the Callback URL in the channel settings to match
LINE_CALLBACK_URL - Under the LINE Login channel, create a LIFF app — set the endpoint URL to your
/scanpage URL, and copy the LIFF ID intoNEXT_PUBLIC_LIFF_ID - Create a Messaging API channel (separate from the Login channel) — copy its Channel ID and Channel Secret into
MESSAGE_CHANNEL_IDandMESSAGE_CHANNEL_SECRET - Design and upload your Rich Menu image via the LINE Official Account Manager or the Messaging API
NOTE
The NEXT_PUBLIC_LIFF_ID variable is used by the Next.js frontend. It must be prefixed with NEXT_PUBLIC_ so it is available in the browser bundle.
Use Cases
Field Document Scanning
- Sales teams capture receipts and invoices on the go without visiting the office
- Delivery drivers scan package labels and consignment notes at the point of delivery
- Field inspectors photograph completed inspection forms and checklists
Customer Self-Service via LINE
- Customers photograph their own documents (ID cards, invoices, forms) directly in the LINE chat
- Rich Menu guides them to the scanner without needing to know a URL
- Documents are processed automatically and results are available immediately
Mobile-First Workflows
- No desktop or laptop required — the entire scan → process → review workflow runs on a smartphone
- Teams in the field can submit documents in real time, while back-office staff review results in the web dashboard
TIP
Combine LINE scanning with Batch upload on desktop. Field workers scan individual documents via LINE throughout the day, while back-office staff upload bulk document sets from the web interface. Both flows feed into the same Processing History and can be filtered by project.
Summary of Integration Points
| Feature | Channel Type | Key Env Vars |
|---|---|---|
| LINE Login | LINE Login channel | LINE_CLIENT_ID, LINE_CLIENT_SECRET, LINE_CALLBACK_URL |
| LIFF Scanner | LIFF app (under Login channel) | NEXT_PUBLIC_LIFF_ID |
| Rich Menu | Messaging API channel | MESSAGE_CHANNEL_ID, MESSAGE_CHANNEL_SECRET |
