LINE Official Account Manager
⚠️ CRITICAL: Always use profile:"openclaw" (isolated browser) for all browser actions. Never use Chrome relay. Keep the same targetId across operations to avoid losing the tab.
⚠️ CONTEXT Management:
- Snapshot results are large. Do NOT repeat them in thinking.
- Extract needed info and process immediately. Do not re-describe the entire snapshot.
- Preferred approach: Use
snapshot refs:"aria" compact:true to find element refs, then act + click/type with ref.
- Avoid: Hard-coded
evaluate with textContent.includes() — unreliable due to DOM timing and structure variations.
⚠️ AUTO-LOGIN SCRIPTS:
auto-login.mjs is a reference implementation (not directly executable by agents)
login-flow.md is the agent-executable version (use this for automation)
- Why separate? Agents use browser tool calls, not Node module imports
Configuration
Before first use, check if config.json exists:
read file_path:"skills/line-oa/config.json"
⚠️ PATH RULE: Always use workspace-relative paths starting from skills/line-oa/. Never use ../ or absolute paths starting with /.
If missing, help the user run the following command to start the setup wizard:
cd skills/line-oa
node scripts/setup.js
Enter LINE OA Manager
This is the first step for all operations below.
Check and start browser service:
browser action:"status"
If "running": false, start the browser service:
browser action:"start" profile:"openclaw"
Wait 2-3 seconds for the service to initialize.
Read config to get chatUrl:
read file_path:"skills/line-oa/config.json"
Extract chatUrl from the JSON (e.g., https://chat.line.biz/U1234567890abcdef1234567890abcdef/).
Open browser:
browser action:"open" profile:"openclaw" targetUrl:"<chatUrl>"
Capture targetId and url from response.
Wait for page load:
browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"wait","timeMs":2000}
Check current URL:
browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
Key result: If the current URL matches chatUrl, you have successfully logged in! Go to step 5, else proceed to troubleshooting.
Troubleshooting
If you see the login page (the URL redirects to account.line.biz), use these automation scripts:
a. Click LINE Account button:
read file_path:"skills/line-oa/scripts/click-line-account.js"
Execute the script directly:
browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
Wait 2 seconds.
b. Click Login button:
read file_path:"skills/line-oa/scripts/click-login.js"
Execute the script directly:
browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
Wait 3 seconds.
c. Reload chatUrl:
browser action:"navigate" profile:"openclaw" targetId:"<targetId>" targetUrl:"<chatUrl>"
Wait 2 seconds, then take snapshot to verify left-side chat list is visible.
After Check
Proceed with the user's other requests.
Clean Up Browser Tabs:
a. Open a blank tab:
browser action:"open" profile:"openclaw" targetUrl:"about:blank"
b. Get all tabs:
browser action:"tabs" profile:"openclaw"
c. Close all tabs except the newest one (about:blank):
browser action:"close" profile:"openclaw" targetId:"<your_targetId>"
Important: Always clean up tabs after all operations to prevent resource accumulation. The blank tab keeps the browser service running for faster next use.
Quick Check (for cron / automated checks)
Complete flow: login → list chats → report. Follow these steps exactly.
- Read config:
read file_path:"skills/line-oa/config.json" → get chatUrl
- Open browser:
browser action:"open" profile:"openclaw" targetUrl:<chatUrl> → get targetId
- Wait:
browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"wait","timeMs":3000}
- Check URL:
browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
- If URL contains
account.line.biz → go to Troubleshooting section below to login, then come back
- If URL contains
chat.line.biz → continue
- Run this one-liner script as-is, do not modify:
browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"evaluate","fn":"(function(){var r=document.querySelectorAll('.list-group-item-chat');return Array.from(r).map(function(e){var h=e.querySelector('h6');var p=e.querySelector('.text-muted.small');var pt=p?p.textContent.trim():'';var ms=e.querySelectorAll('.text-muted');var t='';for(var i=0;i<ms.length;i++){var v=ms[i].textContent.trim();if(v&&v.length<20&&v!==pt)t=v;}var d=e.querySelector('span.badge.badge-pin');var u=!!d&&getComputedStyle(d).display!=='none';return{name:h?h.textContent.trim():'',time:t,lastMsg:pt.substring(0,100),unread:u};}).filter(function(i){return i.name;});})()"}
⚠️ CHECKPOINT: Did you actually call the browser tool above? If you only thought about it but didn't call it, STOP and call it NOW. You MUST see a tool result before continuing.
- Report: take the first 5 items, format each as:
<name> (<time>) <lastMsg> [未讀] or [已讀] based on unread field. If empty array, say "目前沒有聊天記錄".
- Clean up: open
about:blank, list all tabs, close everything except about:blank.
Check LINE Messages
Extracts all chats from the left-side chat list with unread status. Does NOT require clicking into each chat.
Prerequisites: You must be logged in and on the chat list page (see Login section Step 5 for verification).
Steps
Read the script content:
read file_path:"skills/line-oa/scripts/list-chats.js"
Run the script via browser evaluate:
Pass the script content directly as the fn parameter:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
The script returns a JSON array of all chat items with structure:
[{ name: string, time: string, lastMsg: string, unread: boolean }]
name: customer display name
time: timestamp (e.g., "21:32", "Yesterday", "Friday")
lastMsg: last message preview (~100 chars)
unread: true if green dot present, false otherwise
Get URLs for unread chats (optional but recommended for faster follow-up):
For each unread chat, click into it to get the direct URL, then return to list:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const items=document.querySelectorAll('.list-group-item-chat');const target=Array.from(items).find(el=>{const h6=el.querySelector('h6');return h6&&h6.textContent.includes('<customer_name>');});if(target){const link=target.querySelector('a.d-flex');if(link){link.click();return {clicked:true};}return {linkNotFound:true};}return {itemNotFound:true};}"}
Wait 500ms, then get the URL:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
Navigate back to list:
browser action:"navigate" profile:"openclaw" targetId:"<your_targetId>" targetUrl:"<chatUrl>"
Wait 1 second before processing next unread chat.
Result: Store the chat URL (e.g., https://chat.line.biz/U1234567890abcdef1234567890abcdef/chat/U803dc04f...) alongside the chat info for faster access later.
How to Report Results
- If
unread: true exists: List each unread chat with name, time, preview, and URL (if obtained)
- If no unread: Say "No unread messages at this time"
Notes
- Unread indicator:
span.badge.badge-pin inside each chat list item (green dot)
- Limitation:
lastMsg shows the last message in the thread, which may be an auto-response rather than the customer's original message
- Chat URLs: Getting URLs requires clicking each chat. Do this for unread chats to enable faster replies later.
- To read full messages: See "View Specific Messages" section below
View Specific Messages
Opens any chat (read or unread) and displays its messages. Works for viewing message history, checking context, or preparing to reply.
Prerequisites: You must be logged in and on the chat list page. You should know the customer name (from list-chats.js or user request).
Steps
Find and click the chat item to open messages:
Use evaluate to find the chat item by name (more reliable than snapshot for dynamic chat list):
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const items=document.querySelectorAll('.list-group-item-chat');const target=Array.from(items).find(el=>{const h6=el.querySelector('h6');return h6&&h6.textContent.includes('<customer_name>');});if(target){const link=target.querySelector('a.d-flex');if(link){link.click();return {clicked:true};}return {linkNotFound:true};}return {itemNotFound:true};}"}
Replace <customer_name> with the actual customer name.
Wait for messages panel to load:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
Take a screenshot to view the messages:
browser action:"screenshot" profile:"openclaw" targetId:"<your_targetId>"
The screenshot will show:
- Recent messages in the chat (right panel)
- Customer info and tags (far right panel)
- Auto-response status banner (if active)
Optional: Read recent messages programmatically
If you need structured message data instead of a screenshot, read and run this script:
read file_path:"skills/line-oa/scripts/read-messages.js"
Execute:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
Returns an array of recent messages with:
time: timestamp
text: message content
isCustomer: true if from customer, false if from you
hasImage: true if message contains an image
Navigation Tips
To scroll to earlier messages:
- The messages panel auto-scrolls to the bottom by default
- To see earlier history, use:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const panel=document.querySelector('.conversation-panel, .messages-container, [class*=\"chat-container\"]');if(panel){panel.scrollTo({top:0,behavior:'smooth'});return {scrolled:true};}return {error:'Messages panel not found'};}"}
- Wait 1 second after scrolling, then take another screenshot
Common issues:
- If messages don't load: increase wait time to 3000ms
- If customer name has special characters: use partial match (e.g., "John" instead of "John ⭐️")
- If click fails: the chat might not be visible in the current scroll position of the left panel
Handling Images
When you see images in the screenshot or hasImage: true in message data:
Find and download the image:
function(){
const allPhotoImgs = Array.from(document.querySelectorAll('img[alt="Photo"]'));
const targetImg = allPhotoImgs.find(img => {
const parent = img.closest('.chat');
return parent && !parent.classList.contains('chat-reverse') && parent.innerText.includes('<time>');
});
if (!targetImg) return {error: 'Image not found'};
const parent = targetImg.closest('.chat');
const downloadLink = Array.from(parent.querySelectorAll('a')).find(a => a.textContent.trim() === 'Download');
if (downloadLink) {
downloadLink.click();
return {clicked: true};
}
return {error: 'Download link not found'};
}
Replace <time> with the message timestamp (e.g., "09:11").
Wait and locate downloaded file:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
exec command:"ls -t ~/Downloads/line_oa_chat_*.jpg 2>/dev/null | head -1"
Send to user:
message action:"send" target:"<user>" filePath:"<path>" message:"Customer sent this image"
Note: Downloaded images are named line_oa_chat_YYMMDD_HHMMSS.jpg
Reply to a Message
⚡ Fast Path: If you already have the chat URL from a previous "Check LINE Messages" operation, skip steps 1-2 and go directly to step 3:
browser action:"navigate" profile:"openclaw" targetId:"<your_targetId>" targetUrl:"<chat_url>"
Wait 2 seconds, then proceed to step 3.
Standard Path (when you don't have the chat URL):
- Take a snapshot to find the chat item:
browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
- Click a chat item link in the left panel (e.g.,
ref:"e68"):browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e68"}
- If the input box is locked (auto-response mode), click the manual chat toggle button in the top banner to unlock it.
- Take another snapshot to find the input box and send button.
- Click the text input box (e.g.,
ref:"e509"):browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e509"}
- Type the reply message:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"type","ref":"e509","text":"Hello! I'm Emma, happy to help you!"}
- Click the green Send button (e.g.,
ref:"e522") or press Enter:browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e522"}
Manage Notes
Each chat has a Notes panel on the right side. Notes are internal-only (not visible to customers). Max 300 characters per note.
Add a note
- Open the conversation.
- Click the + button next to the Notes heading in the right panel.
- Type content in the textarea.
- Click Save.
Edit a note
- Find the note in the right panel.
- Click the pencil icon at the note's bottom-right corner.
- Modify the textarea content.
- Click Save.
Delete a note
- Click the trash icon at the note's bottom-right corner.
- A confirmation dialog appears — click Delete to confirm.
Manage Tags
Tags are shown in the right panel below the user's name. They are predefined labels for categorizing chats.
Add a tag
- Open the conversation.
- Click the Add tags link (or the pencil icon next to existing tags) in the right panel.
- The Edit tags modal opens, showing an input field and all available tags.
- Click a tag from the "All tags" list to select it (it moves to the input field).
- Click Save.
Remove a tag
- Open the Edit tags modal (same as above).
- Click the × next to the tag in the input field to deselect it.
- Click Save.
Switch Account
LINE OA Manager can manage multiple official accounts. Switch between them using the account dropdown in the top-left corner.
- Take a snapshot to find the account selector:
browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
- Click the account combobox (shows current account name):
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e11"}
- Wait for the dropdown menu to appear:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":1000}
- Take another snapshot to see available accounts in the listbox:
browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
The snapshot will show a list of accounts you have access to. Look for generic items in the listbox (each account will have a name and "Administrator" or role label).
- Click the desired account item (e.g.,
ref:"e589"):browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e589"}
- Wait for the page to load the new account's chat list:
browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
Notes
- LINE periodically expires sessions; re-login required when that happens
- Session is usually active for several hours if the browser remains open
1---
2name: line-oa
3description: Operate LINE Official Account Manager (chat.line.biz) via browser automation. Use when asked to check LINE messages, reply to LINE customers, or manage LINE OA chat interface.
4metadata:
5 source: https://skillmd.com/skills/modbender/line-oa
6---
7
8# LINE Official Account Manager
9
10⚠️ **CRITICAL**: Always use `profile:"openclaw"` (isolated browser) for all browser actions. Never use Chrome relay. Keep the same `targetId` across operations to avoid losing the tab.
11
12⚠️ **CONTEXT Management**:
13- Snapshot results are large. Do NOT repeat them in thinking.
14- Extract needed info and process immediately. Do not re-describe the entire snapshot.
15- **Preferred approach**: Use `snapshot refs:"aria" compact:true` to find element refs, then `act` + `click`/`type` with ref.
16- **Avoid**: Hard-coded `evaluate` with `textContent.includes()` — unreliable due to DOM timing and structure variations.
17
18⚠️ **AUTO-LOGIN SCRIPTS**:
19- `auto-login.mjs` is a **reference implementation** (not directly executable by agents)
20- `login-flow.md` is the **agent-executable version** (use this for automation)
21- **Why separate?** Agents use browser tool calls, not Node module imports
22
23## Configuration
24
25Before first use, check if `config.json` exists:
26```
27read file_path:"skills/line-oa/config.json"
28```
29
30⚠️ **PATH RULE**: Always use workspace-relative paths starting from `skills/line-oa/`. Never use `../` or absolute paths starting with `/`.
31
32If missing, help the user run the following command to start the setup wizard:
33```bash
34cd skills/line-oa
35node scripts/setup.js
36```
37
38# Enter LINE OA Manager
39This is the first step for all operations below.
40
411. **Check and start browser service:**
42 ```
43 browser action:"status"
44 ```
45 If `"running": false`, start the browser service:
46 ```
47 browser action:"start" profile:"openclaw"
48 ```
49 Wait 2-3 seconds for the service to initialize.
50
512. **Read config to get chatUrl:**
52 ```
53 read file_path:"skills/line-oa/config.json"
54 ```
55 Extract `chatUrl` from the JSON (e.g., `https://chat.line.biz/U1234567890abcdef1234567890abcdef/`).
56
572. **Open browser:**
58 ```
59 browser action:"open" profile:"openclaw" targetUrl:"<chatUrl>"
60 ```
61 Capture `targetId` and `url` from response.
62
633. **Wait for page load:**
64 ```
65 browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"wait","timeMs":2000}
66 ```
67
684. **Check current URL:**
69 ```
70 browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
71 ```
72
73 Key result: If the current URL matches `chatUrl`, you have successfully logged in! Go to step 5, else proceed to troubleshooting.
74
75 ### Troubleshooting
76 If you see the login page (the URL redirects to `account.line.biz`), use these automation scripts:
77
78 a. **Click LINE Account button:**
79 ```
80 read file_path:"skills/line-oa/scripts/click-line-account.js"
81 ```
82 Execute the script directly:
83 ```
84 browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
85 ```
86 Wait 2 seconds.
87
88 b. **Click Login button:**
89 ```
90 read file_path:"skills/line-oa/scripts/click-login.js"
91 ```
92 Execute the script directly:
93 ```
94 browser action:"act" profile:"openclaw" targetId:"<targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
95 ```
96 Wait 3 seconds.
97
98 c. **Reload chatUrl:**
99 ```
100 browser action:"navigate" profile:"openclaw" targetId:"<targetId>" targetUrl:"<chatUrl>"
101 ```
102 Wait 2 seconds, then take snapshot to verify left-side chat list is visible.
103
104 ### After Check
105
1065. **Proceed with the user's other requests.**
1076. **Clean Up Browser Tabs**:
108
109 a. Open a blank tab:
110 ```
111 browser action:"open" profile:"openclaw" targetUrl:"about:blank"
112 ```
113
114 b. Get all tabs:
115 ```
116 browser action:"tabs" profile:"openclaw"
117 ```
118
119 c. Close all tabs except the newest one (about:blank):
120 ```
121 browser action:"close" profile:"openclaw" targetId:"<your_targetId>"
122 ```
123
124 **Important**: Always clean up tabs after all operations to prevent resource accumulation. The blank tab keeps the browser service running for faster next use.
125
126## Quick Check (for cron / automated checks)
127
128Complete flow: login → list chats → report. Follow these steps exactly.
129
1301. Read config: `read file_path:"skills/line-oa/config.json"` → get `chatUrl`
1312. Open browser: `browser action:"open" profile:"openclaw" targetUrl:<chatUrl>` → get `targetId`
1323. Wait: `browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"wait","timeMs":3000}`
1334. Check URL: `browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}`
134 - If URL contains `account.line.biz` → go to **Troubleshooting** section below to login, then come back
135 - If URL contains `chat.line.biz` → continue
1365. Run this one-liner script **as-is, do not modify**:
137 ```
138 browser action:"act" profile:"openclaw" targetId:<targetId> request:{"kind":"evaluate","fn":"(function(){var r=document.querySelectorAll('.list-group-item-chat');return Array.from(r).map(function(e){var h=e.querySelector('h6');var p=e.querySelector('.text-muted.small');var pt=p?p.textContent.trim():'';var ms=e.querySelectorAll('.text-muted');var t='';for(var i=0;i<ms.length;i++){var v=ms[i].textContent.trim();if(v&&v.length<20&&v!==pt)t=v;}var d=e.querySelector('span.badge.badge-pin');var u=!!d&&getComputedStyle(d).display!=='none';return{name:h?h.textContent.trim():'',time:t,lastMsg:pt.substring(0,100),unread:u};}).filter(function(i){return i.name;});})()"}
139 ```
140 ⚠️ **CHECKPOINT**: Did you actually call the browser tool above? If you only thought about it but didn't call it, STOP and call it NOW. You MUST see a tool result before continuing.
1416. Report: take the first 5 items, format each as: `<name> (<time>) <lastMsg> [未讀]` or `[已讀]` based on `unread` field. If empty array, say "目前沒有聊天記錄".
1427. Clean up: open `about:blank`, list all tabs, close everything except `about:blank`.
143
144---
145
146## Check LINE Messages
147
148Extracts all chats from the left-side chat list with unread status. Does NOT require clicking into each chat.
149
150**Prerequisites**: You must be logged in and on the chat list page (see Login section Step 5 for verification).
151
152### Steps
153
1541. Read the script content:
155 ```
156 read file_path:"skills/line-oa/scripts/list-chats.js"
157 ```
1582. Run the script via browser evaluate:
159
160 Pass the script content directly as the `fn` parameter:
161 ```
162 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
163 ```
164
1653. The script returns a JSON array of **all** chat items with structure:
166 ```
167 [{ name: string, time: string, lastMsg: string, unread: boolean }]
168 ```
169 - `name`: customer display name
170 - `time`: timestamp (e.g., "21:32", "Yesterday", "Friday")
171 - `lastMsg`: last message preview (~100 chars)
172 - `unread`: `true` if green dot present, `false` otherwise
173
1744. **Get URLs for unread chats** (optional but recommended for faster follow-up):
175
176 For each unread chat, click into it to get the direct URL, then return to list:
177 ```
178 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const items=document.querySelectorAll('.list-group-item-chat');const target=Array.from(items).find(el=>{const h6=el.querySelector('h6');return h6&&h6.textContent.includes('<customer_name>');});if(target){const link=target.querySelector('a.d-flex');if(link){link.click();return {clicked:true};}return {linkNotFound:true};}return {itemNotFound:true};}"}
179 ```
180
181 Wait 500ms, then get the URL:
182 ```
183 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
184 ```
185
186 Navigate back to list:
187 ```
188 browser action:"navigate" profile:"openclaw" targetId:"<your_targetId>" targetUrl:"<chatUrl>"
189 ```
190
191 Wait 1 second before processing next unread chat.
192
193 **Result**: Store the chat URL (e.g., `https://chat.line.biz/U1234567890abcdef1234567890abcdef/chat/U803dc04f...`) alongside the chat info for faster access later.
194
195### How to Report Results
196
197- **If `unread: true` exists**: List each unread chat with name, time, preview, and URL (if obtained)
198- **If no unread**: Say "No unread messages at this time"
199
200### Notes
201
202- **Unread indicator**: `span.badge.badge-pin` inside each chat list item (green dot)
203- **Limitation**: `lastMsg` shows the last message in the thread, which may be an auto-response rather than the customer's original message
204- **Chat URLs**: Getting URLs requires clicking each chat. Do this for unread chats to enable faster replies later.
205- **To read full messages**: See "View Specific Messages" section below
206
207## View Specific Messages
208
209Opens any chat (read or unread) and displays its messages. Works for viewing message history, checking context, or preparing to reply.
210
211**Prerequisites**: You must be logged in and on the chat list page. You should know the customer name (from `list-chats.js` or user request).
212
213### Steps
214
2151. **Find and click the chat item** to open messages:
216
217 Use evaluate to find the chat item by name (more reliable than snapshot for dynamic chat list):
218 ```
219 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const items=document.querySelectorAll('.list-group-item-chat');const target=Array.from(items).find(el=>{const h6=el.querySelector('h6');return h6&&h6.textContent.includes('<customer_name>');});if(target){const link=target.querySelector('a.d-flex');if(link){link.click();return {clicked:true};}return {linkNotFound:true};}return {itemNotFound:true};}"}
220 ```
221 Replace `<customer_name>` with the actual customer name.
222
2232. **Wait for messages panel to load:**
224 ```
225 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
226 ```
227
2283. **Take a screenshot to view the messages:**
229 ```
230 browser action:"screenshot" profile:"openclaw" targetId:"<your_targetId>"
231 ```
232
233 The screenshot will show:
234 - Recent messages in the chat (right panel)
235 - Customer info and tags (far right panel)
236 - Auto-response status banner (if active)
237
2384. **Optional: Read recent messages programmatically**
239
240 If you need structured message data instead of a screenshot, read and run this script:
241 ```
242 read file_path:"skills/line-oa/scripts/read-messages.js"
243 ```
244 Execute:
245 ```
246 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"<script_content>"}
247 ```
248
249 Returns an array of recent messages with:
250 - `time`: timestamp
251 - `text`: message content
252 - `isCustomer`: true if from customer, false if from you
253 - `hasImage`: true if message contains an image
254
255### Navigation Tips
256
257**To scroll to earlier messages:**
258- The messages panel auto-scrolls to the bottom by default
259- To see earlier history, use:
260 ```
261 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"evaluate","fn":"function(){const panel=document.querySelector('.conversation-panel, .messages-container, [class*=\"chat-container\"]');if(panel){panel.scrollTo({top:0,behavior:'smooth'});return {scrolled:true};}return {error:'Messages panel not found'};}"}
262 ```
263- Wait 1 second after scrolling, then take another screenshot
264
265**Common issues:**
266- If messages don't load: increase wait time to 3000ms
267- If customer name has special characters: use partial match (e.g., "John" instead of "John ⭐️")
268- If click fails: the chat might not be visible in the current scroll position of the left panel
269
270### Handling Images
271
272When you see images in the screenshot or `hasImage: true` in message data:
273
2741. **Find and download the image:**
275 ```javascript
276 function(){
277 const allPhotoImgs = Array.from(document.querySelectorAll('img[alt="Photo"]'));
278 const targetImg = allPhotoImgs.find(img => {
279 const parent = img.closest('.chat');
280 return parent && !parent.classList.contains('chat-reverse') && parent.innerText.includes('<time>');
281 });
282
283 if (!targetImg) return {error: 'Image not found'};
284
285 const parent = targetImg.closest('.chat');
286 const downloadLink = Array.from(parent.querySelectorAll('a')).find(a => a.textContent.trim() === 'Download');
287
288 if (downloadLink) {
289 downloadLink.click();
290 return {clicked: true};
291 }
292 return {error: 'Download link not found'};
293 }
294 ```
295 Replace `<time>` with the message timestamp (e.g., "09:11").
296
2972. **Wait and locate downloaded file:**
298 ```
299 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
300 ```
301 ```
302 exec command:"ls -t ~/Downloads/line_oa_chat_*.jpg 2>/dev/null | head -1"
303 ```
304
3053. **Send to user:**
306 ```
307 message action:"send" target:"<user>" filePath:"<path>" message:"Customer sent this image"
308 ```
309
310**Note:** Downloaded images are named `line_oa_chat_YYMMDD_HHMMSS.jpg`
311
312## Reply to a Message
313
314**⚡ Fast Path**: If you already have the chat URL from a previous "Check LINE Messages" operation, skip steps 1-2 and go directly to step 3:
315```
316browser action:"navigate" profile:"openclaw" targetId:"<your_targetId>" targetUrl:"<chat_url>"
317```
318Wait 2 seconds, then proceed to step 3.
319
320**Standard Path** (when you don't have the chat URL):
321
3221. Take a snapshot to find the chat item:
323 ```
324 browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
325 ```
3262. Click a chat item link in the left panel (e.g., `ref:"e68"`):
327 ```
328 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e68"}
329 ```
3303. If the input box is locked (auto-response mode), click the manual chat toggle button in the top banner to unlock it.
3314. Take another snapshot to find the input box and send button.
3325. Click the text input box (e.g., `ref:"e509"`):
333 ```
334 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e509"}
335 ```
3366. Type the reply message:
337 ```
338 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"type","ref":"e509","text":"Hello! I'm Emma, happy to help you!"}
339 ```
3407. Click the green **Send** button (e.g., `ref:"e522"`) or press Enter:
341 ```
342 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e522"}
343 ```
344
345## Manage Notes
346
347Each chat has a Notes panel on the right side. Notes are internal-only (not visible to customers). Max 300 characters per note.
348
349### Add a note
3501. Open the conversation.
3512. Click the **+** button next to the Notes heading in the right panel.
3523. Type content in the textarea.
3534. Click **Save**.
354
355### Edit a note
3561. Find the note in the right panel.
3572. Click the pencil icon at the note's bottom-right corner.
3583. Modify the textarea content.
3594. Click **Save**.
360
361### Delete a note
3621. Click the trash icon at the note's bottom-right corner.
3632. A confirmation dialog appears — click **Delete** to confirm.
364
365## Manage Tags
366
367Tags are shown in the right panel below the user's name. They are predefined labels for categorizing chats.
368
369### Add a tag
3701. Open the conversation.
3712. Click the **Add tags** link (or the pencil icon next to existing tags) in the right panel.
3723. The Edit tags modal opens, showing an input field and all available tags.
3734. Click a tag from the "All tags" list to select it (it moves to the input field).
3745. Click **Save**.
375
376### Remove a tag
3771. Open the Edit tags modal (same as above).
3782. Click the **×** next to the tag in the input field to deselect it.
3793. Click **Save**.
380
381## Switch Account
382
383LINE OA Manager can manage multiple official accounts. Switch between them using the account dropdown in the top-left corner.
384
3851. Take a snapshot to find the account selector:
386 ```
387 browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
388 ```
3892. Click the account combobox (shows current account name):
390 ```
391 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e11"}
392 ```
3933. Wait for the dropdown menu to appear:
394 ```
395 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":1000}
396 ```
3974. Take another snapshot to see available accounts in the listbox:
398 ```
399 browser action:"snapshot" profile:"openclaw" targetId:"<your_targetId>" refs:"aria"
400 ```
401 The snapshot will show a list of accounts you have access to. Look for generic items in the listbox (each account will have a name and "Administrator" or role label).
4025. Click the desired account item (e.g., `ref:"e589"`):
403 ```
404 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"click","ref":"e589"}
405 ```
4066. Wait for the page to load the new account's chat list:
407 ```
408 browser action:"act" profile:"openclaw" targetId:"<your_targetId>" request:{"kind":"wait","timeMs":2000}
409 ```
410
411## Notes
412
413- LINE periodically expires sessions; re-login required when that happens
414- Session is usually active for several hours if the browser remains open