@green-api/n8n-nodes-telegram-greenapi 0.0.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 +113 -0
- package/dist/credentials/GreenApiAuthApi.credentials.d.ts +8 -0
- package/dist/credentials/GreenApiAuthApi.credentials.js +64 -0
- package/dist/credentials/GreenApiAuthApi.credentials.js.map +1 -0
- package/dist/nodes/Greenapi/Greenapi.node.d.ts +5 -0
- package/dist/nodes/Greenapi/Greenapi.node.js +123 -0
- package/dist/nodes/Greenapi/Greenapi.node.js.map +1 -0
- package/dist/nodes/Greenapi/GreenapiTrigger.node.d.ts +6 -0
- package/dist/nodes/Greenapi/GreenapiTrigger.node.js +163 -0
- package/dist/nodes/Greenapi/GreenapiTrigger.node.js.map +1 -0
- package/dist/nodes/Greenapi/greenapi.svg +47 -0
- package/dist/nodes/Greenapi/helpers/executePerItem.d.ts +2 -0
- package/dist/nodes/Greenapi/helpers/executePerItem.js +30 -0
- package/dist/nodes/Greenapi/helpers/executePerItem.js.map +1 -0
- package/dist/nodes/Greenapi/helpers/getParams.d.ts +8 -0
- package/dist/nodes/Greenapi/helpers/getParams.js +11 -0
- package/dist/nodes/Greenapi/helpers/getParams.js.map +1 -0
- package/dist/nodes/Greenapi/helpers/request.d.ts +2 -0
- package/dist/nodes/Greenapi/helpers/request.js +19 -0
- package/dist/nodes/Greenapi/helpers/request.js.map +1 -0
- package/dist/nodes/Greenapi/operations/checkAccount.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/checkAccount.js +14 -0
- package/dist/nodes/Greenapi/operations/checkAccount.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getAccountSettings.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getAccountSettings.js +10 -0
- package/dist/nodes/Greenapi/operations/getAccountSettings.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getAvatar.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getAvatar.js +14 -0
- package/dist/nodes/Greenapi/operations/getAvatar.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getChatHistory.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getChatHistory.js +16 -0
- package/dist/nodes/Greenapi/operations/getChatHistory.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getChats.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getChats.js +10 -0
- package/dist/nodes/Greenapi/operations/getChats.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getContactInfo.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getContactInfo.js +14 -0
- package/dist/nodes/Greenapi/operations/getContactInfo.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getContacts.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getContacts.js +10 -0
- package/dist/nodes/Greenapi/operations/getContacts.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getGroupData.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getGroupData.js +14 -0
- package/dist/nodes/Greenapi/operations/getGroupData.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getMessage.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getMessage.js +16 -0
- package/dist/nodes/Greenapi/operations/getMessage.js.map +1 -0
- package/dist/nodes/Greenapi/operations/getStateInstance.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/getStateInstance.js +10 -0
- package/dist/nodes/Greenapi/operations/getStateInstance.js.map +1 -0
- package/dist/nodes/Greenapi/operations/lastIncomingMessages.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/lastIncomingMessages.js +23 -0
- package/dist/nodes/Greenapi/operations/lastIncomingMessages.js.map +1 -0
- package/dist/nodes/Greenapi/operations/lastOutgoingMessages.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/lastOutgoingMessages.js +23 -0
- package/dist/nodes/Greenapi/operations/lastOutgoingMessages.js.map +1 -0
- package/dist/nodes/Greenapi/operations/readChat.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/readChat.js +14 -0
- package/dist/nodes/Greenapi/operations/readChat.js.map +1 -0
- package/dist/nodes/Greenapi/operations/reboot.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/reboot.js +10 -0
- package/dist/nodes/Greenapi/operations/reboot.js.map +1 -0
- package/dist/nodes/Greenapi/operations/sendFileByUrl.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/sendFileByUrl.js +22 -0
- package/dist/nodes/Greenapi/operations/sendFileByUrl.js.map +1 -0
- package/dist/nodes/Greenapi/operations/sendMessage.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/sendMessage.js +20 -0
- package/dist/nodes/Greenapi/operations/sendMessage.js.map +1 -0
- package/dist/nodes/Greenapi/operations/sendPoll.d.ts +2 -0
- package/dist/nodes/Greenapi/operations/sendPoll.js +32 -0
- package/dist/nodes/Greenapi/operations/sendPoll.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/account.description.d.ts +1 -0
- package/dist/nodes/Greenapi/properties/account/account.description.js +16 -0
- package/dist/nodes/Greenapi/properties/account/account.description.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/accountOperations.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/account/accountOperations.js +24 -0
- package/dist/nodes/Greenapi/properties/account/accountOperations.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/fields/getAccountSettings.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/account/fields/getAccountSettings.js +5 -0
- package/dist/nodes/Greenapi/properties/account/fields/getAccountSettings.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/fields/getStateInstance.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/account/fields/getStateInstance.js +5 -0
- package/dist/nodes/Greenapi/properties/account/fields/getStateInstance.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/fields/reboot.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/account/fields/reboot.js +5 -0
- package/dist/nodes/Greenapi/properties/account/fields/reboot.js.map +1 -0
- package/dist/nodes/Greenapi/properties/account/fields/setSettings.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/account/fields/setSettings.js +121 -0
- package/dist/nodes/Greenapi/properties/account/fields/setSettings.js.map +1 -0
- package/dist/nodes/Greenapi/properties/index.d.ts +4 -0
- package/dist/nodes/Greenapi/properties/index.js +32 -0
- package/dist/nodes/Greenapi/properties/index.js.map +1 -0
- package/dist/nodes/Greenapi/properties/journal.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/journal.js +78 -0
- package/dist/nodes/Greenapi/properties/journal.js.map +1 -0
- package/dist/nodes/Greenapi/properties/sending.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/sending.js +153 -0
- package/dist/nodes/Greenapi/properties/sending.js.map +1 -0
- package/dist/nodes/Greenapi/properties/service.d.ts +2 -0
- package/dist/nodes/Greenapi/properties/service.js +55 -0
- package/dist/nodes/Greenapi/properties/service.js.map +1 -0
- package/dist/nodes/Greenapi/types/types.d.ts +60 -0
- package/dist/nodes/Greenapi/types/types.js +3 -0
- package/dist/nodes/Greenapi/types/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,113 @@
|
|
|
1
|
+
# n8n-nodes-telegram-green-api
|
|
2
|
+
|
|
3
|
+
Integration node for [Green API](https://green-api.com/) in [n8n](https://n8n.io).
|
|
4
|
+
This community node allows automation of Telegram interactions using Green API — including messaging, file transfer, contacts, groups, statuses, and instance management.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📖 Overview
|
|
9
|
+
|
|
10
|
+
The **GreenAPI Node** provides full access to Green API endpoints, enabling you to send messages, manage chats, groups, and retrieve account information.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
### Install community node
|
|
16
|
+
Go to `Settings` → `Community Nodes` → `Install`, then enter `@green-api/n8n-nodes-telegram-greenapi`
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Install via npm
|
|
20
|
+
```bash
|
|
21
|
+
npm install @green-api/n8n-nodes-telegram-greenapi
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Restart n8n after installation.
|
|
25
|
+
|
|
26
|
+
### Manual installation
|
|
27
|
+
1. Copy repository into `~/.n8n/custom/`
|
|
28
|
+
2. Run:
|
|
29
|
+
```bash
|
|
30
|
+
npm install
|
|
31
|
+
npm run build
|
|
32
|
+
```
|
|
33
|
+
3. Restart n8n
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
You can also check out the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Authentication
|
|
42
|
+
|
|
43
|
+
To use this node, you need to have an instance and token from [Green-API](https://green-api.com/en) platform and Telegram account:
|
|
44
|
+
|
|
45
|
+
- Sign up at [Green-API](https://green-api.com/en)
|
|
46
|
+
- Create an instance
|
|
47
|
+
- Get idInstance and apiTokenInstance
|
|
48
|
+
- Authorize the instance in the [Console](https://console.green-api.com/instanceList)
|
|
49
|
+
|
|
50
|
+
## 🧩 Features
|
|
51
|
+
|
|
52
|
+
| Category | Methods |
|
|
53
|
+
|-----------|----------|
|
|
54
|
+
| 👤 **Account** | getStateInstance, reboot, getAccountSettings |
|
|
55
|
+
| ✉️ **Sending** | sendMessage, sendPoll, sendFileByUrl |
|
|
56
|
+
| 📥 **Receiving** | webhookTrigger |
|
|
57
|
+
| 📜 **Journals** | getChatHistory, getMessage, lastIncomingMessages, lastOutgoingMessages |
|
|
58
|
+
| 🧾 **Queues** | showMessagesQueue, clearMessagesQueue |
|
|
59
|
+
| 👥 **Groups** | getGroupData |
|
|
60
|
+
| ✅ **Readmark** | readChat |
|
|
61
|
+
| 🧩 **Service** | getContacts, getContactInfo, checkAccount |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ⚙️ Usage Examples
|
|
66
|
+
|
|
67
|
+
### 💬 Send Message
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"operation": "sendMessage",
|
|
71
|
+
"chatId": "7596558806",
|
|
72
|
+
"message": "Hello from n8n and Green API!"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 📎 Send File by URL
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"operation": "sendFileByUrl",
|
|
80
|
+
"chatId": "7596558806",
|
|
81
|
+
"urlFile": "https://example.com/image.jpg",
|
|
82
|
+
"fileName": "photo.jpg"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 🔄 Check Account
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"operation": "checkAccount",
|
|
90
|
+
"phoneNumber": 77780738519
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🔗 Resources
|
|
96
|
+
|
|
97
|
+
- 🌐 [Green API Documentation](https://green-api.com/telegram/docs/)
|
|
98
|
+
- 📘 [n8n Documentation](https://docs.n8n.io)
|
|
99
|
+
- 💬 [n8n Community Forum](https://community.n8n.io)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 👤 Author
|
|
104
|
+
|
|
105
|
+
Developed by [Green API](https://green-api.com/)
|
|
106
|
+
📧 support@green-api.com
|
|
107
|
+
🌍 https://green-api.com/en/
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🪪 License
|
|
112
|
+
|
|
113
|
+
[MIT License](LICENSE)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICredentialType, INodeProperties, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
+
export declare class GreenApiAuthApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
test: ICredentialTestRequest;
|
|
8
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GreenApiAuthApi = void 0;
|
|
4
|
+
class GreenApiAuthApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'greenApiAuthApi';
|
|
7
|
+
this.displayName = 'Green-API API';
|
|
8
|
+
this.documentationUrl = 'https://green-api.com/en/docs/api';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'idInstance',
|
|
12
|
+
name: 'idInstance',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true,
|
|
15
|
+
default: '',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: 'apiTokenKey',
|
|
19
|
+
name: 'apiTokenKey',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: true,
|
|
22
|
+
typeOptions: {
|
|
23
|
+
password: true,
|
|
24
|
+
},
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
this.test = {
|
|
29
|
+
request: {
|
|
30
|
+
baseURL: 'https://api.green-api.com/',
|
|
31
|
+
url: '={{$baseURL}}/waInstance{{$credentials.idInstance}}/getStateInstance/{{$credentials.apiTokenKey}}',
|
|
32
|
+
method: 'GET',
|
|
33
|
+
},
|
|
34
|
+
rules: [
|
|
35
|
+
{
|
|
36
|
+
type: 'responseSuccessBody',
|
|
37
|
+
properties: {
|
|
38
|
+
key: 'stateInstance',
|
|
39
|
+
value: 'notAuthorized',
|
|
40
|
+
message: 'Instance is not authorized!',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'responseSuccessBody',
|
|
45
|
+
properties: {
|
|
46
|
+
key: 'stateInstance',
|
|
47
|
+
value: 'starting',
|
|
48
|
+
message: 'Instance is in starting state!',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'responseSuccessBody',
|
|
53
|
+
properties: {
|
|
54
|
+
key: 'stateInstance',
|
|
55
|
+
value: 'blocked',
|
|
56
|
+
message: 'Instance is blocked!',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.GreenApiAuthApi = GreenApiAuthApi;
|
|
64
|
+
//# sourceMappingURL=GreenApiAuthApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GreenApiAuthApi.credentials.js","sourceRoot":"","sources":["../../credentials/GreenApiAuthApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GAAG,eAAe,CAAC;QAE9B,qBAAgB,GAAG,mCAAmC,CAAC;QAEvD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,mGAAmG;gBACxG,MAAM,EAAE,KAAK;aACb;YACD,KAAK,EAAE;gBACN;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,UAAU,EAAE;wBACX,GAAG,EAAE,eAAe;wBACpB,KAAK,EAAE,eAAe;wBACtB,OAAO,EAAE,6BAA6B;qBACtC;iBACD;gBACD;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,UAAU,EAAE;wBACX,GAAG,EAAE,eAAe;wBACpB,KAAK,EAAE,UAAU;wBACjB,OAAO,EAAE,gCAAgC;qBACzC;iBACD;gBACD;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,UAAU,EAAE;wBACX,GAAG,EAAE,eAAe;wBACpB,KAAK,EAAE,SAAS;wBAChB,OAAO,EAAE,sBAAsB;qBAC/B;iBACD;aACD;SACD,CAAC;IACH,CAAC;CAAA;AA3DD,0CA2DC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Greenapi implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Greenapi = void 0;
|
|
7
|
+
const properties_1 = __importDefault(require("./properties"));
|
|
8
|
+
const sendPoll_1 = require("./operations/sendPoll");
|
|
9
|
+
const sendMessage_1 = require("./operations/sendMessage");
|
|
10
|
+
const sendFileByUrl_1 = require("./operations/sendFileByUrl");
|
|
11
|
+
const lastOutgoingMessages_1 = require("./operations/lastOutgoingMessages");
|
|
12
|
+
const lastIncomingMessages_1 = require("./operations/lastIncomingMessages");
|
|
13
|
+
const getMessage_1 = require("./operations/getMessage");
|
|
14
|
+
const getChatHistory_1 = require("./operations/getChatHistory");
|
|
15
|
+
const getStateInstance_1 = require("./operations/getStateInstance");
|
|
16
|
+
const getAccountSettings_1 = require("./operations/getAccountSettings");
|
|
17
|
+
const reboot_1 = require("./operations/reboot");
|
|
18
|
+
const getContactInfo_1 = require("./operations/getContactInfo");
|
|
19
|
+
const getContacts_1 = require("./operations/getContacts");
|
|
20
|
+
const checkAccount_1 = require("./operations/checkAccount");
|
|
21
|
+
const getAvatar_1 = require("./operations/getAvatar");
|
|
22
|
+
const readChat_1 = require("./operations/readChat");
|
|
23
|
+
const getGroupData_1 = require("./operations/getGroupData");
|
|
24
|
+
class Greenapi {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.description = {
|
|
27
|
+
displayName: 'GREEN-API for Telegram',
|
|
28
|
+
name: 'greenapi',
|
|
29
|
+
icon: 'file:greenapi.svg',
|
|
30
|
+
group: ['transform'],
|
|
31
|
+
version: 1,
|
|
32
|
+
description: 'Send and receive Telegram messages using Green-API.',
|
|
33
|
+
defaults: {
|
|
34
|
+
name: 'GREENAPI',
|
|
35
|
+
},
|
|
36
|
+
inputs: ['main'],
|
|
37
|
+
outputs: ['main'],
|
|
38
|
+
usableAsTool: true,
|
|
39
|
+
credentials: [
|
|
40
|
+
{
|
|
41
|
+
name: 'greenApiAuthApi',
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
properties: properties_1.default,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async execute() {
|
|
49
|
+
const items = this.getInputData();
|
|
50
|
+
let responseData;
|
|
51
|
+
const returnData = [];
|
|
52
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
53
|
+
switch (operation) {
|
|
54
|
+
case 'getStateInstance':
|
|
55
|
+
responseData = await getStateInstance_1.getStateInstance.call(this, items);
|
|
56
|
+
returnData.push(...responseData);
|
|
57
|
+
break;
|
|
58
|
+
case 'getAccountSettings':
|
|
59
|
+
responseData = await getAccountSettings_1.getAccountSettings.call(this, items);
|
|
60
|
+
returnData.push(...responseData);
|
|
61
|
+
break;
|
|
62
|
+
case 'reboot':
|
|
63
|
+
responseData = await reboot_1.reboot.call(this, items);
|
|
64
|
+
returnData.push(...responseData);
|
|
65
|
+
break;
|
|
66
|
+
case 'sendMessage':
|
|
67
|
+
responseData = await sendMessage_1.sendMessage.call(this, items);
|
|
68
|
+
returnData.push(...responseData);
|
|
69
|
+
break;
|
|
70
|
+
case 'sendFileByUrl':
|
|
71
|
+
responseData = await sendFileByUrl_1.sendFileByUrl.call(this, items);
|
|
72
|
+
returnData.push(...responseData);
|
|
73
|
+
break;
|
|
74
|
+
case 'sendPoll':
|
|
75
|
+
responseData = await sendPoll_1.sendPoll.call(this, items);
|
|
76
|
+
returnData.push(...responseData);
|
|
77
|
+
break;
|
|
78
|
+
case 'lastIncomingMessages':
|
|
79
|
+
responseData = await lastIncomingMessages_1.lastIncomingMessages.call(this, items);
|
|
80
|
+
returnData.push(...responseData);
|
|
81
|
+
break;
|
|
82
|
+
case 'lastOutgoingMessages':
|
|
83
|
+
responseData = await lastOutgoingMessages_1.lastOutgoingMessages.call(this, items);
|
|
84
|
+
returnData.push(...responseData);
|
|
85
|
+
break;
|
|
86
|
+
case 'getChatHistory':
|
|
87
|
+
responseData = await getChatHistory_1.getChatHistory.call(this, items);
|
|
88
|
+
returnData.push(...responseData);
|
|
89
|
+
break;
|
|
90
|
+
case 'getMessage':
|
|
91
|
+
responseData = await getMessage_1.getMessage.call(this, items);
|
|
92
|
+
returnData.push(...responseData);
|
|
93
|
+
break;
|
|
94
|
+
case 'getContacts':
|
|
95
|
+
responseData = await getContacts_1.getContacts.call(this, items);
|
|
96
|
+
returnData.push(...responseData);
|
|
97
|
+
break;
|
|
98
|
+
case 'getAvatar':
|
|
99
|
+
responseData = await getAvatar_1.getAvatar.call(this, items);
|
|
100
|
+
returnData.push(...responseData);
|
|
101
|
+
break;
|
|
102
|
+
case 'checkAccount':
|
|
103
|
+
responseData = await checkAccount_1.checkAccount.call(this, items);
|
|
104
|
+
returnData.push(...responseData);
|
|
105
|
+
break;
|
|
106
|
+
case 'getGroupData':
|
|
107
|
+
responseData = await getGroupData_1.getGroupData.call(this, items);
|
|
108
|
+
returnData.push(...responseData);
|
|
109
|
+
break;
|
|
110
|
+
case 'getContactInfo':
|
|
111
|
+
responseData = await getContactInfo_1.getContactInfo.call(this, items);
|
|
112
|
+
returnData.push(...responseData);
|
|
113
|
+
break;
|
|
114
|
+
case 'readChat':
|
|
115
|
+
responseData = await readChat_1.readChat.call(this, items);
|
|
116
|
+
returnData.push(...responseData);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return [this.helpers.returnJsonArray(returnData)];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.Greenapi = Greenapi;
|
|
123
|
+
//# sourceMappingURL=Greenapi.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Greenapi.node.js","sourceRoot":"","sources":["../../../nodes/Greenapi/Greenapi.node.ts"],"names":[],"mappings":";;;;;;AAOA,8DAAsC;AAItC,oDAAiD;AACjD,0DAAuD;AACvD,8DAA2D;AAI3D,4EAAyE;AACzE,4EAAyE;AACzE,wDAAqD;AACrD,gEAA6D;AAI7D,oEAAiE;AACjE,wEAAqE;AACrE,gDAA6C;AAI7C,gEAA6D;AAC7D,0DAAuD;AACvD,4DAAyE;AACzE,sDAAmD;AACnD,oDAAiD;AACjD,4DAAyD;AAEzD,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,qDAAqD;YACjE,QAAQ,EAAE;gBACV,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,iBAAiB;oBACvB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAV,oBAAU;SACV,CAAC;IAyFH,CAAC;IAvFA,KAAK,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC;QACjB,MAAM,UAAU,GAAyB,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;QAElE,QAAO,SAAS,EAAC,CAAC;YAEjB,KAAK,kBAAkB;gBACtB,YAAY,GAAG,MAAM,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAA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AG,MAAM,mBAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAChD,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;gBACjC,MAAM;QACR,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,CAAC;CAGD;AA9GD,4BA8GC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class GreenapiTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: any;
|
|
5
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GreenapiTrigger = void 0;
|
|
4
|
+
class GreenapiTrigger {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'GREEN-API Trigger',
|
|
8
|
+
name: 'greenapiTrigger',
|
|
9
|
+
icon: 'file:greenapi.svg',
|
|
10
|
+
group: ['trigger'],
|
|
11
|
+
version: 1,
|
|
12
|
+
description: 'Starts the workflow on a Green-Api webhook',
|
|
13
|
+
defaults: {
|
|
14
|
+
name: 'GREENAPI Trigger',
|
|
15
|
+
},
|
|
16
|
+
inputs: [],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: 'greenApiAuthApi',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
webhooks: [
|
|
25
|
+
{
|
|
26
|
+
name: 'default',
|
|
27
|
+
httpMethod: 'POST',
|
|
28
|
+
responseMode: 'onReceived',
|
|
29
|
+
path: 'webhook',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
properties: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Applying the settings, which is necessary for trigger node to work, to an instance can take up to 5 minutes.',
|
|
35
|
+
name: 'GreenApiTriggerNotice',
|
|
36
|
+
type: 'notice',
|
|
37
|
+
default: '',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Trigger On',
|
|
41
|
+
name: 'webhookType',
|
|
42
|
+
hint: 'Types of processed webhooks. All types will be processed if none is selected.',
|
|
43
|
+
type: 'multiOptions',
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'Incoming Message',
|
|
47
|
+
value: 'incomingMessageReceived',
|
|
48
|
+
description: 'Trigger on new incoming message',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Outgoing Message Sent From Phone',
|
|
52
|
+
value: 'outgoingMessageReceived',
|
|
53
|
+
description: 'Trigger on new outgoing message sent from phone',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Outgoing Message Sent From API',
|
|
57
|
+
value: 'outgoingAPIMessageReceived',
|
|
58
|
+
description: 'Trigger on new outgoing message sent from API',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
default: [],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Restrict to Chat IDs',
|
|
65
|
+
hint: 'Process webhooks only from the specified chats.',
|
|
66
|
+
name: 'chatIds',
|
|
67
|
+
type: 'fixedCollection',
|
|
68
|
+
placeholder: 'Add chatId',
|
|
69
|
+
default: {},
|
|
70
|
+
typeOptions: {
|
|
71
|
+
multipleValues: true,
|
|
72
|
+
},
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
displayName: 'chatId',
|
|
76
|
+
name: 'chatId',
|
|
77
|
+
values: [
|
|
78
|
+
{
|
|
79
|
+
displayName: 'chatId',
|
|
80
|
+
name: 'chatId',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
placeholder: '7596558806',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
this.webhookMethods = {
|
|
92
|
+
default: {
|
|
93
|
+
async checkExists() {
|
|
94
|
+
const credentials = await this.getCredentials('greenApiAuthApi');
|
|
95
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
96
|
+
const response = await this.helpers.httpRequest({
|
|
97
|
+
method: 'GET',
|
|
98
|
+
url: `https://api.green-api.com/waInstance${credentials.idInstance}/getSettings/${credentials.apiTokenKey}`,
|
|
99
|
+
});
|
|
100
|
+
return response.webhookUrl === webhookUrl;
|
|
101
|
+
},
|
|
102
|
+
async create() {
|
|
103
|
+
const credentials = await this.getCredentials('greenApiAuthApi');
|
|
104
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
105
|
+
await this.helpers.httpRequest({
|
|
106
|
+
method: 'POST',
|
|
107
|
+
url: `https://api.green-api.com/waInstance${credentials.idInstance}/setSettings/${credentials.apiTokenKey}`,
|
|
108
|
+
body: {
|
|
109
|
+
webhookUrl: webhookUrl,
|
|
110
|
+
incomingWebhook: 'yes',
|
|
111
|
+
outgoingAPIMessageWebhook: 'yes',
|
|
112
|
+
outgoingMessageWebhook: 'yes',
|
|
113
|
+
},
|
|
114
|
+
json: true,
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
async delete() {
|
|
118
|
+
const credentials = await this.getCredentials('greenApiAuthApi');
|
|
119
|
+
await this.helpers.httpRequest({
|
|
120
|
+
method: 'POST',
|
|
121
|
+
url: `https://api.green-api.com/waInstance${credentials.idInstance}/setSettings/${credentials.apiTokenKey}`,
|
|
122
|
+
body: {},
|
|
123
|
+
json: true,
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
async webhook() {
|
|
130
|
+
var _a, _b, _c;
|
|
131
|
+
const body = this.getBodyData();
|
|
132
|
+
const data = this.helpers.returnJsonArray(body);
|
|
133
|
+
const webhookData = data[0].json;
|
|
134
|
+
const thisTypeWebhook = webhookData.typeWebhook;
|
|
135
|
+
const chosenTypeWebhooks = this.getNodeParameter('webhookType', []);
|
|
136
|
+
if (chosenTypeWebhooks.length > 0 && !chosenTypeWebhooks.includes(thisTypeWebhook)) {
|
|
137
|
+
return { webhookResponse: 'OK' };
|
|
138
|
+
}
|
|
139
|
+
const chatsCollection = this.getNodeParameter('chatIds', 0, {});
|
|
140
|
+
const allowedChats = (chatsCollection.chatId || []).map(c => c.chatId);
|
|
141
|
+
const incomingChatId = (_a = webhookData.senderData) === null || _a === void 0 ? void 0 : _a.chatId;
|
|
142
|
+
if (allowedChats.length > 0 && !allowedChats.includes(incomingChatId)) {
|
|
143
|
+
return { webhookResponse: 'OK' };
|
|
144
|
+
}
|
|
145
|
+
if (thisTypeWebhook === 'incomingMessageReceived') {
|
|
146
|
+
const messageData = webhookData.messageData;
|
|
147
|
+
let unifiedText = '';
|
|
148
|
+
if ((messageData === null || messageData === void 0 ? void 0 : messageData.typeMessage) === 'textMessage') {
|
|
149
|
+
unifiedText = ((_b = messageData.textMessageData) === null || _b === void 0 ? void 0 : _b.textMessage) || '';
|
|
150
|
+
}
|
|
151
|
+
else if ((messageData === null || messageData === void 0 ? void 0 : messageData.typeMessage) === 'extendedTextMessage') {
|
|
152
|
+
unifiedText = ((_c = messageData.extendedTextMessageData) === null || _c === void 0 ? void 0 : _c.text) || '';
|
|
153
|
+
}
|
|
154
|
+
webhookData.unifiedMessageText = unifiedText;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
workflowData: [data],
|
|
158
|
+
webhookResponse: 'OK',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.GreenapiTrigger = GreenapiTrigger;
|
|
163
|
+
//# sourceMappingURL=GreenapiTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GreenapiTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Greenapi/GreenapiTrigger.node.ts"],"names":[],"mappings":";;;AAQA,MAAa,eAAe;IAA5B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE;gBACT,IAAI,EAAE,kBAAkB;aAExB;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,iBAAiB;oBACvB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBACf;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EACV,8GAA8G;oBAC/G,IAAI,EAAE,uBAAuB;oBAC7B,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;iBACX;gBACD;oBACC,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,+EAA+E;oBACrF,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,kBAAkB;4BACxB,KAAK,EAAE,yBAAyB;4BAChC,WAAW,EAAE,iCAAiC;yBAC9C;wBACD;4BACC,IAAI,EAAE,kCAAkC;4BACxC,KAAK,EAAE,yBAAyB;4BAChC,WAAW,EACV,iDAAiD;yBAClD;wBACD;4BACC,IAAI,EAAE,gCAAgC;4BACtC,KAAK,EAAE,4BAA4B;4BACnC,WAAW,EAAE,+CAA+C;yBAC5D;qBACD;oBAED,OAAO,EAAE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
viewBox="0 0 512.0 512.0"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="SVGRoot"
|
|
10
|
+
sodipodi:docname="green-api-flat.svg"
|
|
11
|
+
xml:space="preserve"
|
|
12
|
+
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
|
13
|
+
inkscape:export-filename="./green-api-flat.png"
|
|
14
|
+
inkscape:export-xdpi="96"
|
|
15
|
+
inkscape:export-ydpi="96"
|
|
16
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
17
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
|
20
|
+
id="namedview613"
|
|
21
|
+
pagecolor="#ffffff"
|
|
22
|
+
bordercolor="#999999"
|
|
23
|
+
borderopacity="1"
|
|
24
|
+
inkscape:showpageshadow="0"
|
|
25
|
+
inkscape:pageopacity="1"
|
|
26
|
+
inkscape:pagecheckerboard="0"
|
|
27
|
+
inkscape:deskcolor="#d1d1d1"
|
|
28
|
+
inkscape:document-units="px"
|
|
29
|
+
showgrid="true"
|
|
30
|
+
inkscape:zoom="1.1228082"
|
|
31
|
+
inkscape:cx="395.43707"
|
|
32
|
+
inkscape:cy="302.36686"
|
|
33
|
+
inkscape:window-width="1850"
|
|
34
|
+
inkscape:window-height="1016"
|
|
35
|
+
inkscape:window-x="70"
|
|
36
|
+
inkscape:window-y="27"
|
|
37
|
+
inkscape:window-maximized="1"
|
|
38
|
+
inkscape:current-layer="layer1"><inkscape:grid
|
|
39
|
+
type="xygrid"
|
|
40
|
+
id="grid736" /></sodipodi:namedview><defs
|
|
41
|
+
id="defs608" /><g
|
|
42
|
+
inkscape:label="Layer 1"
|
|
43
|
+
inkscape:groupmode="layer"
|
|
44
|
+
id="layer1"><path
|
|
45
|
+
id="rect915"
|
|
46
|
+
style="fill:#3b9702;fill-opacity:1;stroke:none;stroke-width:2.92102;stroke-linecap:round;stroke-dasharray:0.146052, 0.146052"
|
|
47
|
+
d="m 93.361943,12.863596 c -9.963764,0.205518 -19.786812,4.279055 -27.001015,11.237172 -7.504127,7.122216 -12.135494,17.224446 -12.654984,27.620321 -0.1474,4.549123 -0.02846,9.104014 -0.06679,13.655421 0.0036,129.64232 -0.0072,259.28474 0.0053,388.927 0.147849,10.00785 3.679924,19.87739 9.594689,27.87019 4.572326,6.13279 10.869965,11.27627 18.340293,13.17247 4.744124,1.24195 9.813563,0.92101 14.438909,-0.6696 107.740645,-32.97829 215.486485,-65.93942 323.223815,-98.92842 9.07389,-2.87318 18.03739,-6.69793 25.52031,-12.74124 5.72845,-4.6168 10.36193,-10.82518 12.39108,-18.00545 1.21189,-4.05397 1.48111,-8.31651 1.3862,-12.52973 -0.005,-99.67879 0.009,-199.35769 -0.007,-299.036405 C 458.43415,43.21973 454.38989,33.11307 447.41752,25.718557 440.37557,18.128891 430.38721,13.444732 420.1085,12.91932 c -4.49786,-0.14908 -9.00141,-0.02879 -13.50152,-0.06755 -104.24728,0.0039 -208.49465,-0.0079 -312.741859,0.0059 -0.167741,0.002 -0.335482,0.0039 -0.503224,0.006 z M 259.03255,105.12129 c 3.91324,0.2245 7.82321,0.54064 11.70418,1.10216 4.33008,0.62325 8.63477,1.44014 12.87234,2.53939 4.01291,0.97572 7.94745,2.25075 11.8443,3.6203 4.51908,1.68213 8.97591,3.55022 13.27432,5.75085 3.56385,1.76581 7.01812,3.75154 10.39276,5.86231 3.16877,1.98766 6.22412,4.1535 9.21186,6.40904 2.89857,2.2356 5.69997,4.5955 8.41642,7.05417 2.65184,2.45812 5.20277,5.02278 7.66593,7.67424 3.27381,3.62618 6.39453,7.3994 9.2309,11.38733 2.33975,3.19941 4.4725,6.54908 6.49359,9.96229 1.89947,3.24901 3.63022,6.59508 5.2588,9.99096 1.5759,3.38195 2.99497,6.83416 4.31068,10.32785 0.30435,0.85835 0.58745,1.72461 0.88399,2.58587 -22.88997,0 -45.77993,0 -68.66991,0 -2.83962,-3.48721 -6.05558,-6.65586 -9.55815,-9.45843 -3.04028,-2.43166 -6.30863,-4.56565 -9.72927,-6.40886 -3.3451,-1.7691 -6.83807,-3.24527 -10.43322,-4.41085 -3.6346,-1.15534 -7.3683,-1.97493 -11.14476,-2.48313 -3.71668,-0.46178 -7.46975,-0.61307 -11.21055,-0.41959 -3.76012,0.21537 -7.50242,0.74711 -11.16956,1.6196 -3.69708,0.88411 -7.3179,2.09679 -10.80177,3.63181 -3.48373,1.53137 -6.82817,3.3862 -9.98393,5.52527 -3.13043,2.11592 -6.07236,4.52013 -8.77591,7.17144 -2.30879,2.23926 -4.4325,4.67607 -6.37359,7.24657 -2.30515,3.05578 -4.33198,6.32502 -6.05999,9.74718 -1.59053,3.13996 -2.89257,6.41975 -3.97004,9.77371 -1.09058,3.57579 -1.91905,7.23388 -2.39899,10.9462 -0.49643,3.80937 -0.65685,7.66361 -0.47501,11.50237 0.18466,3.80357 0.69694,7.59308 1.54911,11.30345 0.71309,3.15377 1.66667,6.2563 2.8515,9.26157 1.38189,3.54333 3.08605,6.95733 5.0717,10.19266 1.83499,3.00088 3.93592,5.82541 6.21639,8.49375 2.47932,2.82297 5.17988,5.44558 8.09659,7.80434 2.97203,2.39512 6.15625,4.51832 9.50005,6.34539 3.34526,1.82038 6.85163,3.33727 10.46499,4.52498 3.58185,1.1743 7.26568,2.03779 10.99864,2.5455 3.16874,0.44633 6.37584,0.6439 9.57476,0.58834 3.81188,-0.0537 7.617,-0.46944 11.35614,-1.21498 3.45363,-0.68757 6.83716,-1.69184 10.13597,-2.92983 3.49393,-1.36333 6.88358,-3.00179 10.0972,-4.94967 3.2672,-1.98409 6.36456,-4.25658 9.22716,-6.80274 2.419,-2.13647 4.67641,-4.46594 6.74004,-6.95478 2.30448,-2.72623 4.2411,-5.73712 6.33836,-8.62379 -22.39328,0 -44.78656,0 -67.17983,0 0,-16.08839 0,-32.17677 0,-48.26516 45.18963,0 90.37925,0 135.56888,0 0.87643,6.9526 1.16657,13.98142 0.87766,20.98433 -0.0578,1.16336 -0.13245,2.57834 -0.22665,3.83683 -0.12175,1.62534 -0.26315,3.16733 -0.45052,4.83173 -1.90303,17.02469 -7.32014,33.63419 -15.79743,48.4673 -0.32801,0.55228 -0.77011,1.3397 -1.10254,1.89182 -0.90292,1.51687 -1.83184,3.00645 -2.82992,4.53437 -9.86723,15.12534 -23.03672,28.02488 -38.29069,37.52887 -0.4965,0.30504 -1.26472,0.78607 -1.77196,1.08227 -10.23892,6.15982 -21.56792,10.89021 -33.21383,13.81963 -6.30669,1.5964 -12.73918,2.67651 -19.21447,3.2577 -1.14678,0.0949 -2.54529,0.20372 -3.79005,0.27264 -1.6307,0.0926 -3.18643,0.15106 -4.86525,0.1803 -4.53996,0.0536 -9.08296,-0.1211 -13.60458,-0.53389 -4.44591,-0.44492 -8.87739,-1.0671 -13.25044,-1.9993 -3.01981,-0.60458 -6.01498,-1.34953 -8.97458,-2.20503 -4.23735,-1.19665 -8.4013,-2.65021 -12.484,-4.30648 -3.43448,-1.3911 -6.79844,-2.95778 -10.0989,-4.64865 -3.34425,-1.72537 -6.59694,-3.62614 -9.78587,-5.62951 -3.50346,-2.26768 -6.9247,-4.67247 -10.19462,-7.27394 -3.5737,-2.82876 -6.99616,-5.85105 -10.23633,-9.06485 -2.75799,-2.69951 -5.35237,-5.5652 -7.85487,-8.50754 -2.35264,-2.81803 -4.58355,-5.73744 -6.70146,-8.74022 -2.09791,-3.01247 -4.05679,-6.11988 -5.90884,-9.29291 -1.80866,-3.17799 -3.49207,-6.4259 -5.0542,-9.73522 -1.49373,-3.2771 -2.87963,-6.6022 -4.12679,-9.98373 -1.2238,-3.42446 -2.32199,-6.89267 -3.28365,-10.40213 -0.92699,-3.51936 -1.71979,-7.07249 -2.37701,-10.65376 -0.64009,-3.66917 -1.1162,-7.364 -1.4757,-11.07201 -0.28662,-3.5659 -0.45474,-7.13882 -0.48637,-10.71668 0.003,-3.71026 0.16752,-7.41688 0.44928,-11.11615 0.3304,-3.56203 0.778,-7.11023 1.36178,-10.63919 0.63249,-3.60898 1.41663,-7.18742 2.32049,-10.73685 0.93059,-3.48392 1.99753,-6.92747 3.18744,-10.32988 1.2282,-3.42578 2.60988,-6.79172 4.10046,-10.10928 1.51763,-3.29697 3.17873,-6.52278 4.94564,-9.69021 1.80051,-3.1455 3.71895,-6.21928 5.75697,-9.21334 2.07169,-2.99264 4.26568,-5.89501 6.56168,-8.71542 2.67272,-3.20086 5.46404,-6.30473 8.42998,-9.23067 3.23295,-3.20527 6.63299,-6.23691 10.19877,-9.05859 3.28811,-2.64016 6.74521,-5.0598 10.27257,-7.36 3.1923,-2.00604 6.44667,-3.91133 9.79129,-5.64538 3.30055,-1.69223 6.66358,-3.26133 10.09611,-4.65909 3.40239,-1.38093 6.85973,-2.62641 10.37023,-3.69482 4.24167,-1.30197 8.55038,-2.37995 12.90778,-3.20421 3.81117,-0.75244 7.66507,-1.26437 11.52824,-1.65422 4.0877,-0.37307 8.19338,-0.55836 12.29777,-0.53788 1.52811,0.0348 3.05621,0.0695 4.58431,0.10416 z" /></g></svg>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executePerItem = executePerItem;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
async function executePerItem(ctx, items, getParams, execute) {
|
|
6
|
+
const returnData = [];
|
|
7
|
+
for (let i = 0; i < items.length; i++) {
|
|
8
|
+
try {
|
|
9
|
+
const params = getParams(i);
|
|
10
|
+
const response = await execute(params);
|
|
11
|
+
returnData.push({ json: response });
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (ctx.continueOnFail()) {
|
|
15
|
+
returnData.push({
|
|
16
|
+
json: {
|
|
17
|
+
error: error.message,
|
|
18
|
+
},
|
|
19
|
+
pairedItem: { item: i },
|
|
20
|
+
});
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), error, {
|
|
24
|
+
itemIndex: i,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return returnData;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=executePerItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executePerItem.js","sourceRoot":"","sources":["../../../../nodes/Greenapi/helpers/executePerItem.ts"],"names":[],"mappings":";;AAMA,wCAgCC;AAtCD,+CAIsB;AAEf,KAAK,UAAU,cAAc,CAClC,GAAsB,EACtB,KAA2B,EAC3B,SAA2B,EAC3B,OAAoC;IAEpC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;YAEvC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC;gBACzB,UAAU,CAAC,IAAI,CAAC;oBACd,IAAI,EAAE;wBACJ,KAAK,EAAG,KAAe,CAAC,OAAO;qBAChC;oBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;iBACxB,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE;gBAC1D,SAAS,EAAE,CAAC;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParams = getParams;
|
|
4
|
+
function getParams(ctx, itemIndex, config) {
|
|
5
|
+
const result = {};
|
|
6
|
+
for (const key in config) {
|
|
7
|
+
result[key] = ctx.getNodeParameter(key, itemIndex, config[key].default);
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=getParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getParams.js","sourceRoot":"","sources":["../../../../nodes/Greenapi/helpers/getParams.ts"],"names":[],"mappings":";;AAQA,8BAgBC;AAhBD,SAAgB,SAAS,CACvB,GAAsB,EACtB,SAAiB,EACjB,MAAsB;IAEtB,MAAM,MAAM,GAAG,EAAO,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAChC,GAAG,EACH,SAAS,EACT,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CACH,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|