n8n-nodes-wecom 0.1.1
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/LICENSE.md +19 -0
- package/README.md +89 -0
- package/dist/credentials/WeComApi.credentials.d.ts +10 -0
- package/dist/credentials/WeComApi.credentials.js +58 -0
- package/dist/credentials/WeComApi.credentials.js.map +1 -0
- package/dist/icons/wecom.dark.png +0 -0
- package/dist/icons/wecom.png +0 -0
- package/dist/nodes/WeCom/WeCom.node.d.ts +15 -0
- package/dist/nodes/WeCom/WeCom.node.js +156 -0
- package/dist/nodes/WeCom/WeCom.node.js.map +1 -0
- package/dist/nodes/WeCom/WeCom.node.json +19 -0
- package/dist/nodes/WeCom/resources/contact/convertToOpenid.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/convertToOpenid.js +24 -0
- package/dist/nodes/WeCom/resources/contact/convertToOpenid.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/convertToUserid.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/convertToUserid.js +21 -0
- package/dist/nodes/WeCom/resources/contact/convertToUserid.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/execute.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/execute.js +89 -0
- package/dist/nodes/WeCom/resources/contact/execute.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/getDepartment.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/getDepartment.js +23 -0
- package/dist/nodes/WeCom/resources/contact/getDepartment.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/getTag.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/getTag.js +24 -0
- package/dist/nodes/WeCom/resources/contact/getTag.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/getTagList.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/getTagList.js +34 -0
- package/dist/nodes/WeCom/resources/contact/getTagList.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/getUser.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/getUser.js +24 -0
- package/dist/nodes/WeCom/resources/contact/getUser.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/index.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/index.js +93 -0
- package/dist/nodes/WeCom/resources/contact/index.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/listUserIds.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/listUserIds.js +35 -0
- package/dist/nodes/WeCom/resources/contact/listUserIds.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/listUsers.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/listUsers.js +34 -0
- package/dist/nodes/WeCom/resources/contact/listUsers.js.map +1 -0
- package/dist/nodes/WeCom/resources/contact/listUsersDetail.d.ts +2 -0
- package/dist/nodes/WeCom/resources/contact/listUsersDetail.js +34 -0
- package/dist/nodes/WeCom/resources/contact/listUsersDetail.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/execute.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/execute.js +129 -0
- package/dist/nodes/WeCom/resources/material/execute.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/getPermanent.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/getPermanent.js +31 -0
- package/dist/nodes/WeCom/resources/material/getPermanent.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/getTemp.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/getTemp.js +31 -0
- package/dist/nodes/WeCom/resources/material/getTemp.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/index.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/index.js +52 -0
- package/dist/nodes/WeCom/resources/material/index.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/uploadPermanent.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/uploadPermanent.js +49 -0
- package/dist/nodes/WeCom/resources/material/uploadPermanent.js.map +1 -0
- package/dist/nodes/WeCom/resources/material/uploadTemp.d.ts +2 -0
- package/dist/nodes/WeCom/resources/material/uploadTemp.js +49 -0
- package/dist/nodes/WeCom/resources/material/uploadTemp.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/commonFields.d.ts +7 -0
- package/dist/nodes/WeCom/resources/message/commonFields.js +155 -0
- package/dist/nodes/WeCom/resources/message/commonFields.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/execute.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/execute.js +615 -0
- package/dist/nodes/WeCom/resources/message/execute.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/index.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/index.js +133 -0
- package/dist/nodes/WeCom/resources/message/index.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/recallMessage.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/recallMessage.js +21 -0
- package/dist/nodes/WeCom/resources/message/recallMessage.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendFile.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendFile.js +62 -0
- package/dist/nodes/WeCom/resources/message/sendFile.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendImage.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendImage.js +62 -0
- package/dist/nodes/WeCom/resources/message/sendImage.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendMarkdown.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendMarkdown.js +26 -0
- package/dist/nodes/WeCom/resources/message/sendMarkdown.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendMiniprogramNotice.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendMiniprogramNotice.js +138 -0
- package/dist/nodes/WeCom/resources/message/sendMiniprogramNotice.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendMpNews.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendMpNews.js +122 -0
- package/dist/nodes/WeCom/resources/message/sendMpNews.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendNews.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendNews.js +101 -0
- package/dist/nodes/WeCom/resources/message/sendNews.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendTaskCard.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendTaskCard.js +160 -0
- package/dist/nodes/WeCom/resources/message/sendTaskCard.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendTemplateCard.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendTemplateCard.js +298 -0
- package/dist/nodes/WeCom/resources/message/sendTemplateCard.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendText.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendText.js +69 -0
- package/dist/nodes/WeCom/resources/message/sendText.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendTextCard.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendTextCard.js +91 -0
- package/dist/nodes/WeCom/resources/message/sendTextCard.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendVideo.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendVideo.js +126 -0
- package/dist/nodes/WeCom/resources/message/sendVideo.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/sendVoice.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/sendVoice.js +103 -0
- package/dist/nodes/WeCom/resources/message/sendVoice.js.map +1 -0
- package/dist/nodes/WeCom/resources/message/updateTemplateCard.d.ts +2 -0
- package/dist/nodes/WeCom/resources/message/updateTemplateCard.js +286 -0
- package/dist/nodes/WeCom/resources/message/updateTemplateCard.js.map +1 -0
- package/dist/nodes/WeCom/shared/transport.d.ts +6 -0
- package/dist/nodes/WeCom/shared/transport.js +150 -0
- package/dist/nodes/WeCom/shared/transport.js.map +1 -0
- package/dist/nodes/WeCom/shared/types.d.ts +21 -0
- package/dist/nodes/WeCom/shared/types.js +3 -0
- package/dist/nodes/WeCom/shared/types.js.map +1 -0
- package/dist/package.json +56 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +56 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# n8n-nodes-wecom
|
|
2
|
+
|
|
3
|
+
这是一个 n8n 社区节点,让你可以在 [n8n](https://n8n.io/) 工作流中使用企业微信(WeChat Work)API。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
在 n8n 中通过社区节点管理界面搜索 `n8n-nodes-wecom` 进行安装,或使用命令行:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install n8n-nodes-wecom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
详细安装指南请参考 [n8n 社区节点文档](https://docs.n8n.io/integrations/community-nodes/installation/)。
|
|
14
|
+
|
|
15
|
+
## 凭证配置
|
|
16
|
+
|
|
17
|
+
### 获取企业微信凭证
|
|
18
|
+
|
|
19
|
+
1. 登录 [企业微信管理后台](https://work.weixin.qq.com/)
|
|
20
|
+
2. 进入"我的企业" > "企业信息",复制 **企业ID (CorpID)**
|
|
21
|
+
3. 进入"应用管理" > 选择或创建一个应用
|
|
22
|
+
4. 复制 **AgentId**(应用ID)
|
|
23
|
+
5. 点击"查看Secret",复制 **Secret**
|
|
24
|
+
|
|
25
|
+
### 在 n8n 中配置
|
|
26
|
+
|
|
27
|
+
1. 添加"企业微信"节点到工作流
|
|
28
|
+
2. 点击"Credential to connect with"
|
|
29
|
+
3. 选择"创建新凭证 - 企业微信 API"
|
|
30
|
+
4. 填入以下信息:
|
|
31
|
+
- **企业 ID** - 你的企业 CorpID
|
|
32
|
+
- **应用 Secret** - 应用的 Secret
|
|
33
|
+
- **应用 ID** - 应用的 AgentID
|
|
34
|
+
|
|
35
|
+
### 权限配置
|
|
36
|
+
|
|
37
|
+
确保应用具有以下权限(在应用的"API权限"中开启):
|
|
38
|
+
|
|
39
|
+
- ✅ 消息发送权限
|
|
40
|
+
- ✅ 通讯录读取权限(读取成员、部门、标签信息)
|
|
41
|
+
- ✅ 素材管理权限
|
|
42
|
+
- ✅ 应用可见范围(建议设置为全员)
|
|
43
|
+
|
|
44
|
+
## 已实现功能
|
|
45
|
+
|
|
46
|
+
### 📨 消息发送
|
|
47
|
+
|
|
48
|
+
- ✅ 发送文本消息
|
|
49
|
+
- ✅ 发送 Markdown 消息
|
|
50
|
+
- ✅ 发送图片消息
|
|
51
|
+
- ✅ 发送语音消息
|
|
52
|
+
- ✅ 发送视频消息
|
|
53
|
+
- ✅ 发送文件消息
|
|
54
|
+
- ✅ 发送文本卡片消息
|
|
55
|
+
- ✅ 发送图文消息(news)
|
|
56
|
+
- ✅ 发送图文消息(mpnews)
|
|
57
|
+
- ✅ 发送小程序通知消息
|
|
58
|
+
- ✅ 发送任务卡片消息
|
|
59
|
+
- ✅ 发送模板卡片消息
|
|
60
|
+
- ✅ 撤回应用消息
|
|
61
|
+
- ✅ 更新模板卡片消息
|
|
62
|
+
|
|
63
|
+
### 👥 通讯录管理
|
|
64
|
+
|
|
65
|
+
- ✅ 获取成员信息
|
|
66
|
+
- ✅ 获取部门成员列表
|
|
67
|
+
- ✅ 获取部门成员详情
|
|
68
|
+
- ✅ 获取成员ID列表
|
|
69
|
+
- ✅ 获取部门信息
|
|
70
|
+
- ✅ 获取标签列表
|
|
71
|
+
- ✅ 获取标签成员
|
|
72
|
+
- ✅ UserID 转 OpenID
|
|
73
|
+
- ✅ OpenID 转 UserID
|
|
74
|
+
|
|
75
|
+
### 📦 素材管理
|
|
76
|
+
|
|
77
|
+
- ✅ 上传临时素材
|
|
78
|
+
- ✅ 获取临时素材
|
|
79
|
+
- ✅ 上传永久素材
|
|
80
|
+
- ✅ 获取永久素材
|
|
81
|
+
|
|
82
|
+
## 参考资源
|
|
83
|
+
|
|
84
|
+
- [企业微信开发文档](https://developer.work.weixin.qq.com/document/)
|
|
85
|
+
- [n8n 官方文档](https://docs.n8n.io/)
|
|
86
|
+
|
|
87
|
+
## 许可证
|
|
88
|
+
|
|
89
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class WeComApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeComApi = void 0;
|
|
4
|
+
class WeComApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'weComApi';
|
|
7
|
+
this.displayName = '企业微信 API';
|
|
8
|
+
this.icon = { light: 'file:../icons/wecom.png', dark: 'file:../icons/wecom.dark.png' };
|
|
9
|
+
this.documentationUrl = 'https://developer.work.weixin.qq.com/document/path/90235';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: '企业 ID',
|
|
13
|
+
name: 'corpId',
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: '企业微信的企业 ID(CorpID)',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: '应用 Secret',
|
|
21
|
+
name: 'corpSecret',
|
|
22
|
+
type: 'string',
|
|
23
|
+
typeOptions: { password: true },
|
|
24
|
+
default: '',
|
|
25
|
+
required: true,
|
|
26
|
+
description: '企业微信应用的 Secret',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: '应用 ID',
|
|
30
|
+
name: 'agentId',
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: '',
|
|
33
|
+
required: true,
|
|
34
|
+
description: '企业微信应用的 AgentID',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
this.authenticate = {
|
|
38
|
+
type: 'generic',
|
|
39
|
+
properties: {
|
|
40
|
+
qs: {
|
|
41
|
+
access_token: '={{$credentials.accessToken}}',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
this.test = {
|
|
46
|
+
request: {
|
|
47
|
+
baseURL: 'https://qyapi.weixin.qq.com',
|
|
48
|
+
url: '/cgi-bin/user/get',
|
|
49
|
+
method: 'GET',
|
|
50
|
+
qs: {
|
|
51
|
+
userid: '@me',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.WeComApi = WeComApi;
|
|
58
|
+
//# sourceMappingURL=WeComApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeComApi.credentials.js","sourceRoot":"","sources":["../../credentials/WeComApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,QAAQ;IAArB;QACC,SAAI,GAAG,UAAU,CAAC;QAElB,gBAAW,GAAG,UAAU,CAAC;QAGzB,SAAI,GAAS,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,8BAA8B,EAAE,CAAC;QAExF,qBAAgB,GAAG,0DAA0D,CAAC;QAE9E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oBAAoB;aACjC;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gBAAgB;aAC7B;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,iBAAiB;aAC9B;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,EAAE,EAAE;oBACH,YAAY,EAAE,+BAA+B;iBAC7C;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6BAA6B;gBACtC,GAAG,EAAE,mBAAmB;gBACxB,MAAM,EAAE,KAAK;gBACb,EAAE,EAAE;oBACH,MAAM,EAAE,KAAK;iBACb;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAzDD,4BAyDC"}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class WeCom implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getDepartments(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
getDepartmentUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
8
|
+
getDepartmentUsersDetail(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
|
+
getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
+
getTagUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
11
|
+
getAllUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeCom = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const message_1 = require("./resources/message");
|
|
6
|
+
const contact_1 = require("./resources/contact");
|
|
7
|
+
const material_1 = require("./resources/material");
|
|
8
|
+
const execute_1 = require("./resources/message/execute");
|
|
9
|
+
const execute_2 = require("./resources/contact/execute");
|
|
10
|
+
const execute_3 = require("./resources/material/execute");
|
|
11
|
+
const transport_1 = require("./shared/transport");
|
|
12
|
+
class WeCom {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.description = {
|
|
15
|
+
displayName: '企业微信',
|
|
16
|
+
name: 'weCom',
|
|
17
|
+
icon: { light: 'file:../../icons/wecom.png', dark: 'file:../../icons/wecom.dark.png' },
|
|
18
|
+
group: ['transform'],
|
|
19
|
+
version: 1,
|
|
20
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
21
|
+
description: '企业微信消息发送与通讯录管理',
|
|
22
|
+
defaults: {
|
|
23
|
+
name: '企业微信',
|
|
24
|
+
},
|
|
25
|
+
usableAsTool: true,
|
|
26
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
27
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
28
|
+
credentials: [
|
|
29
|
+
{
|
|
30
|
+
name: 'weComApi',
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
requestDefaults: {
|
|
35
|
+
baseURL: 'https://qyapi.weixin.qq.com',
|
|
36
|
+
headers: {
|
|
37
|
+
Accept: 'application/json',
|
|
38
|
+
'Content-Type': 'application/json',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
properties: [
|
|
42
|
+
{
|
|
43
|
+
displayName: '资源',
|
|
44
|
+
name: 'resource',
|
|
45
|
+
type: 'options',
|
|
46
|
+
noDataExpression: true,
|
|
47
|
+
options: [
|
|
48
|
+
{
|
|
49
|
+
name: '消息',
|
|
50
|
+
value: 'message',
|
|
51
|
+
description: '发送各类消息(文本、图片、文件等)',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: '通讯录',
|
|
55
|
+
value: 'contact',
|
|
56
|
+
description: '管理通讯录(成员、部门)',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: '素材管理',
|
|
60
|
+
value: 'material',
|
|
61
|
+
description: '上传和管理素材文件',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
default: 'message',
|
|
65
|
+
},
|
|
66
|
+
...message_1.messageDescription,
|
|
67
|
+
...contact_1.contactDescription,
|
|
68
|
+
...material_1.materialDescription,
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
this.methods = {
|
|
72
|
+
loadOptions: {
|
|
73
|
+
async getDepartments() {
|
|
74
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/department/list', {});
|
|
75
|
+
const departments = response.department;
|
|
76
|
+
return departments.map((dept) => ({
|
|
77
|
+
name: dept.name,
|
|
78
|
+
value: dept.id.toString(),
|
|
79
|
+
}));
|
|
80
|
+
},
|
|
81
|
+
async getDepartmentUsers() {
|
|
82
|
+
const departmentId = this.getNodeParameter('department_id', 0) || '1';
|
|
83
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/simplelist', {}, {
|
|
84
|
+
department_id: departmentId,
|
|
85
|
+
fetch_child: 0,
|
|
86
|
+
});
|
|
87
|
+
const users = response.userlist;
|
|
88
|
+
return users.map((user) => ({
|
|
89
|
+
name: `${user.name} (${user.userid})`,
|
|
90
|
+
value: user.userid,
|
|
91
|
+
}));
|
|
92
|
+
},
|
|
93
|
+
async getDepartmentUsersDetail() {
|
|
94
|
+
const departmentId = this.getNodeParameter('department_id', 0) || '1';
|
|
95
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/list', {}, {
|
|
96
|
+
department_id: departmentId,
|
|
97
|
+
fetch_child: 0,
|
|
98
|
+
});
|
|
99
|
+
const users = response.userlist;
|
|
100
|
+
return users.map((user) => ({
|
|
101
|
+
name: user.position ? `${user.name} - ${user.position} (${user.userid})` : `${user.name} (${user.userid})`,
|
|
102
|
+
value: user.userid,
|
|
103
|
+
}));
|
|
104
|
+
},
|
|
105
|
+
async getTags() {
|
|
106
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/tag/list', {});
|
|
107
|
+
const tags = response.taglist;
|
|
108
|
+
return tags.map((tag) => ({
|
|
109
|
+
name: tag.tagname,
|
|
110
|
+
value: tag.tagid.toString(),
|
|
111
|
+
}));
|
|
112
|
+
},
|
|
113
|
+
async getTagUsers() {
|
|
114
|
+
const tagId = this.getNodeParameter('tagid', 0);
|
|
115
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/tag/get', {}, {
|
|
116
|
+
tagid: tagId,
|
|
117
|
+
});
|
|
118
|
+
const users = response.userlist;
|
|
119
|
+
return users.map((user) => ({
|
|
120
|
+
name: `${user.name} (${user.userid})`,
|
|
121
|
+
value: user.userid,
|
|
122
|
+
}));
|
|
123
|
+
},
|
|
124
|
+
async getAllUsers() {
|
|
125
|
+
const response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/list', {}, {
|
|
126
|
+
department_id: '1',
|
|
127
|
+
fetch_child: 1,
|
|
128
|
+
});
|
|
129
|
+
const users = response.userlist;
|
|
130
|
+
return users.map((user) => ({
|
|
131
|
+
name: `${user.name} (${user.userid})`,
|
|
132
|
+
value: user.userid,
|
|
133
|
+
}));
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async execute() {
|
|
139
|
+
const items = this.getInputData();
|
|
140
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
141
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
142
|
+
let returnData = [];
|
|
143
|
+
if (resource === 'message') {
|
|
144
|
+
returnData = await execute_1.executeMessage.call(this, operation, items);
|
|
145
|
+
}
|
|
146
|
+
else if (resource === 'contact') {
|
|
147
|
+
returnData = await execute_2.executeContact.call(this, operation, items);
|
|
148
|
+
}
|
|
149
|
+
else if (resource === 'material') {
|
|
150
|
+
returnData = await execute_3.executeMaterial.call(this, operation, items);
|
|
151
|
+
}
|
|
152
|
+
return [returnData];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.WeCom = WeCom;
|
|
156
|
+
//# sourceMappingURL=WeCom.node.js.map
|
|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AAc,CAAC,IAAI,CAAC,IAAI,EAAE,SAAmB,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC;aAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnC,UAAU,GAAG,MAAM,wBAAc,CAAC,IAAI,CAAC,IAAI,EAAE,SAAmB,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC;aAAM,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;YACpC,UAAU,GAAG,MAAM,yBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAmB,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAnLD,sBAmLC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.weCom",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Communication"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://developer.work.weixin.qq.com/document/path/90665"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://developer.work.weixin.qq.com/document/path/90235"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"alias": ["企业微信", "WeCom", "Work Weixin"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToOpenidDescription = void 0;
|
|
4
|
+
const showOnlyConvertToOpenid = {
|
|
5
|
+
resource: ['contact'],
|
|
6
|
+
operation: ['convertToOpenid'],
|
|
7
|
+
};
|
|
8
|
+
exports.convertToOpenidDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: '成员 Name or ID',
|
|
11
|
+
name: 'userid',
|
|
12
|
+
type: 'options',
|
|
13
|
+
typeOptions: {
|
|
14
|
+
loadOptionsMethod: 'getAllUsers',
|
|
15
|
+
},
|
|
16
|
+
required: true,
|
|
17
|
+
default: '',
|
|
18
|
+
displayOptions: {
|
|
19
|
+
show: showOnlyConvertToOpenid,
|
|
20
|
+
},
|
|
21
|
+
description: '企业成员的 userid. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=convertToOpenid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertToOpenid.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/contact/convertToOpenid.ts"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,GAAG;IAC/B,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,iBAAiB,CAAC;CAC9B,CAAC;AAEW,QAAA,0BAA0B,GAAsB;IAC5D;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,aAAa;SAChC;QACD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE,uBAAuB;SAC7B;QACD,WAAW,EAAE,+HAA+H;KAC5I;CACD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToUseridDescription = void 0;
|
|
4
|
+
const showOnlyConvertToUserid = {
|
|
5
|
+
resource: ['contact'],
|
|
6
|
+
operation: ['convertToUserid'],
|
|
7
|
+
};
|
|
8
|
+
exports.convertToUseridDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'OpenID',
|
|
11
|
+
name: 'openid',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true,
|
|
14
|
+
default: '',
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: showOnlyConvertToUserid,
|
|
17
|
+
},
|
|
18
|
+
description: '在使用企业支付之后,返回结果的 openid',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
//# sourceMappingURL=convertToUserid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertToUserid.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/contact/convertToUserid.ts"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,GAAG;IAC/B,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,iBAAiB,CAAC;CAC9B,CAAC;AAEW,QAAA,0BAA0B,GAAsB;IAC5D;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE,uBAAuB;SAC7B;QACD,WAAW,EAAE,wBAAwB;KACrC;CACD,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeContact = executeContact;
|
|
4
|
+
const transport_1 = require("../../shared/transport");
|
|
5
|
+
async function executeContact(operation, items) {
|
|
6
|
+
const returnData = [];
|
|
7
|
+
for (let i = 0; i < items.length; i++) {
|
|
8
|
+
try {
|
|
9
|
+
let response;
|
|
10
|
+
if (operation === 'getUser') {
|
|
11
|
+
const userid = this.getNodeParameter('userid', i);
|
|
12
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/get', {}, { userid });
|
|
13
|
+
}
|
|
14
|
+
else if (operation === 'listUsers') {
|
|
15
|
+
const department_id = this.getNodeParameter('department_id', i, '1');
|
|
16
|
+
const fetch_child = this.getNodeParameter('fetch_child', i, false);
|
|
17
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/simplelist', {}, {
|
|
18
|
+
department_id,
|
|
19
|
+
fetch_child: fetch_child ? 1 : 0,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else if (operation === 'listUsersDetail') {
|
|
23
|
+
const department_id = this.getNodeParameter('department_id', i, '1');
|
|
24
|
+
const fetch_child = this.getNodeParameter('fetch_child', i, false);
|
|
25
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/user/list', {}, {
|
|
26
|
+
department_id,
|
|
27
|
+
fetch_child: fetch_child ? 1 : 0,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else if (operation === 'listUserIds') {
|
|
31
|
+
const cursor = this.getNodeParameter('cursor', i, '');
|
|
32
|
+
const limit = this.getNodeParameter('limit', i, 1000);
|
|
33
|
+
response = await transport_1.weComApiRequest.call(this, 'POST', '/cgi-bin/user/list_id', {
|
|
34
|
+
cursor,
|
|
35
|
+
limit,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else if (operation === 'getDepartment') {
|
|
39
|
+
const id = this.getNodeParameter('id', i, '');
|
|
40
|
+
const qs = {};
|
|
41
|
+
if (id) {
|
|
42
|
+
qs.id = id;
|
|
43
|
+
}
|
|
44
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/department/list', {}, qs);
|
|
45
|
+
}
|
|
46
|
+
else if (operation === 'convertToOpenid') {
|
|
47
|
+
const userid = this.getNodeParameter('userid', i);
|
|
48
|
+
response = await transport_1.weComApiRequest.call(this, 'POST', '/cgi-bin/user/convert_to_openid', { userid });
|
|
49
|
+
}
|
|
50
|
+
else if (operation === 'convertToUserid') {
|
|
51
|
+
const openid = this.getNodeParameter('openid', i);
|
|
52
|
+
response = await transport_1.weComApiRequest.call(this, 'POST', '/cgi-bin/user/convert_to_userid', { openid });
|
|
53
|
+
}
|
|
54
|
+
else if (operation === 'getTagList') {
|
|
55
|
+
const tag_type = this.getNodeParameter('tag_type', i, '');
|
|
56
|
+
const qs = {};
|
|
57
|
+
if (tag_type) {
|
|
58
|
+
qs.tag_type = tag_type;
|
|
59
|
+
}
|
|
60
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/tag/list', {}, qs);
|
|
61
|
+
}
|
|
62
|
+
else if (operation === 'getTag') {
|
|
63
|
+
const tagid = this.getNodeParameter('tagid', i);
|
|
64
|
+
response = await transport_1.weComApiRequest.call(this, 'GET', '/cgi-bin/tag/get', {}, { tagid });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
response = {};
|
|
68
|
+
}
|
|
69
|
+
returnData.push({
|
|
70
|
+
json: response,
|
|
71
|
+
pairedItem: { item: i },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (this.continueOnFail()) {
|
|
76
|
+
returnData.push({
|
|
77
|
+
json: {
|
|
78
|
+
error: error.message,
|
|
79
|
+
},
|
|
80
|
+
pairedItem: { item: i },
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return returnData;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/contact/execute.ts"],"names":[],"mappings":";;AAGA,wCAgHC;AAlHD,sDAAyD;AAElD,KAAK,UAAU,cAAc,CAEnC,SAAiB,EACjB,KAA2B;IAE3B,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC;YACJ,IAAI,QAAqB,CAAC;YAE1B,IAAI,SAAS,KAAK,SAAS,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Property(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDepartmentDescription = void 0;
|
|
4
|
+
const showOnlyGetDepartment = {
|
|
5
|
+
resource: ['contact'],
|
|
6
|
+
operation: ['getDepartment'],
|
|
7
|
+
};
|
|
8
|
+
exports.getDepartmentDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: '部门 Name or ID',
|
|
11
|
+
name: 'id',
|
|
12
|
+
type: 'options',
|
|
13
|
+
typeOptions: {
|
|
14
|
+
loadOptionsMethod: 'getDepartments',
|
|
15
|
+
},
|
|
16
|
+
default: '',
|
|
17
|
+
displayOptions: {
|
|
18
|
+
show: showOnlyGetDepartment,
|
|
19
|
+
},
|
|
20
|
+
description: '部门ID。(注:如果不填,默认获取全量组织架构). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=getDepartment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDepartment.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/contact/getDepartment.ts"],"names":[],"mappings":";;;AAEA,MAAM,qBAAqB,GAAG;IAC7B,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,eAAe,CAAC;CAC5B,CAAC;AAEW,QAAA,wBAAwB,GAAsB;IAC1D;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE,qBAAqB;SAC3B;QACD,WAAW,EAAE,2IAA2I;KACxJ;CACD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTagDescription = void 0;
|
|
4
|
+
const showOnlyGetTag = {
|
|
5
|
+
resource: ['contact'],
|
|
6
|
+
operation: ['getTag'],
|
|
7
|
+
};
|
|
8
|
+
exports.getTagDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: '标签 Name or ID',
|
|
11
|
+
name: 'tagid',
|
|
12
|
+
type: 'options',
|
|
13
|
+
typeOptions: {
|
|
14
|
+
loadOptionsMethod: 'getTags',
|
|
15
|
+
},
|
|
16
|
+
required: true,
|
|
17
|
+
default: '',
|
|
18
|
+
displayOptions: {
|
|
19
|
+
show: showOnlyGetTag,
|
|
20
|
+
},
|
|
21
|
+
description: '标签 ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=getTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTag.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/contact/getTag.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG;IACtB,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;CACrB,CAAC;AAEW,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,SAAS;SAC5B;QACD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE,cAAc;SACpB;QACD,WAAW,EAAE,wHAAwH;KACrI;CACD,CAAC"}
|