n8n-nodes-pragma-bitrix24 1.0.0
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 +51 -0
- package/README.md +340 -0
- package/dist/credentials/Bitrix24Api.credentials.js +55 -0
- package/dist/nodes/Bitrix24/Bitrix24.node.js +1410 -0
- package/dist/nodes/Bitrix24/Company.js +17 -0
- package/dist/nodes/Bitrix24/Contact.js +31 -0
- package/dist/nodes/Bitrix24/Deal.js +17 -0
- package/dist/nodes/Bitrix24/Helpers.js +300 -0
- package/dist/nodes/Bitrix24/Lead.js +17 -0
- package/dist/nodes/Bitrix24/SmartProcess.js +1 -0
- package/dist/nodes/Bitrix24/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24/types.js +58 -0
- package/dist/nodes/Bitrix24AI/Bitrix24AI.node.js +205 -0
- package/dist/nodes/Bitrix24App/Bitrix24App.node.js +179 -0
- package/dist/nodes/Bitrix24Auxiliary/Bitrix24Auxiliary.node.js +566 -0
- package/dist/nodes/Bitrix24Booking/Bitrix24Booking.node.js +871 -0
- package/dist/nodes/Bitrix24Calendar/Bitrix24Calendar.node.js +471 -0
- package/dist/nodes/Bitrix24ChatBot/Bitrix24ChatBot.node.js +522 -0
- package/dist/nodes/Bitrix24Commerce/Bitrix24Commerce.node.js +431 -0
- package/dist/nodes/Bitrix24Department/Bitrix24Department.node.js +317 -0
- package/dist/nodes/Bitrix24Disk/Bitrix24Disk.node.js +334 -0
- package/dist/nodes/Bitrix24Document/Bitrix24Document.node.js +280 -0
- package/dist/nodes/Bitrix24Entity/Bitrix24Entity.node.js +263 -0
- package/dist/nodes/Bitrix24Group/Bitrix24Group.node.js +327 -0
- package/dist/nodes/Bitrix24Lists/Bitrix24Lists.node.js +406 -0
- package/dist/nodes/Bitrix24Log/Bitrix24Log.node.js +309 -0
- package/dist/nodes/Bitrix24Mail/Bitrix24Mail.node.js +109 -0
- package/dist/nodes/Bitrix24MessageService/Bitrix24MessageService.node.js +218 -0
- package/dist/nodes/Bitrix24OpenChannels/Bitrix24OpenChannels.node.js +379 -0
- package/dist/nodes/Bitrix24PaySystem/Bitrix24PaySystem.node.js +241 -0
- package/dist/nodes/Bitrix24Pipeline/Bitrix24Pipeline.node.js +553 -0
- package/dist/nodes/Bitrix24Pipeline/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Sale/Bitrix24Sale.node.js +391 -0
- package/dist/nodes/Bitrix24Scrum/Bitrix24Scrum.node.js +555 -0
- package/dist/nodes/Bitrix24Scrum/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Sign/Bitrix24Sign.node.js +132 -0
- package/dist/nodes/Bitrix24Social/Bitrix24Social.node.js +224 -0
- package/dist/nodes/Bitrix24Task/Bitrix24Task.node.js +444 -0
- package/dist/nodes/Bitrix24Telephony/Bitrix24Telephony.node.js +511 -0
- package/dist/nodes/Bitrix24Timeman/Bitrix24Timeman.node.js +196 -0
- package/dist/nodes/Bitrix24Tool/Bitrix24Tool.node.js +1035 -0
- package/dist/nodes/Bitrix24Tool/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Trigger/Bitrix24Trigger.node.js +184 -0
- package/dist/nodes/Bitrix24User/Bitrix24User.node.js +351 -0
- package/dist/nodes/Bitrix24UserField/Bitrix24UserField.node.js +386 -0
- package/dist/nodes/Bitrix24UserField/bitrix24.svg +7 -0
- package/dist/nodes/shared/bitrix24.svg +7 -0
- package/dist/nodes/shared/localization.js +189 -0
- package/dist/nodes/shared/types.js +22 -0
- package/index.js +10 -0
- package/package.json +108 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bitrix24 App — Нода OAuth-авторизации приложений
|
|
4
|
+
*
|
|
5
|
+
* Bitrix24 PRAGMA.by nodes for n8n
|
|
6
|
+
* Профессиональная интеграция с Битрикс24.
|
|
7
|
+
*
|
|
8
|
+
* @author PRAGMA & Азбука Решений
|
|
9
|
+
* @copyright 2026 PRAGMA (https://pragma.by/) & Азбука Решений (https://abc-solution.ru/)
|
|
10
|
+
*
|
|
11
|
+
* Контакты:
|
|
12
|
+
* 🇧🇾 PRAGMA: +375 (44) 702-70-90 | https://pragma.by/
|
|
13
|
+
* 🇷🇺 Азбука Решений: +7 (939) 555-19-60 | https://abc-solution.ru/
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Bitrix24App = void 0;
|
|
17
|
+
class Bitrix24App {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.description = {
|
|
20
|
+
displayName: 'Bitrix24 Приложение',
|
|
21
|
+
name: 'bitrix24App',
|
|
22
|
+
icon: 'file:bitrix24.svg',
|
|
23
|
+
group: ['transform'],
|
|
24
|
+
version: 1,
|
|
25
|
+
description: 'OAuth-авторизация приложений: обмен кода, обновление токенов',
|
|
26
|
+
defaults: {
|
|
27
|
+
name: 'Bitrix24 Приложение',
|
|
28
|
+
},
|
|
29
|
+
inputs: ['main'],
|
|
30
|
+
outputs: ['main'],
|
|
31
|
+
properties: [
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Operation',
|
|
34
|
+
name: 'operation',
|
|
35
|
+
type: 'options',
|
|
36
|
+
noDataExpression: true,
|
|
37
|
+
options: [
|
|
38
|
+
{
|
|
39
|
+
name: 'Exchange Code',
|
|
40
|
+
value: 'exchangeCode',
|
|
41
|
+
description: 'Exchange authorization code for access token',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Refresh Token',
|
|
45
|
+
value: 'refreshToken',
|
|
46
|
+
description: 'Refresh access token using refresh token',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
default: 'exchangeCode',
|
|
50
|
+
},
|
|
51
|
+
// Credentials Inputs
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Client ID',
|
|
54
|
+
name: 'clientId',
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: '',
|
|
57
|
+
required: true,
|
|
58
|
+
description: 'Application ID (client_id)',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Client Secret',
|
|
62
|
+
name: 'clientSecret',
|
|
63
|
+
type: 'string',
|
|
64
|
+
typeOptions: { password: true },
|
|
65
|
+
default: '',
|
|
66
|
+
required: true,
|
|
67
|
+
description: 'Application Secret (client_secret)',
|
|
68
|
+
},
|
|
69
|
+
// Operation Specific
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Auth Code',
|
|
72
|
+
name: 'code',
|
|
73
|
+
type: 'string',
|
|
74
|
+
default: '',
|
|
75
|
+
displayOptions: { show: { operation: ['exchangeCode'] } },
|
|
76
|
+
required: true,
|
|
77
|
+
description: 'Code received from ONAPPINSTALL event',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Redirect URI',
|
|
81
|
+
name: 'redirectUri',
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: '',
|
|
84
|
+
displayOptions: { show: { operation: ['exchangeCode'] } },
|
|
85
|
+
// required: true, // Sometimes optional if strictly configured in App, but n8n logic usually standard
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Refresh Token',
|
|
89
|
+
name: 'refreshToken',
|
|
90
|
+
type: 'string',
|
|
91
|
+
default: '',
|
|
92
|
+
displayOptions: { show: { operation: ['refreshToken'] } },
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: 'Box/Cloud',
|
|
97
|
+
name: 'env',
|
|
98
|
+
type: 'options',
|
|
99
|
+
options: [
|
|
100
|
+
{ name: 'Cloud (Bitrix24.net)', value: 'cloud' },
|
|
101
|
+
{ name: 'Self-Hosted (Box)', value: 'box' },
|
|
102
|
+
],
|
|
103
|
+
default: 'cloud',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Domain (Box Only)',
|
|
107
|
+
name: 'domain',
|
|
108
|
+
type: 'string',
|
|
109
|
+
default: '',
|
|
110
|
+
displayOptions: { show: { env: ['box'] } },
|
|
111
|
+
description: 'Your Bitrix24 domain (e.g. myportal.com)',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async execute() {
|
|
117
|
+
const items = this.getInputData();
|
|
118
|
+
const returnData = [];
|
|
119
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
120
|
+
const env = this.getNodeParameter('env', 0);
|
|
121
|
+
const clientId = this.getNodeParameter('clientId', 0);
|
|
122
|
+
const clientSecret = this.getNodeParameter('clientSecret', 0);
|
|
123
|
+
for (let i = 0; i < items.length; i++) {
|
|
124
|
+
try {
|
|
125
|
+
let url = '';
|
|
126
|
+
let qs = {
|
|
127
|
+
client_id: clientId,
|
|
128
|
+
client_secret: clientSecret,
|
|
129
|
+
};
|
|
130
|
+
if (env === 'cloud') {
|
|
131
|
+
url = 'https://oauth.bitrix.info/oauth/token/';
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const domain = this.getNodeParameter('domain', i);
|
|
135
|
+
url = `https://${domain}/oauth/token/`;
|
|
136
|
+
}
|
|
137
|
+
if (operation === 'exchangeCode') {
|
|
138
|
+
qs.grant_type = 'authorization_code';
|
|
139
|
+
qs.code = this.getNodeParameter('code', i);
|
|
140
|
+
/* if redirectUri is present add it */
|
|
141
|
+
try {
|
|
142
|
+
const redirect = this.getNodeParameter('redirectUri', i);
|
|
143
|
+
if (redirect)
|
|
144
|
+
qs.redirect_uri = redirect;
|
|
145
|
+
}
|
|
146
|
+
catch (e) { }
|
|
147
|
+
}
|
|
148
|
+
else if (operation === 'refreshToken') {
|
|
149
|
+
qs.grant_type = 'refresh_token';
|
|
150
|
+
qs.refresh_token = this.getNodeParameter('refreshToken', i);
|
|
151
|
+
}
|
|
152
|
+
// Make request manually (no bitrixRequestWithRetry/Credentials used here, raw oauth)
|
|
153
|
+
const response = await this.helpers.request({
|
|
154
|
+
method: 'GET', // OAuth often supports GET, but usually POST. Bitrix supports GET.
|
|
155
|
+
uri: url,
|
|
156
|
+
qs: qs,
|
|
157
|
+
json: true,
|
|
158
|
+
});
|
|
159
|
+
// Standardize output
|
|
160
|
+
if (response.error) {
|
|
161
|
+
throw new Error(response.error_description || response.error);
|
|
162
|
+
}
|
|
163
|
+
returnData.push({
|
|
164
|
+
json: response,
|
|
165
|
+
pairedItem: { item: i },
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (this.continueOnFail()) {
|
|
170
|
+
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return [returnData];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.Bitrix24App = Bitrix24App;
|