⚠️ 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 refs:"aria" compact:true to find element refs, then act + click/type with ref.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)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
This is the first step for all operations below.
```
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 file_path:"skills/line-oa/config.json"
```
Extract chatUrl from the JSON (e.g., https://chat.line.biz/U1234567890abcdef1234567890abcdef/).
```
browser action:"open" profile:"openclaw" targetUrl:"
```
Capture targetId and url from response.
```
browser action:"act" profile:"openclaw" targetId:"
```
```
browser action:"act" profile:"openclaw" targetId:"
```
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:"
```
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:"
```
Wait 3 seconds.
c. Reload chatUrl:
```
browser action:"navigate" profile:"openclaw" targetId:"
```
Wait 2 seconds, then take snapshot to verify left-side chat list is visible.
### After Check
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:"
```
Important: Always clean up tabs after all operations to prevent resource accumulation. The blank tab keeps the browser service running for faster next use.
Complete flow: login → list chats → report. Follow these steps exactly.
read file_path:"skills/line-oa/config.json" → get chatUrlbrowser action:"open" profile:"openclaw" targetUrl: → get targetIdbrowser action:"act" profile:"openclaw" targetId: request:{"kind":"wait","timeMs":3000} browser action:"act" profile:"openclaw" targetId: request:{"kind":"evaluate","fn":"function(){return window.location.href;}"} account.line.biz → go to Troubleshooting section below to login, then come backchat.line.biz → continue```
browser action:"act" profile:"openclaw" targetId: ``` ⚠️ 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. 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). ``` read file_path:"skills/line-oa/scripts/list-chats.js" ``` Pass the script content directly as the ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` [{ name: string, time: string, lastMsg: string, unread: boolean }] ``` For each unread chat, click into it to get the direct URL, then return to list: ``` browser action:"act" profile:"openclaw" targetId:" ``` Wait 500ms, then get the URL: ``` browser action:"act" profile:"openclaw" targetId:" ``` Navigate back to list: ``` browser action:"navigate" profile:"openclaw" targetId:" ``` Wait 1 second before processing next unread chat. Result: Store the chat URL (e.g., 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 Use evaluate to find the chat item by name (more reliable than snapshot for dynamic chat list): ``` browser action:"act" profile:"openclaw" targetId:" ``` Replace ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"screenshot" profile:"openclaw" targetId:" ``` The screenshot will show: 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:" ``` Returns an array of recent messages with: To scroll to earlier messages: ``` browser action:"act" profile:"openclaw" targetId:" ``` Common issues: When you see images in the screenshot or ```javascript 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(' }); 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 ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` exec command:"ls -t ~/Downloads/line_oa_chat_*.jpg 2>/dev/null | head -1" ``` ``` message action:"send" target:" ``` Note: Downloaded images are named ⚡ 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: Wait 2 seconds, then proceed to step 3. Standard Path (when you don't have the chat URL): ``` browser action:"snapshot" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` Each chat has a Notes panel on the right side. Notes are internal-only (not visible to customers). Max 300 characters per note. Tags are shown in the right panel below the user's name. They are predefined labels for categorizing chats. LINE OA Manager can manage multiple official accounts. Switch between them using the account dropdown in the top-left corner. ``` browser action:"snapshot" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"snapshot" profile:"openclaw" targetId:" ``` 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). ``` browser action:"act" profile:"openclaw" targetId:" ``` ``` browser action:"act" profile:"openclaw" targetId:" ``` or [已讀] based on unread field. If empty array, say "目前沒有聊天記錄".about:blank, list all tabs, close everything except about:blank.Check LINE Messages
Steps
fn parameter:name: customer display nametime: timestamp (e.g., "21:32", "Yesterday", "Friday")lastMsg: last message preview (~100 chars)unread: true if green dot present, false otherwisehttps://chat.line.biz/U1234567890abcdef1234567890abcdef/chat/U803dc04f...) alongside the chat info for faster access later.How to Report Results
unread: true exists: List each unread chat with name, time, preview, and URL (if obtained)Notes
span.badge.badge-pin inside each chat list item (green dot)lastMsg shows the last message in the thread, which may be an auto-response rather than the customer's original messageView Specific Messages
list-chats.js or user request).Steps
with the actual customer name.time: timestamptext: message contentisCustomer: true if from customer, false if from youhasImage: true if message contains an imageNavigation Tips
Handling Images
hasImage: true in message data: with the message timestamp (e.g., "09:11").line_oa_chat_YYMMDD_HHMMSS.jpgReply to a Message
browser action:"navigate" profile:"openclaw" targetId:"<your_targetId>" targetUrl:"<chat_url>"
ref:"e68"):ref:"e509"):ref:"e522") or press Enter:Manage Notes
Add a note
Edit a note
Delete a note
Manage Tags
Add a tag
Remove a tag
Switch Account
ref:"e589"):Notes
共 1 个版本