n8n-nodes-wecom 0.1.3 → 0.1.5
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/README.md +45 -9
- package/dist/credentials/WeComWebhookApi.credentials.d.ts +13 -0
- package/dist/credentials/WeComWebhookApi.credentials.js +44 -0
- package/dist/credentials/WeComWebhookApi.credentials.js.map +1 -0
- package/dist/nodes/WeCom/WeCom.node.js +34 -9
- package/dist/nodes/WeCom/WeCom.node.js.map +1 -1
- package/dist/nodes/WeCom/resources/pushMessage/execute.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/execute.js +176 -0
- package/dist/nodes/WeCom/resources/pushMessage/execute.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/index.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/index.js +85 -0
- package/dist/nodes/WeCom/resources/pushMessage/index.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendFile.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendFile.js +22 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendFile.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendImage.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendImage.js +65 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendImage.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdown.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdown.js +25 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdown.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdownV2.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdownV2.js +25 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendMarkdownV2.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendNews.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendNews.js +68 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendNews.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendTemplateCard.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendTemplateCard.js +431 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendTemplateCard.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendText.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendText.js +47 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendText.js.map +1 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendVoice.d.ts +2 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendVoice.js +22 -0
- package/dist/nodes/WeCom/resources/pushMessage/sendVoice.js.map +1 -0
- package/dist/nodes/WeCom/shared/types.d.ts +8 -0
- package/dist/package.json +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -14,7 +14,20 @@ npm install n8n-nodes-wecom
|
|
|
14
14
|
|
|
15
15
|
## 凭证配置
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### 消息推送功能(群机器人 Webhook)
|
|
18
|
+
|
|
19
|
+
**消息推送**功能用于通过群机器人 Webhook 发送消息到企业微信群聊。此功能特点:
|
|
20
|
+
- 使用群机器人的 Webhook URL 发送消息
|
|
21
|
+
- 无需配置企业ID、应用Secret等复杂凭证
|
|
22
|
+
- 适合快速发送通知消息到群聊
|
|
23
|
+
|
|
24
|
+
#### 配置步骤:
|
|
25
|
+
1. 在企业微信群聊中,点击右上角"..."菜单
|
|
26
|
+
2. 选择"群机器人" > "添加机器人"
|
|
27
|
+
3. 创建一个机器人并复制 Webhook 地址
|
|
28
|
+
4. 在 n8n 中配置"企业微信群机器人 Webhook"凭证,填入 Webhook 地址
|
|
29
|
+
|
|
30
|
+
### 获取企业微信凭证(消息发送、通讯录、素材管理功能需要)
|
|
18
31
|
|
|
19
32
|
1. 登录 [企业微信管理后台](https://work.weixin.qq.com/)
|
|
20
33
|
2. 进入"我的企业" > "企业信息",复制 **企业ID (CorpID)**
|
|
@@ -25,25 +38,48 @@ npm install n8n-nodes-wecom
|
|
|
25
38
|
### 在 n8n 中配置
|
|
26
39
|
|
|
27
40
|
1. 添加"企业微信"节点到工作流
|
|
28
|
-
2.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
41
|
+
2. 根据使用的功能选择对应的凭证:
|
|
42
|
+
|
|
43
|
+
**消息推送(群机器人):**
|
|
44
|
+
- 点击"Credential to connect with"
|
|
45
|
+
- 选择"创建新凭证 - 企业微信群机器人 Webhook"
|
|
46
|
+
- 填入群机器人的 Webhook URL
|
|
47
|
+
|
|
48
|
+
**应用消息、通讯录、素材管理:**
|
|
49
|
+
- 点击"Credential to connect with"
|
|
50
|
+
- 选择"创建新凭证 - 企业微信 API"
|
|
51
|
+
- 填入以下信息:
|
|
52
|
+
- **企业 ID** - 你的企业 CorpID
|
|
53
|
+
- **应用 Secret** - 应用的 Secret
|
|
54
|
+
- **应用 ID** - 应用的 AgentID
|
|
34
55
|
|
|
35
56
|
### 权限配置
|
|
36
57
|
|
|
37
58
|
确保应用具有以下权限(在应用的"API权限"中开启):
|
|
38
59
|
|
|
39
|
-
- ✅
|
|
60
|
+
- ✅ 消息发送权限(用于应用消息)
|
|
40
61
|
- ✅ 通讯录读取权限(读取成员、部门、标签信息)
|
|
41
62
|
- ✅ 素材管理权限
|
|
42
63
|
- ✅ 应用可见范围(建议设置为全员)
|
|
43
64
|
|
|
65
|
+
**注意**:消息推送功能使用群机器人,无需配置应用权限
|
|
66
|
+
|
|
44
67
|
## 已实现功能
|
|
45
68
|
|
|
46
|
-
###
|
|
69
|
+
### 📩 消息推送(群机器人 Webhook)
|
|
70
|
+
|
|
71
|
+
- ✅ 发送文本消息(支持@成员)
|
|
72
|
+
- ✅ 发送 Markdown 消息
|
|
73
|
+
- ✅ 发送 Markdown V2 消息
|
|
74
|
+
- ✅ 发送图片消息
|
|
75
|
+
- ✅ 发送图文消息
|
|
76
|
+
- ✅ 发送文件消息
|
|
77
|
+
- ✅ 发送语音消息
|
|
78
|
+
- ✅ 发送模板卡片消息
|
|
79
|
+
- 文本通知模板卡片
|
|
80
|
+
- 图文展示模板卡片
|
|
81
|
+
|
|
82
|
+
### 📨 应用消息发送
|
|
47
83
|
|
|
48
84
|
- ✅ 发送文本消息
|
|
49
85
|
- ✅ 发送 Markdown 消息
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class WeComWebhookApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: {
|
|
7
|
+
readonly light: "file:../icons/wecom.png";
|
|
8
|
+
readonly dark: "file:../icons/wecom.dark.png";
|
|
9
|
+
};
|
|
10
|
+
properties: INodeProperties[];
|
|
11
|
+
authenticate: IAuthenticateGeneric;
|
|
12
|
+
test: ICredentialTestRequest;
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeComWebhookApi = void 0;
|
|
4
|
+
class WeComWebhookApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'weComWebhookApi';
|
|
7
|
+
this.displayName = '企业微信群机器人 Webhook API';
|
|
8
|
+
this.documentationUrl = 'https://developer.work.weixin.qq.com/document/path/91770';
|
|
9
|
+
this.icon = { light: 'file:../icons/wecom.png', dark: 'file:../icons/wecom.dark.png' };
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Webhook URL',
|
|
13
|
+
name: 'webhookUrl',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: {
|
|
16
|
+
password: true,
|
|
17
|
+
},
|
|
18
|
+
default: '',
|
|
19
|
+
required: true,
|
|
20
|
+
placeholder: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx',
|
|
21
|
+
description: '企业微信群机器人的 Webhook 地址',
|
|
22
|
+
hint: '在企业微信群聊中添加机器人后获取',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
this.authenticate = {
|
|
26
|
+
type: 'generic',
|
|
27
|
+
properties: {},
|
|
28
|
+
};
|
|
29
|
+
this.test = {
|
|
30
|
+
request: {
|
|
31
|
+
baseURL: '={{$credentials.webhookUrl}}',
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: {
|
|
34
|
+
msgtype: 'text',
|
|
35
|
+
text: {
|
|
36
|
+
content: 'n8n 凭证测试消息',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.WeComWebhookApi = WeComWebhookApi;
|
|
44
|
+
//# sourceMappingURL=WeComWebhookApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WeComWebhookApi.credentials.js","sourceRoot":"","sources":["../../credentials/WeComWebhookApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,sBAAsB,CAAC;QAErC,qBAAgB,GAAG,0DAA0D,CAAC;QAE9E,SAAI,GAAG,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,8BAA8B,EAAW,CAAC;QAE3F,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+DAA+D;gBAC5E,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,kBAAkB;aACxB;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,EAAE;SACd,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,8BAA8B;gBACvC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,IAAI,EAAE;wBACL,OAAO,EAAE,YAAY;qBACrB;iBACD;aACD;SACD,CAAC;IACH,CAAC;CAAA;AA1CD,0CA0CC"}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WeCom = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const pushMessage_1 = require("./resources/pushMessage");
|
|
5
6
|
const message_1 = require("./resources/message");
|
|
6
7
|
const contact_1 = require("./resources/contact");
|
|
7
8
|
const material_1 = require("./resources/material");
|
|
8
|
-
const execute_1 = require("./resources/
|
|
9
|
-
const execute_2 = require("./resources/
|
|
10
|
-
const execute_3 = require("./resources/
|
|
9
|
+
const execute_1 = require("./resources/pushMessage/execute");
|
|
10
|
+
const execute_2 = require("./resources/message/execute");
|
|
11
|
+
const execute_3 = require("./resources/contact/execute");
|
|
12
|
+
const execute_4 = require("./resources/material/execute");
|
|
11
13
|
const transport_1 = require("./shared/transport");
|
|
12
14
|
class WeCom {
|
|
13
15
|
constructor() {
|
|
@@ -26,9 +28,23 @@ class WeCom {
|
|
|
26
28
|
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
27
29
|
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
28
30
|
credentials: [
|
|
31
|
+
{
|
|
32
|
+
name: 'weComWebhookApi',
|
|
33
|
+
required: true,
|
|
34
|
+
displayOptions: {
|
|
35
|
+
show: {
|
|
36
|
+
resource: ['pushMessage'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
29
40
|
{
|
|
30
41
|
name: 'weComApi',
|
|
31
42
|
required: true,
|
|
43
|
+
displayOptions: {
|
|
44
|
+
show: {
|
|
45
|
+
resource: ['message', 'contact', 'material'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
32
48
|
},
|
|
33
49
|
],
|
|
34
50
|
requestDefaults: {
|
|
@@ -46,7 +62,12 @@ class WeCom {
|
|
|
46
62
|
noDataExpression: true,
|
|
47
63
|
options: [
|
|
48
64
|
{
|
|
49
|
-
name: '
|
|
65
|
+
name: '消息推送',
|
|
66
|
+
value: 'pushMessage',
|
|
67
|
+
description: '通过群机器人 Webhook 发送消息到群聊',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: '应用消息',
|
|
50
71
|
value: 'message',
|
|
51
72
|
description: '发送各类消息(文本、图片、文件等)',
|
|
52
73
|
},
|
|
@@ -61,8 +82,9 @@ class WeCom {
|
|
|
61
82
|
description: '上传和管理素材文件',
|
|
62
83
|
},
|
|
63
84
|
],
|
|
64
|
-
default: '
|
|
85
|
+
default: 'pushMessage',
|
|
65
86
|
},
|
|
87
|
+
...pushMessage_1.pushMessageDescription,
|
|
66
88
|
...message_1.messageDescription,
|
|
67
89
|
...contact_1.contactDescription,
|
|
68
90
|
...material_1.materialDescription,
|
|
@@ -140,14 +162,17 @@ class WeCom {
|
|
|
140
162
|
const resource = this.getNodeParameter('resource', 0);
|
|
141
163
|
const operation = this.getNodeParameter('operation', 0);
|
|
142
164
|
let returnData = [];
|
|
143
|
-
if (resource === '
|
|
144
|
-
returnData = await execute_1.
|
|
165
|
+
if (resource === 'pushMessage') {
|
|
166
|
+
returnData = await execute_1.executePushMessage.call(this, operation, items);
|
|
167
|
+
}
|
|
168
|
+
else if (resource === 'message') {
|
|
169
|
+
returnData = await execute_2.executeMessage.call(this, operation, items);
|
|
145
170
|
}
|
|
146
171
|
else if (resource === 'contact') {
|
|
147
|
-
returnData = await
|
|
172
|
+
returnData = await execute_3.executeContact.call(this, operation, items);
|
|
148
173
|
}
|
|
149
174
|
else if (resource === 'material') {
|
|
150
|
-
returnData = await
|
|
175
|
+
returnData = await execute_4.executeMaterial.call(this, operation, items);
|
|
151
176
|
}
|
|
152
177
|
return [returnData];
|
|
153
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeCom.node.js","sourceRoot":"","sources":["../../../nodes/WeCom/WeCom.node.ts"],"names":[],"mappings":";;;AAQA,+CAAmD;AACnD,iDAAyD;AACzD,iDAAyD;AACzD,mDAA2D;AAC3D,yDAA6D;AAC7D,yDAA6D;AAC7D,0DAA+D;AAC/D,kDAAqD;AAErD,MAAa,KAAK;IAAlB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,OAAO;YAEb,IAAI,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE;YACtF,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE;gBACT,IAAI,EAAE,MAAM;aACZ;YACD,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"WeCom.node.js","sourceRoot":"","sources":["../../../nodes/WeCom/WeCom.node.ts"],"names":[],"mappings":";;;AAQA,+CAAmD;AACnD,yDAAiE;AACjE,iDAAyD;AACzD,iDAAyD;AACzD,mDAA2D;AAC3D,6DAAqE;AACrE,yDAA6D;AAC7D,yDAA6D;AAC7D,0DAA+D;AAC/D,kDAAqD;AAErD,MAAa,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E,CAAC,CAAC,CAAC;QAExD,IAAI,UAAU,GAAyB,EAAE,CAAC;QAE1C,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;YAChC,UAAU,GAAG,MAAM,4BAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAmB,EAAE,KAAK,CAAC,CAAC;QAC9E,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,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;AAzMD,sBAyMC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executePushMessage = executePushMessage;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
async function executePushMessage(operation, items) {
|
|
6
|
+
const returnData = [];
|
|
7
|
+
for (let i = 0; i < items.length; i++) {
|
|
8
|
+
try {
|
|
9
|
+
const credentials = await this.getCredentials('weComWebhookApi');
|
|
10
|
+
const webhookUrl = credentials.webhookUrl;
|
|
11
|
+
let body = {};
|
|
12
|
+
if (operation === 'sendText') {
|
|
13
|
+
const content = this.getNodeParameter('content', i);
|
|
14
|
+
const mentionedList = this.getNodeParameter('mentionedList', i, '');
|
|
15
|
+
const mentionedMobileList = this.getNodeParameter('mentionedMobileList', i, '');
|
|
16
|
+
body = {
|
|
17
|
+
msgtype: 'text',
|
|
18
|
+
text: {
|
|
19
|
+
content,
|
|
20
|
+
...(mentionedList && {
|
|
21
|
+
mentioned_list: mentionedList.split('|').map((id) => id.trim()),
|
|
22
|
+
}),
|
|
23
|
+
...(mentionedMobileList && {
|
|
24
|
+
mentioned_mobile_list: mentionedMobileList.split('|').map((mobile) => mobile.trim()),
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else if (operation === 'sendMarkdown') {
|
|
30
|
+
const content = this.getNodeParameter('content', i);
|
|
31
|
+
body = {
|
|
32
|
+
msgtype: 'markdown',
|
|
33
|
+
markdown: {
|
|
34
|
+
content,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else if (operation === 'sendImage') {
|
|
39
|
+
const imageSource = this.getNodeParameter('imageSource', i);
|
|
40
|
+
if (imageSource === 'base64') {
|
|
41
|
+
const base64 = this.getNodeParameter('base64', i);
|
|
42
|
+
body = {
|
|
43
|
+
msgtype: 'image',
|
|
44
|
+
image: {
|
|
45
|
+
base64,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const md5 = this.getNodeParameter('md5', i);
|
|
51
|
+
body = {
|
|
52
|
+
msgtype: 'image',
|
|
53
|
+
image: {
|
|
54
|
+
md5,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (operation === 'sendNews') {
|
|
60
|
+
const articlesData = this.getNodeParameter('articles', i);
|
|
61
|
+
const articles = articlesData.article || [];
|
|
62
|
+
body = {
|
|
63
|
+
msgtype: 'news',
|
|
64
|
+
news: {
|
|
65
|
+
articles: articles.map((article) => ({
|
|
66
|
+
title: article.title,
|
|
67
|
+
description: article.description,
|
|
68
|
+
url: article.url,
|
|
69
|
+
picurl: article.picurl,
|
|
70
|
+
})),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
else if (operation === 'sendMarkdownV2') {
|
|
75
|
+
const content = this.getNodeParameter('content', i);
|
|
76
|
+
body = {
|
|
77
|
+
msgtype: 'markdown_v2',
|
|
78
|
+
markdown_v2: {
|
|
79
|
+
content,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else if (operation === 'sendFile') {
|
|
84
|
+
const mediaId = this.getNodeParameter('mediaId', i);
|
|
85
|
+
body = {
|
|
86
|
+
msgtype: 'file',
|
|
87
|
+
file: {
|
|
88
|
+
media_id: mediaId,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
else if (operation === 'sendVoice') {
|
|
93
|
+
const mediaId = this.getNodeParameter('mediaId', i);
|
|
94
|
+
body = {
|
|
95
|
+
msgtype: 'voice',
|
|
96
|
+
voice: {
|
|
97
|
+
media_id: mediaId,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else if (operation === 'sendTemplateCard') {
|
|
102
|
+
const cardType = this.getNodeParameter('cardType', i);
|
|
103
|
+
const templateCard = {
|
|
104
|
+
card_type: cardType,
|
|
105
|
+
};
|
|
106
|
+
const sourceData = this.getNodeParameter('source', i, {});
|
|
107
|
+
if (sourceData.sourceValue) {
|
|
108
|
+
templateCard.source = sourceData.sourceValue;
|
|
109
|
+
}
|
|
110
|
+
const mainTitleData = this.getNodeParameter('mainTitle', i);
|
|
111
|
+
if (mainTitleData.mainTitleValue) {
|
|
112
|
+
templateCard.main_title = mainTitleData.mainTitleValue;
|
|
113
|
+
}
|
|
114
|
+
if (cardType === 'text_notice') {
|
|
115
|
+
const emphasisData = this.getNodeParameter('emphasisContent', i, {});
|
|
116
|
+
if (emphasisData.emphasisValue) {
|
|
117
|
+
templateCard.emphasis_content = emphasisData.emphasisValue;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (cardType === 'news_notice') {
|
|
121
|
+
const imageTextData = this.getNodeParameter('imageTextArea', i, {});
|
|
122
|
+
if (imageTextData.imageTextValue) {
|
|
123
|
+
templateCard.image_text_area = imageTextData.imageTextValue;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const subTitleText = this.getNodeParameter('subTitleText', i, '');
|
|
127
|
+
if (subTitleText) {
|
|
128
|
+
templateCard.sub_title_text = subTitleText;
|
|
129
|
+
}
|
|
130
|
+
const horizontalData = this.getNodeParameter('horizontalContentList', i, {});
|
|
131
|
+
if (horizontalData.item && Array.isArray(horizontalData.item)) {
|
|
132
|
+
templateCard.horizontal_content_list = horizontalData.item;
|
|
133
|
+
}
|
|
134
|
+
const jumpListData = this.getNodeParameter('jumpList', i, {});
|
|
135
|
+
if (jumpListData.jump && Array.isArray(jumpListData.jump)) {
|
|
136
|
+
templateCard.jump_list = jumpListData.jump;
|
|
137
|
+
}
|
|
138
|
+
const cardActionData = this.getNodeParameter('cardAction', i, {});
|
|
139
|
+
if (cardActionData.actionValue) {
|
|
140
|
+
templateCard.card_action = cardActionData.actionValue;
|
|
141
|
+
}
|
|
142
|
+
body = {
|
|
143
|
+
msgtype: 'template_card',
|
|
144
|
+
template_card: templateCard,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `不支持的操作: ${operation}`, { itemIndex: i });
|
|
149
|
+
}
|
|
150
|
+
const response = await this.helpers.httpRequest({
|
|
151
|
+
method: 'POST',
|
|
152
|
+
url: webhookUrl,
|
|
153
|
+
body,
|
|
154
|
+
json: true,
|
|
155
|
+
});
|
|
156
|
+
returnData.push({
|
|
157
|
+
json: response,
|
|
158
|
+
pairedItem: { item: i },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (this.continueOnFail()) {
|
|
163
|
+
returnData.push({
|
|
164
|
+
json: {
|
|
165
|
+
error: error.message,
|
|
166
|
+
},
|
|
167
|
+
pairedItem: { item: i },
|
|
168
|
+
});
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return returnData;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/pushMessage/execute.ts"],"names":[],"mappings":";;AAGA,gDA0NC;AA5ND,+CAAkD;AAE3C,KAAK,UAAU,kBAAkB,CAEvC,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,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YACjE,MAAM,UAAU,GAAG,WAAW,CAAC,UAAoB,CAAC;YAEpD,IAAI,IAAI,GAAgB,EAAE,CAAC;YAE3B,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;gBAE9B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAW,CAAC;gBAC9D,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;gBAC9E,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;gBAE1F,IAAI,GAAG;oBACN,OAAO,EAAE,MAAM;oBACf,IAAI,EAAE;wBACL,OAAO;wBACP,GAAG,CAAC,aAAa,IAAI;4BACpB,cAAc,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAA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AAE;aACvB,CAAC,CAAC;QAEJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,UAAU,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE;wBACL,KAAK,EAAG,KAAe,CAAC,OAAO;qBAC/B;oBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;iBACvB,CAAC,CAAC;gBACH,SAAS;YACV,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushMessageDescription = void 0;
|
|
4
|
+
const sendText_1 = require("./sendText");
|
|
5
|
+
const sendMarkdown_1 = require("./sendMarkdown");
|
|
6
|
+
const sendMarkdownV2_1 = require("./sendMarkdownV2");
|
|
7
|
+
const sendImage_1 = require("./sendImage");
|
|
8
|
+
const sendNews_1 = require("./sendNews");
|
|
9
|
+
const sendFile_1 = require("./sendFile");
|
|
10
|
+
const sendVoice_1 = require("./sendVoice");
|
|
11
|
+
const sendTemplateCard_1 = require("./sendTemplateCard");
|
|
12
|
+
const showOnlyForPushMessage = {
|
|
13
|
+
resource: ['pushMessage'],
|
|
14
|
+
};
|
|
15
|
+
exports.pushMessageDescription = [
|
|
16
|
+
{
|
|
17
|
+
displayName: '操作',
|
|
18
|
+
name: 'operation',
|
|
19
|
+
type: 'options',
|
|
20
|
+
noDataExpression: true,
|
|
21
|
+
displayOptions: {
|
|
22
|
+
show: showOnlyForPushMessage,
|
|
23
|
+
},
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
name: '发送 Markdown V2 消息',
|
|
27
|
+
value: 'sendMarkdownV2',
|
|
28
|
+
action: '发送 Markdown V2 消息',
|
|
29
|
+
description: '发送 Markdown V2 格式的消息到群聊',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: '发送 Markdown 消息',
|
|
33
|
+
value: 'sendMarkdown',
|
|
34
|
+
action: '发送 Markdown 消息',
|
|
35
|
+
description: '发送 Markdown 格式的消息到群聊',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: '发送图文消息',
|
|
39
|
+
value: 'sendNews',
|
|
40
|
+
action: '发送图文消息',
|
|
41
|
+
description: '发送图文消息到群聊',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: '发送图片消息',
|
|
45
|
+
value: 'sendImage',
|
|
46
|
+
action: '发送图片消息',
|
|
47
|
+
description: '发送图片消息到群聊',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: '发送文件消息',
|
|
51
|
+
value: 'sendFile',
|
|
52
|
+
action: '发送文件消息',
|
|
53
|
+
description: '发送文件消息到群聊',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: '发送文本消息',
|
|
57
|
+
value: 'sendText',
|
|
58
|
+
action: '发送文本消息',
|
|
59
|
+
description: '发送文本消息到群聊',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: '发送模板卡片消息',
|
|
63
|
+
value: 'sendTemplateCard',
|
|
64
|
+
action: '发送模板卡片消息',
|
|
65
|
+
description: '发送模板卡片消息到群聊',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: '发送语音消息',
|
|
69
|
+
value: 'sendVoice',
|
|
70
|
+
action: '发送语音消息',
|
|
71
|
+
description: '发送语音消息到群聊',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
default: 'sendText',
|
|
75
|
+
},
|
|
76
|
+
...sendText_1.sendTextDescription,
|
|
77
|
+
...sendMarkdown_1.sendMarkdownDescription,
|
|
78
|
+
...sendMarkdownV2_1.sendMarkdownV2Description,
|
|
79
|
+
...sendImage_1.sendImageDescription,
|
|
80
|
+
...sendNews_1.sendNewsDescription,
|
|
81
|
+
...sendFile_1.sendFileDescription,
|
|
82
|
+
...sendVoice_1.sendVoiceDescription,
|
|
83
|
+
...sendTemplateCard_1.sendTemplateCardDescription,
|
|
84
|
+
];
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/pushMessage/index.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AACjD,iDAAyD;AACzD,qDAA6D;AAC7D,2CAAmD;AACnD,yCAAiD;AACjD,yCAAiD;AACjD,2CAAmD;AACnD,yDAAiE;AAEjE,MAAM,sBAAsB,GAAG;IAC9B,QAAQ,EAAE,CAAC,aAAa,CAAC;CACzB,CAAC;AAEW,QAAA,sBAAsB,GAAsB;IACxD;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE,sBAAsB;SAC5B;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,mBAAmB;gBACzB,KAAK,EAAE,gBAAgB;gBACvB,MAAM,EAAE,mBAAmB;gBAC3B,WAAW,EAAE,yBAAyB;aACtC;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EAAE,cAAc;gBACrB,MAAM,EAAE,gBAAgB;gBACxB,WAAW,EAAE,sBAAsB;aACnC;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,WAAW;aACxB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,WAAW;aACxB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,WAAW;aACxB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,WAAW;aACxB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,kBAAkB;gBACzB,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE,aAAa;aAC1B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,WAAW;aACxB;SACD;QACD,OAAO,EAAE,UAAU;KACnB;IACD,GAAG,8BAAmB;IACtB,GAAG,sCAAuB;IAC1B,GAAG,0CAAyB;IAC5B,GAAG,gCAAoB;IACvB,GAAG,8BAAmB;IACtB,GAAG,8BAAmB;IACtB,GAAG,gCAAoB;IACvB,GAAG,8CAA2B;CAC9B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendFileDescription = void 0;
|
|
4
|
+
const showOnlyForSendFile = {
|
|
5
|
+
resource: ['pushMessage'],
|
|
6
|
+
operation: ['sendFile'],
|
|
7
|
+
};
|
|
8
|
+
exports.sendFileDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Media ID',
|
|
11
|
+
name: 'mediaId',
|
|
12
|
+
type: 'string',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: showOnlyForSendFile,
|
|
15
|
+
},
|
|
16
|
+
default: '',
|
|
17
|
+
required: true,
|
|
18
|
+
description: '文件的 media_id',
|
|
19
|
+
hint: '通过上传临时素材接口获取',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=sendFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendFile.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/pushMessage/sendFile.ts"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG;IAC3B,QAAQ,EAAE,CAAC,aAAa,CAAC;IACzB,SAAS,EAAE,CAAC,UAAU,CAAC;CACvB,CAAC;AAEW,QAAA,mBAAmB,GAAsB;IACrD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE,mBAAmB;SACzB;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,cAAc;KACpB;CACD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendImageDescription = void 0;
|
|
4
|
+
const showOnlyForSendImage = {
|
|
5
|
+
resource: ['pushMessage'],
|
|
6
|
+
operation: ['sendImage'],
|
|
7
|
+
};
|
|
8
|
+
exports.sendImageDescription = [
|
|
9
|
+
{
|
|
10
|
+
displayName: '图片来源',
|
|
11
|
+
name: 'imageSource',
|
|
12
|
+
type: 'options',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: showOnlyForSendImage,
|
|
15
|
+
},
|
|
16
|
+
options: [
|
|
17
|
+
{
|
|
18
|
+
name: 'Base64',
|
|
19
|
+
value: 'base64',
|
|
20
|
+
description: '使用 Base64 编码的图片',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'MD5',
|
|
24
|
+
value: 'md5',
|
|
25
|
+
description: '使用图片的 MD5 值',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
default: 'base64',
|
|
29
|
+
description: '选择图片的提供方式',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Base64 图片',
|
|
33
|
+
name: 'base64',
|
|
34
|
+
type: 'string',
|
|
35
|
+
typeOptions: {
|
|
36
|
+
rows: 4,
|
|
37
|
+
},
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
...showOnlyForSendImage,
|
|
41
|
+
imageSource: ['base64'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
default: '',
|
|
45
|
+
required: true,
|
|
46
|
+
description: '图片的 Base64 编码(不含data:image前缀)',
|
|
47
|
+
hint: '图片(base64编码前)最大不能超过2M,支持JPG、PNG格式',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'MD5 值',
|
|
51
|
+
name: 'md5',
|
|
52
|
+
type: 'string',
|
|
53
|
+
displayOptions: {
|
|
54
|
+
show: {
|
|
55
|
+
...showOnlyForSendImage,
|
|
56
|
+
imageSource: ['md5'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
default: '',
|
|
60
|
+
required: true,
|
|
61
|
+
description: '图片内容的 MD5 值',
|
|
62
|
+
hint: '用于校验图片内容',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
//# sourceMappingURL=sendImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendImage.js","sourceRoot":"","sources":["../../../../../nodes/WeCom/resources/pushMessage/sendImage.ts"],"names":[],"mappings":";;;AAEA,MAAM,oBAAoB,GAAG;IAC5B,QAAQ,EAAE,CAAC,aAAa,CAAC;IACzB,SAAS,EAAE,CAAC,WAAW,CAAC;CACxB,CAAC;AAEW,QAAA,oBAAoB,GAAsB;IACtD;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE;YACf,IAAI,EAAE,oBAAoB;SAC1B;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,iBAAiB;aAC9B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,aAAa;aAC1B;SACD;QACD,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,WAAW;KACxB;IACD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,GAAG,oBAAoB;gBACvB,WAAW,EAAE,CAAC,QAAQ,CAAC;aACvB;SACD;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,mCAAmC;KACzC;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,GAAG,oBAAoB;gBACvB,WAAW,EAAE,CAAC,KAAK,CAAC;aACpB;SACD;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,UAAU;KAChB;CACD,CAAC"}
|