weread-skills
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWeRead — 微信读书助手
WeRead — WeRead Assistant
通过 Agent API Gateway 调用微信读书接口,提供搜索、书架、笔记、书评等能力。
Call WeRead interfaces via Agent API Gateway, providing capabilities such as search, bookshelf management, notes, book reviews, etc.
支持的能力
Supported Capabilities
| 能力 | 说明 | 用户示例 | 详细说明 |
|---|---|---|---|
| 搜索书籍 | 在书城搜索 | "帮我搜一下三体" | |
| 书籍信息 | 查看书籍详情、章节目录、阅读进度 | "这本书有多少章" "我读到哪了" | |
| 书架管理 | 查看书架 | "看看我的书架" | |
| 阅读统计 | 阅读时长、天数、偏好分析、阅读统计摘要 | "我这个月读了多久" "今年读了几本书" | |
| 笔记划线 | 查看个人笔记数量与内容,包括划线、想法/点评、书签数量 | "看看我在三体里的笔记" "导出我的划线" "在这本书有多少笔记" | |
| 章节热门划线 | 查看书籍/章节热门划线、划线热度及划线下想法 | "看看这章有什么热门划线" "这段话下面有什么想法" | |
| 书籍点评 | 查看书籍的公开点评 | "三体这本书有什么点评?" "看看推荐的点评" | |
| 推荐好书 | 个性化推荐/相似推荐 | "给我推荐几本书" | |
根据用户意图参考对应说明文件了解接口参数、回包结构和工作流。
| Capability | Description | User Example | Detailed Instructions |
|---|---|---|---|
| Search Books | Search in the book store | "Help me search for The Three-Body Problem" | |
| Book Information | View book details, chapter catalog, reading progress | "How many chapters does this book have?" "Where did I leave off reading?" | |
| Bookshelf Management | View bookshelf | "Show me my bookshelf" | |
| Reading Statistics | Reading duration, days, preference analysis, reading statistics summary | "How long did I read this month?" "How many books have I read this year?" | |
| Notes & Underlines | View personal note count and content, including underlines, thoughts/comments, bookmark count | "Show me my notes in The Three-Body Problem" "Export my underlines" "How many notes do I have in this book?" | |
| Popular Underlines in Chapters | View popular underlines in books/chapters, underline popularity and thoughts under underlines | "Show me the popular underlines in this chapter" "What thoughts are there under this passage?" | |
| Book Reviews | View public reviews of books | "What are the reviews for The Three-Body Problem?" "Show me recommended reviews" | |
| Recommend Good Books | Personalized recommendations/similar recommendations | "Recommend some books to me" | |
Refer to the corresponding instruction documents according to user intent to understand interface parameters, response structure and workflow.
接口调用规范
Interface Calling Specifications
统一入口
Unified Entry
POST https://i.weread.qq.com/api/agent/gatewayPOST https://i.weread.qq.com/api/agent/gateway鉴权
Authentication
- Header:
Authorization: Bearer $WEREAD_API_KEY - 从环境变量获取,格式
WEREAD_API_KEYwrk-xxxxxxxx - 若未设置,提示用户:
export WEREAD_API_KEY=<你的apikey> - API Key 绑定用户身份(vid),需要用户身份的接口会自动注入,无需手动传 vid
- Header:
Authorization: Bearer $WEREAD_API_KEY - is obtained from environment variables, in the format
WEREAD_API_KEYwrk-xxxxxxxx - If not set, prompt the user:
export WEREAD_API_KEY=<your apikey> - API Key is bound to user identity (vid), interfaces requiring user identity will automatically inject it, no need to manually pass vid
请求格式
Request Format
- Method:POST
- Content-Type:application/json
- Body:JSON,指定接口,其余为接口参数,每次请求必须带
api_nameskill_version
bash
curl -X POST "https://i.weread.qq.com/api/agent/gateway" \
-H "Authorization: Bearer $WEREAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"api_name": "/store/search", "keyword": "三体", "count": 10, "skill_version": "1.0.3"}'- Method: POST
- Content-Type: application/json
- Body: JSON, specifies the interface, others are interface parameters,
api_namemust be included in each requestskill_version
bash
curl -X POST "https://i.weread.qq.com/api/agent/gateway" \
-H "Authorization: Bearer $WEREAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"api_name": "/store/search", "keyword": "三体", "count": 10, "skill_version": "1.0.3"}'请求 few-shot
Request Few-Shot Examples
正确:业务参数平铺在 body 顶层。
json
{"api_name":"/user/notebooks","count":100,"skill_version":"1.0.5"}正确:下一页继续平铺 。
lastSortjson
{"api_name":"/user/notebooks","count":100,"lastSort":1516907353,"skill_version":"1.0.5"}错误:不要把业务参数包在 内。
paramsjson
{"api_name":"/user/notebooks","params":{"count":100,"lastSort":1516907353},"skill_version":"1.0.5"}上面的错误写法会导致 、 未被转发,后端按默认值返回第一页,看起来像分页失效。
countlastSortCorrect: Business parameters are placed at the top level of the body.
json
{"api_name":"/user/notebooks","count":100,"skill_version":"1.0.5"}Correct: Continue to place at the top level for next page.
lastSortjson
{"api_name":"/user/notebooks","count":100,"lastSort":1516907353,"skill_version":"1.0.5"}Incorrect: Do not wrap business parameters in .
paramsjson
{"api_name":"/user/notebooks","params":{"count":100,"lastSort":1516907353},"skill_version":"1.0.5"}The incorrect writing above will cause and not to be forwarded, and the backend will return the first page according to default values, making it seem like pagination is invalid.
countlastSort响应格式
Response Format
- JSON,回包经过字段裁剪,只返回核心字段
- 非 0 时表示错误,给出中文提示
errcode - 发送 可查看所有可用接口及参数定义
{"api_name": "/_list"}
- JSON, the response is field-trimmed, only core fields are returned
- Non-zero indicates an error, with Chinese prompt message
errcode - Send to view all available interfaces and parameter definitions
{"api_name": "/_list"}
通用规则
General Rules
- 版本上报:每次请求 body 必须包含 (取本文件顶部 version 字段的值),用于服务端检查版本更新。如果回包中出现
"skill_version": "1.0.3"字段,必须立即暂停当前操作,按照upgrade_info中的指引完成升级,升级完成后再重新执行用户请求,不得忽略该字段upgrade_info.message - 参数平铺:业务参数必须和 、
api_name放在同一层;不要包在skill_version、params、data等对象里。只有接口文档明确声明的数组/对象字段(如body的/book/readreviews)才允许作为业务字段传入。reviews - 能力文档预检:调用任何接口前,必须先根据「支持的能力」表阅读对应说明文件(如阅读统计先读 ,书架先读
readdata.md),确认接口参数、字段含义、单位、计数口径和工作流;禁止仅凭字段名或经验猜测含义。shelf.md - 字段解释优先级:解释接口回包时,以对应说明文件中的字段说明为准;如果回包字段名和直觉含义冲突,必须服从说明文件,不得直接翻译字段名。
- bookId 解析:用户输入书名时,先调 获取 bookId,再执行后续操作
/store/search - 书架数量:使用 回答“书架有多少本书/多少条目”时,必须按
/shelf/sync计算;books.length + albums.length + (mp 非空 ? 1 : 0)是专辑/有声书,也属于书架里的书,详细规则见albums[]shelf.md - 结果展示:列表用编号展示方便选择;搜索结果重点展示书名、作者、评分;展示接口回包信息时,字段禁止直接翻译,应该参考文件中的说明内容提供
- 上下文衔接:对话中记住已查询的 bookId,后续操作无需用户重复提供
- 深度链接:在展示划线、想法、章节等内容时,拼接对应的跳转链接方便用户直接在 App 中打开,具体格式见下方「深度链接(URL Schema)」章节
- 数据展示规范:
- 时间戳:所有 Unix 时间戳字段(如 、
updateTime、createTime、finishTime等),展示时须转为 YYYY-MM-DD 格式(如readUpdateTime展示为"2025-05-30"),不得直接展示原始数字1748563200 - 阅读时长:单位为秒,展示时转为"X小时Y分钟"格式
- Version Reporting: Each request body must include (take the value of the version field at the top of this file), which is used for the server to check for version updates. If the
"skill_version": "1.0.3"field appears in the response, you must immediately pause the current operation, complete the upgrade according to the guidelines inupgrade_info, and re-execute the user request after the upgrade is completed; do not ignore this fieldupgrade_info.message - Parameter Flattening: Business parameters must be placed at the same level as and
api_name; do not wrap them in objects likeskill_version,params, ordata. Only array/object fields explicitly declared in the interface documentation (such asbodyofreviews) are allowed to be passed as business fields./book/readreviews - Pre-check Capability Documentation: Before calling any interface, you must first read the corresponding instruction document according to the "Supported Capabilities" table (e.g., read first for reading statistics,
readdata.mdfirst for bookshelf), confirm interface parameters, field meanings, units, counting calibers and workflows; it is forbidden to guess meanings solely based on field names or experience.shelf.md - Field Interpretation Priority: When interpreting interface responses, take the field descriptions in the corresponding instruction documents as the standard; if the response field name conflicts with intuitive meaning, you must follow the instruction document and not directly translate the field name.
- bookId Parsing: When the user enters a book title, first call to obtain the bookId, then perform subsequent operations
/store/search - Bookshelf Count: When using to answer "How many books/items are in the bookshelf?", you must calculate it as
/shelf/sync;books.length + albums.length + (mp is not null ? 1 : 0)are albums/audiobooks, which also belong to the books in the bookshelf, detailed rules can be found inalbums[]shelf.md - Result Display: Use numbered lists for display to facilitate selection; focus on displaying book title, author, and rating for search results; when displaying interface response information, forbid direct translation of fields, and should provide content based on the descriptions in the documents
- Context Cohesion: Remember the queried bookId in the conversation, and users do not need to provide it repeatedly for subsequent operations
- Deep Linking: When displaying underlines, thoughts, chapters and other content, splice the corresponding jump links to facilitate users to open the corresponding location directly in the App. For thoughts/reviews, not all have underline positions, only when and
chapterUidare available, generate the underline position linkrange - Data Display Specifications:
- Timestamp: All Unix timestamp fields (such as ,
updateTime,createTime,finishTime, etc.) must be converted to YYYY-MM-DD format when displayed (e.g.,readUpdateTimeis displayed as "2025-05-30"), raw numbers cannot be displayed directly1748563200 - Reading Duration: Unit is seconds, convert to "X hours Y minutes" format when displayed
- Timestamp: All Unix timestamp fields (such as
深度链接(URL Schema)
Deep Linking (URL Schema)
在展示书籍、章节、划线等内容时,如果回包字段足以构造链接,应附上对应的跳转链接,方便用户点击后直接在微信读书 App 中打开对应位置。想法/点评不一定都有划线位置,只有具备 和 时才生成划线位置链接。
chapterUidrangeWhen displaying books, chapters, underlines and other content, if the response fields are sufficient to construct a link, attach the corresponding jump link to facilitate users to open the corresponding location directly in the WeRead App. Thoughts/reviews do not necessarily have underline positions, only when and are available, generate the underline position link.
chapterUidrange打开书籍(跳转到上次阅读进度)
Open Book (Jump to last reading progress)
weread://reading?bId={bookId}| 参数 | 说明 | 来源 |
|---|---|---|
| 书籍 ID | 各接口返回的 |
示例:
weread://reading?bId=3300045871使用场景:
- 展示书架列表时,每本书附上跳转链接
- 展示搜索结果时,附上「打开阅读」链接
- 展示阅读进度时,提供「继续阅读」链接
weread://reading?bId={bookId}| Parameter | Description | Source |
|---|---|---|
| Book ID | |
Example:
weread://reading?bId=3300045871Usage Scenarios:
- Attach a jump link to each book when displaying the bookshelf list
- Attach an "Open to Read" link when displaying search results
- Provide a "Continue Reading" link when displaying reading progress
跳转到指定章节
Jump to Specified Chapter
weread://reading?bId={bookId}&chapterUid={chapterUid}| 参数 | 说明 | 来源 |
|---|---|---|
| 书籍 ID | 各接口返回的 |
| 章节 UID | |
示例:
weread://reading?bId=3300045871&chapterUid=107使用场景:
- 展示章节目录时,每个章节附上跳转链接
weread://reading?bId={bookId}&chapterUid={chapterUid}| Parameter | Description | Source |
|---|---|---|
| Book ID | |
| Chapter UID | |
Example:
weread://reading?bId=3300045871&chapterUid=107Usage Scenarios:
- Attach a jump link to each chapter when displaying the chapter catalog
跳转到划线/想法所在位置
Jump to Underline/Thought Location
weread://bestbookmark?bookId={bookId}&chapterUid={chapterUid}&rangeStart={rangeStart}&rangeEnd={rangeEnd}&userVid={userVid}| 参数 | 说明 | 来源 |
|---|---|---|
| 书籍 ID | 各接口返回的 |
| 章节 UID | 划线/想法所属的 |
| 划线起始位置 | |
| 划线结束位置 | |
| 用户 VID | API Key 鉴权后自动关联的用户 ID(从 |
range 解析:划线接口返回的格式为range(如"起始-结束"),拆分后分别填入"900-2004"和rangeStart。rangeEnd
示例:
weread://bestbookmark?bookId=3300045871&chapterUid=107&rangeStart=900&rangeEnd=2004&userVid=583802764使用场景:
- 展示划线列表()时,每条划线附上跳转链接(
/book/bookmarklist字段可直接解析)range - 展示热门划线()时,每条附上跳转链接;
/book/bestbookmarks只是划线热度统计,不含划线文本/book/underlines - 展示想法(、
/review/list/mine)时,只有返回内容包含/book/readreviews和chapterUid时才附上跳转到对应划线位置的链接;整本书评或无法定位到划线的点评不强制生成该链接range
weread://bestbookmark?bookId={bookId}&chapterUid={chapterUid}&rangeStart={rangeStart}&rangeEnd={rangeEnd}&userVid={userVid}| Parameter | Description | Source |
|---|---|---|
| Book ID | |
| Chapter UID | |
| Underline start position | The number before |
| Underline end position | The number after |
| User VID | User ID automatically associated after API Key authentication (obtained from the context of interfaces like |
range Parsing: Thefield returned by the underline interface is in the formatrange(e.g.,"start-end"), split it and fill in"900-2004"andrangeStartrespectively.rangeEnd
Example:
weread://bestbookmark?bookId=3300045871&chapterUid=107&rangeStart=900&rangeEnd=2004&userVid=583802764Usage Scenarios:
- Attach a jump link to each underline when displaying the underline list () (the
/book/bookmarklistfield can be directly parsed)range - Attach a jump link to each when displaying popular underlines ();
/book/bestbookmarksis only underline popularity statistics and does not contain underline text/book/underlines - When displaying thoughts (,
/review/list/mine), only attach the link to jump to the corresponding underline position if the returned content includes/book/readreviewsandchapterUid; reviews for the entire book or reviews that cannot be located to an underline do not require generating this linkrange