@shenhh/popo 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +24 -1
- package/package.json +1 -1
- package/skills/popo-admin/SKILL.md +196 -0
- package/skills/popo-card/SKILL.md +108 -0
- package/skills/popo-msg/SKILL.md +120 -0
- package/skills/popo-team/SKILL.md +285 -0
- package/src/client.ts +9 -2
- package/src/media.ts +324 -0
- package/src/team.ts +506 -0
package/index.ts
CHANGED
|
@@ -12,9 +12,32 @@ export {
|
|
|
12
12
|
updateStreamCardPopo,
|
|
13
13
|
updateInstructionVariableOptions,
|
|
14
14
|
} from "./src/send.js";
|
|
15
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
uploadImagePopo,
|
|
17
|
+
uploadFilePopo,
|
|
18
|
+
sendImagePopo,
|
|
19
|
+
sendFilePopo,
|
|
20
|
+
sendMediaPopo,
|
|
21
|
+
recallMessagePopo,
|
|
22
|
+
getMessageReadAckPopo,
|
|
23
|
+
configureCardCallbackPopo,
|
|
24
|
+
downloadMessageFilePopo,
|
|
25
|
+
registerFileUploadPopo,
|
|
26
|
+
} from "./src/media.js";
|
|
16
27
|
export { probePopo } from "./src/probe.js";
|
|
17
28
|
export { popoPlugin } from "./src/channel.js";
|
|
29
|
+
export {
|
|
30
|
+
createTeam,
|
|
31
|
+
inviteToTeam,
|
|
32
|
+
dropTeam,
|
|
33
|
+
getTeamMembers,
|
|
34
|
+
getTeamInfo,
|
|
35
|
+
updateTeamInfo,
|
|
36
|
+
updateTeamManagement,
|
|
37
|
+
getViewScope,
|
|
38
|
+
modifyViewScope,
|
|
39
|
+
publishRobot,
|
|
40
|
+
} from "./src/team.js";
|
|
18
41
|
|
|
19
42
|
const plugin = {
|
|
20
43
|
id: "popo",
|
package/package.json
CHANGED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: popo-admin
|
|
3
|
+
description: |
|
|
4
|
+
POPO robot administration operations. Activate when user mentions robot visibility, publishing, or admin settings.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# POPO Admin Tool
|
|
8
|
+
|
|
9
|
+
Manage robot visibility scope and publishing.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
POPO admin operations support:
|
|
14
|
+
- Query robot visibility scope (who can see/use the robot)
|
|
15
|
+
- Modify visibility scope (add/remove users or departments)
|
|
16
|
+
- Apply to publish robot changes
|
|
17
|
+
|
|
18
|
+
## Actions
|
|
19
|
+
|
|
20
|
+
### Get View Scope
|
|
21
|
+
|
|
22
|
+
Query the current visibility scope of the robot.
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"action": "get_view_scope",
|
|
27
|
+
"scopeType": "PERSONAL",
|
|
28
|
+
"current": 1,
|
|
29
|
+
"limit": 10
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Parameters:**
|
|
34
|
+
- `scopeType` (optional): "PERSONAL" (default) or "DEPARTMENT"
|
|
35
|
+
- `current` (optional): Current page, default 1
|
|
36
|
+
- `limit` (optional): Page size, default 10
|
|
37
|
+
|
|
38
|
+
**Response:**
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"success": true,
|
|
42
|
+
"records": [
|
|
43
|
+
{
|
|
44
|
+
"scopeType": "PERSONAL",
|
|
45
|
+
"scopeValue": "user@corp.netease.com"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"scopeType": "DEPARTMENT",
|
|
49
|
+
"scopeValue": "D001"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"viewScopeType": 2,
|
|
53
|
+
"total": 2,
|
|
54
|
+
"size": 10,
|
|
55
|
+
"current": 1
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**View Scope Types:**
|
|
60
|
+
- `1` - All visible (全员可见)
|
|
61
|
+
- `2` - Partial visible (部分可见)
|
|
62
|
+
|
|
63
|
+
### Modify View Scope
|
|
64
|
+
|
|
65
|
+
Add or remove users/departments from robot visibility scope.
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"action": "modify_view_scope",
|
|
70
|
+
"operationType": 1,
|
|
71
|
+
"scopeType": "PERSONAL",
|
|
72
|
+
"scopeValues": ["user1@corp.netease.com", "user2@corp.netease.com"]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
- `operationType` (required): 1=add, 2=delete
|
|
78
|
+
- `scopeType` (required): "PERSONAL" or "DEPARTMENT"
|
|
79
|
+
- `scopeValues` (required): Array of emails or department IDs
|
|
80
|
+
|
|
81
|
+
**Response:**
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"success": true,
|
|
85
|
+
"successNum": 2,
|
|
86
|
+
"failNum": 0,
|
|
87
|
+
"failMsg": {}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Notes:**
|
|
92
|
+
- To delete scope, the user/department must have been explicitly added before
|
|
93
|
+
- Cannot modify "all visible" scope directly - must be partial visible first
|
|
94
|
+
- Changes require publishing to take effect
|
|
95
|
+
|
|
96
|
+
### Publish Robot
|
|
97
|
+
|
|
98
|
+
Apply to publish robot visibility changes (requires admin approval).
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"action": "publish_robot",
|
|
103
|
+
"uid": "admin@corp.netease.com"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Parameters:**
|
|
108
|
+
- `uid` (required): Applicant email (must be robot creator or admin)
|
|
109
|
+
|
|
110
|
+
**Notes:**
|
|
111
|
+
- After modifying visibility scope, you must call publish for changes to take effect
|
|
112
|
+
- Publishing requires admin approval
|
|
113
|
+
- New visibility scope will be merged with existing scope
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
### Add users to visibility scope
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"action": "modify_view_scope",
|
|
122
|
+
"operationType": 1,
|
|
123
|
+
"scopeType": "PERSONAL",
|
|
124
|
+
"scopeValues": [
|
|
125
|
+
"pm@corp.netease.com",
|
|
126
|
+
"dev1@corp.netease.com",
|
|
127
|
+
"dev2@corp.netease.com"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Add department to visibility scope
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"action": "modify_view_scope",
|
|
137
|
+
"operationType": 1,
|
|
138
|
+
"scopeType": "DEPARTMENT",
|
|
139
|
+
"scopeValues": ["D001", "D002"]
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Remove user from scope
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"action": "modify_view_scope",
|
|
148
|
+
"operationType": 2,
|
|
149
|
+
"scopeType": "PERSONAL",
|
|
150
|
+
"scopeValues": ["former@corp.netease.com"]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Query current scope
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"action": "get_view_scope",
|
|
159
|
+
"scopeType": "PERSONAL",
|
|
160
|
+
"limit": 50
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Publish changes
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"action": "publish_robot",
|
|
169
|
+
"uid": "creator@corp.netease.com"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Configuration
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
channels:
|
|
177
|
+
popo:
|
|
178
|
+
enabled: true
|
|
179
|
+
appKey: "your_app_key"
|
|
180
|
+
appSecret: "your_app_secret"
|
|
181
|
+
token: "your_token"
|
|
182
|
+
aesKey: "your_aes_key"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Important Notes
|
|
186
|
+
|
|
187
|
+
- Visibility changes require admin approval via `publish_robot`
|
|
188
|
+
- Cannot modify scope if robot is set to "all visible"
|
|
189
|
+
- When deleting scope, the target must have been explicitly added
|
|
190
|
+
- Publishing merges new scope with existing approved scope
|
|
191
|
+
|
|
192
|
+
## API Reference
|
|
193
|
+
|
|
194
|
+
- Get view scope: `POST /open-apis/robots/v1/view-scope`
|
|
195
|
+
- Modify view scope: `POST /open-apis/robots/v1/view-scope/modify`
|
|
196
|
+
- Publish robot: `POST /open-apis/robots/v1/view-scope/publish`
|
|
@@ -451,6 +451,113 @@ Update dynamic options for slash command (/command) variables dynamically.
|
|
|
451
451
|
| `101506` | Variable not found in instruction |
|
|
452
452
|
| `101507` | Variable uses static options, cannot update |
|
|
453
453
|
|
|
454
|
+
## Webhook Events
|
|
455
|
+
|
|
456
|
+
POPO sends various event types to your webhook endpoint:
|
|
457
|
+
|
|
458
|
+
### Card Action Event
|
|
459
|
+
|
|
460
|
+
When users click buttons on cards:
|
|
461
|
+
|
|
462
|
+
```json
|
|
463
|
+
{
|
|
464
|
+
"eventType": "ACTION",
|
|
465
|
+
"eventData": {
|
|
466
|
+
"param": {
|
|
467
|
+
"actionType": "button_click",
|
|
468
|
+
"actionData": {
|
|
469
|
+
"buttonId": "approve_btn",
|
|
470
|
+
"action": "approve"
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### User Join Group Event
|
|
478
|
+
|
|
479
|
+
```json
|
|
480
|
+
{
|
|
481
|
+
"eventType": "TEAM_USER_JOIN_GROUP",
|
|
482
|
+
"eventData": {
|
|
483
|
+
"timetag": 1732179814141,
|
|
484
|
+
"uids": ["user@corp.netease.com"],
|
|
485
|
+
"type": 1,
|
|
486
|
+
"tid": "1234567",
|
|
487
|
+
"robotId": "robot123"
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### User Leave Group Event
|
|
493
|
+
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"eventType": "TEAM_USER_LEAVE_GROUP",
|
|
497
|
+
"eventData": {
|
|
498
|
+
"timetag": 1732179967704,
|
|
499
|
+
"uids": ["user@corp.netease.com"],
|
|
500
|
+
"type": 2,
|
|
501
|
+
"tid": "1234567",
|
|
502
|
+
"robotId": "robot123"
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### User Visit Robot Event
|
|
508
|
+
|
|
509
|
+
When user opens conversation with robot:
|
|
510
|
+
|
|
511
|
+
```json
|
|
512
|
+
{
|
|
513
|
+
"eventType": "IM_USER_VISIT",
|
|
514
|
+
"eventData": {
|
|
515
|
+
"uid": "user@corp.netease.com",
|
|
516
|
+
"timetag": 1732184022650,
|
|
517
|
+
"robotId": "robot123"
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## Card Callback Configuration
|
|
523
|
+
|
|
524
|
+
Configure webhook callback for card button interactions.
|
|
525
|
+
|
|
526
|
+
### Configure Card Callback
|
|
527
|
+
|
|
528
|
+
```json
|
|
529
|
+
{
|
|
530
|
+
"action": "configure_card_callback",
|
|
531
|
+
"configKey": "notifyForTeam-01",
|
|
532
|
+
"requestUrl": "https://your-server.com/popo/card-callback",
|
|
533
|
+
"token": "your-verification-token",
|
|
534
|
+
"aesKey": "eSy7nSDKtFarNn45LYUcTBwPGt4u6PKG",
|
|
535
|
+
"overwriteUpdate": true,
|
|
536
|
+
"withCallBackTest": true,
|
|
537
|
+
"pushToOffice": false,
|
|
538
|
+
"authType": "SIGN"
|
|
539
|
+
}
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**Parameters:**
|
|
543
|
+
- `configKey` (required): Unique callback key (max 64 chars)
|
|
544
|
+
- `requestUrl` (required): URL to receive callbacks (max 256 chars)
|
|
545
|
+
- `token` (required): Verification token for signature (max 64 chars)
|
|
546
|
+
- `aesKey` (optional): 32-char AES key for encryption
|
|
547
|
+
- `overwriteUpdate` (optional): Set to `true` to update existing config
|
|
548
|
+
- `withCallBackTest` (optional): Test callback URL before saving (default: true)
|
|
549
|
+
- `pushToOffice` (optional): Push from office network (default: false)
|
|
550
|
+
- `authType` (optional): `CODE` or `SIGN` (default: SIGN)
|
|
551
|
+
|
|
552
|
+
**Callback Verification:**
|
|
553
|
+
|
|
554
|
+
When `withCallBackTest` is true, POPO will send a GET request to your URL:
|
|
555
|
+
```
|
|
556
|
+
GET https://your-server.com/popo/card-callback?nonce=xxx
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
Your server must return the nonce parameter in response to verify.
|
|
560
|
+
|
|
454
561
|
## API Reference
|
|
455
562
|
|
|
456
563
|
- Send message: `POST /open-apis/robots/v1/im/send-msg` with `msgType: "card"`
|
|
@@ -458,3 +565,4 @@ Update dynamic options for slash command (/command) variables dynamically.
|
|
|
458
565
|
- Create streaming card: `POST /open-apis/robots/v1/im/send-msg` with streaming template
|
|
459
566
|
- Update streaming card: `PUT /open-apis/robots/v1/im/msg-card/stream`
|
|
460
567
|
- Update instruction options: `POST /open-apis/robots/v1/instruction/variable/options`
|
|
568
|
+
- Configure card callback: `POST /open-apis/robots/v1/im/msg-card/callback`
|
package/skills/popo-msg/SKILL.md
CHANGED
|
@@ -231,6 +231,126 @@ Common errors:
|
|
|
231
231
|
- `4005` - Bot not in group (for group messages)
|
|
232
232
|
- `4006` - Permission denied (sending to unauthorized user)
|
|
233
233
|
|
|
234
|
+
## Message Operations
|
|
235
|
+
|
|
236
|
+
### Recall Message
|
|
237
|
+
|
|
238
|
+
Recall (retract) a sent message within the allowed time window.
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"action": "recall_message",
|
|
243
|
+
"msgId": "794076f2-68b1-4d0e-94eb-c15946580b56",
|
|
244
|
+
"sessionId": "user@corp.netease.com",
|
|
245
|
+
"sessionType": 1
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Parameters:**
|
|
250
|
+
- `msgId` (required): Message ID to recall
|
|
251
|
+
- `sessionId` (required): Session ID (user email for P2P, group ID for group)
|
|
252
|
+
- `sessionType` (required): `1` for P2P, `3` for group
|
|
253
|
+
|
|
254
|
+
**Note:** Messages can only be recalled within a limited time (typically 2 minutes).
|
|
255
|
+
|
|
256
|
+
### Query Message Read Status
|
|
257
|
+
|
|
258
|
+
Query read/unread status for group messages.
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"action": "get_message_read_ack",
|
|
263
|
+
"msgId": "1000016836-0000000004",
|
|
264
|
+
"sessionType": 3,
|
|
265
|
+
"type": 1,
|
|
266
|
+
"st": 1672221224000,
|
|
267
|
+
"page": 1,
|
|
268
|
+
"size": 30
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Parameters:**
|
|
273
|
+
- `msgId` (required): Message ID
|
|
274
|
+
- `sessionType` (required): Must be `3` (group)
|
|
275
|
+
- `type` (required): `1` for read list, `2` for unread list
|
|
276
|
+
- `st` (required): Query end timestamp (milliseconds)
|
|
277
|
+
- `page` (optional): Page number, default 1
|
|
278
|
+
- `size` (optional): Page size, default 30
|
|
279
|
+
|
|
280
|
+
**Response:**
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"success": true,
|
|
284
|
+
"rnum": 10,
|
|
285
|
+
"unrnum": 15,
|
|
286
|
+
"ratList": ["user@corp.netease.com"],
|
|
287
|
+
"list": [
|
|
288
|
+
{
|
|
289
|
+
"uid": "user@corp.netease.com",
|
|
290
|
+
"name": "张三",
|
|
291
|
+
"avatar": "https://xxx/avatar.png"
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Download Message File
|
|
298
|
+
|
|
299
|
+
Get download URL for a file from message.
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"action": "download_message_file",
|
|
304
|
+
"fileId": "a2759a44-xxxx-xxxx-xxxx-2fcbe67a286a"
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Response:**
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"success": true,
|
|
312
|
+
"downloadUrl": "https://xxx/download?expires=..."
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Note:** Download URL is valid for 1 hour.
|
|
317
|
+
|
|
318
|
+
### Register File Upload
|
|
319
|
+
|
|
320
|
+
Register file info and get upload URL for large files.
|
|
321
|
+
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"action": "register_file_upload",
|
|
325
|
+
"fileType": "mp4",
|
|
326
|
+
"fileName": "presentation.mp4",
|
|
327
|
+
"fileMd5": "e45d9335d1e027d3e64fd3b01c116886",
|
|
328
|
+
"duration": 120,
|
|
329
|
+
"height": 1080,
|
|
330
|
+
"width": 1920
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Parameters:**
|
|
335
|
+
- `fileType` (required): File extension (mp4, mp3, pdf, etc.)
|
|
336
|
+
- `fileName` (required): File name
|
|
337
|
+
- `fileMd5` (required): MD5 hash of file content
|
|
338
|
+
- `duration` (optional): Duration in seconds (for audio/video)
|
|
339
|
+
- `height` (optional): Video height
|
|
340
|
+
- `width` (optional): Video width
|
|
341
|
+
- `coverUrl` (optional): Video cover image URL
|
|
342
|
+
|
|
343
|
+
**Response:**
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"success": true,
|
|
347
|
+
"fileKey": "490aa189-5589-4902-bad1-9281d817804d",
|
|
348
|
+
"uploadUrl": "https://open.popo.netease.com:8281/open-apis/robots/v1/im/file/.../upload"
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Note:** After getting uploadUrl, upload file within 1 hour using POST form-data.
|
|
353
|
+
|
|
234
354
|
## Rate Limits
|
|
235
355
|
|
|
236
356
|
- Text messages: 100 messages/minute per bot
|