首页龙虾技能列表 › LINE Chat for Official Account — 技能工具

LINE Chat for Official Account — 技能工具

v1.0.2

[自动翻译] Operate LINE Official Account Manager (chat.line.biz) via browser automation. Use when asked to check LINE messages, reply to LINE customers, or manag...

0· 794·1 当前·1 累计
by @picseeinc (PicSee Inc.)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's code, files, and runtime instructions are consistent with its stated purpose (browser automation of LINE Official Account); it does not request unrelated credentials or perform hidden network exfiltration, but you should still treat any browser-automation skill as powerful because it can access whatever the browser profile can see.
评估建议
This skill appears to do what it says, but browser-automation skills can access anything visible in the browser profile they control (messages, attachments, cookies, other open tabs). Before installing: (1) only install from a trusted source; (2) ensure the platform launches the skill in the isolated profile it requests (profile:"openclaw"); (3) review the local config.json it will create (it only needs chatUrl); (4) run the setup script yourself rather than giving arbitrary agent control if you...
详细分析 ▾
用途与能力
Name/description match requested actions and included files. The skill uses browser evaluate scripts and a local setup wizard to capture the chat URL; no unrelated binaries, env vars, or remote installs are required.
指令范围
Instructions are specific to opening chat.line.biz, handling login via account.line.biz, running DOM-evaluation scripts, and reading/writing a local config.json under skills/line-oa. This is in-scope for automating LINE OA. Note: browser automation inherently exposes any data visible in the browser session (messages, images, cookies), so the agent will have access to those chat contents when it runs.
安装机制
No install spec — instruction-only with small helper scripts. setup.js is a local Node script; no remote downloads or archive extraction are performed by the skill.
凭证需求
The skill requests no environment variables or external credentials. It writes/reads a local config.json and reads its JS helper files — proportional to its purpose. There are no unrelated credential requests.
持久化与权限
Skill is not marked always:true and does not modify other skills or system-wide settings. It asks the user to run a local setup script that stores the chatUrl configuration in the skill's workspace directory — expected behavior for this functionality.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.22026/2/17

- Added "Quick Check" section for cron/automated LINE OA unread message checks, including step-by-step script usage and reporting format. - Provided a ready-to-use, one-liner JavaScript snippet for quickly listing chat summaries without separate scripts. - Clarified browser tool call requirements at key checkpoints to prevent errors from skipped actions. - Standardized output: show first 5 chats, display as `<name> (<time>) <lastMsg> [未讀]` or `[已讀]`, or say "目前沒有聊天記錄" if empty. - Minor structure improvements; no code or implementation changes.

● 无害

安装命令 点击复制

官方npx clawhub@latest install line-oa
镜像加速npx clawhub@latest install line-oa --registry https://cn.clawhub-mirror.com

技能文档

⚠️ 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:""
   
Capture targetId and url from response.

  • Wait for page load:
   browser action:"act" profile:"openclaw" targetId:"" request:{"kind":"wait","timeMs":2000}
   
  • Check current URL:
   browser action:"act" profile:"openclaw" 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:"" request:{"kind":"evaluate","fn":""}
      
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:"" request:{"kind":"evaluate","fn":""}
      
Wait 3 seconds.

c. Reload chatUrl:

      browser action:"navigate" profile:"openclaw" targetId:"" targetUrl:""
      
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:""
   
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: → get targetId
  • Wait: browser action:"act" profile:"openclaw" targetId: request:{"kind":"wait","timeMs":3000}
  • Check URL: browser action:"act" profile:"openclaw" 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: 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
⚠️ 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: ( 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:"" request:{"kind":"evaluate","fn":""}
   
  • 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:"" 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('');});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:"" request:{"kind":"evaluate","fn":"function(){return window.location.href;}"}
   
Navigate back to list:
   browser action:"navigate" profile:"openclaw" targetId:"" targetUrl:""
   
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:"" 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('');});if(target){const link=target.querySelector('a.d-flex');if(link){link.click();return {clicked:true};}return {linkNotFound:true};}return {itemNotFound:true};}"}
   
Replace with the actual customer name.

  • Wait for messages panel to load:
   browser action:"act" profile:"openclaw" targetId:"" request:{"kind":"wait","timeMs":2000}
   
  • Take a screenshot to view the messages:
   browser action:"screenshot" profile:"openclaw" 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:"" request:{"kind":"evaluate","fn":""}
   
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:"" 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('
Replace with the message timestamp (e.g., "09:11").

  • Wait and locate downloaded file:
   browser action:"act" profile:"openclaw" 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:"" filePath:"" 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:"" targetUrl:""
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:"" refs:"aria"
   
  • Click a chat item link in the left panel (e.g., ref:"e68"):
   browser action:"act" profile:"openclaw" 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:"" request:{"kind":"click","ref":"e509"}
   
  • Type the reply message:
   browser action:"act" profile:"openclaw" 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:"" 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:"" refs:"aria"
   
  • Click the account combobox (shows current account name):
   browser action:"act" profile:"openclaw" targetId:"" request:{"kind":"click","ref":"e11"}
   
  • Wait for the dropdown menu to appear:
   browser action:"act" profile:"openclaw" targetId:"" request:{"kind":"wait","timeMs":1000}
   
  • Take another snapshot to see available accounts in the listbox:
   browser action:"snapshot" profile:"openclaw" 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:"" request:{"kind":"click","ref":"e589"}
   
  • Wait for the page to load the new account's chat list:
   browser action:"act" profile:"openclaw" 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
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务