n8n-nodes-basma 0.1.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 +5 -0
- package/README.md +33 -0
- package/dist/credentials/BasmaApi.credentials.d.ts +9 -0
- package/dist/credentials/BasmaApi.credentials.js +45 -0
- package/dist/credentials/BasmaApi.credentials.js.map +1 -0
- package/dist/nodes/Basma/Basma.node.d.ts +5 -0
- package/dist/nodes/Basma/Basma.node.js +285 -0
- package/dist/nodes/Basma/Basma.node.js.map +1 -0
- package/dist/nodes/Basma/BasmaTrigger.node.d.ts +12 -0
- package/dist/nodes/Basma/BasmaTrigger.node.js +71 -0
- package/dist/nodes/Basma/BasmaTrigger.node.js.map +1 -0
- package/dist/nodes/Basma/basma.png +0 -0
- package/index.js +1 -0
- package/package.json +33 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# n8n-nodes-basma
|
|
2
|
+
|
|
3
|
+
n8n community node for **BASMA** — WhatsApp automation API.
|
|
4
|
+
|
|
5
|
+
Send WhatsApp messages (text, image, video, audio, document, sticker, location, contact, poll), manage groups and contacts, use quality features (typing indicator, mark-as-read), and trigger workflows from incoming WhatsApp messages.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Settings → Community Nodes → Install: `n8n-nodes-basma`
|
|
10
|
+
|
|
11
|
+
## Credentials
|
|
12
|
+
|
|
13
|
+
Create a **BASMA API** credential with your API key from `Settings → API Key` on https://www.basmaweb.com (starts with `bsm_live_`).
|
|
14
|
+
|
|
15
|
+
## Nodes
|
|
16
|
+
|
|
17
|
+
### BASMA
|
|
18
|
+
- **Message**: send text, image, video, audio, document, sticker, location, contact, poll
|
|
19
|
+
- **Quality**: typing/presence, mark-as-read
|
|
20
|
+
- **Group**: list, create, get/update participants, send group message
|
|
21
|
+
- **Contact**: list contacts, get contact info + picture
|
|
22
|
+
|
|
23
|
+
### BASMA Trigger
|
|
24
|
+
Starts a workflow when BASMA receives a WhatsApp event. Copy the webhook URL n8n generates and paste it in BASMA → Webhooks (event: MESSAGE_RECEIVED). Built-in option to ignore your own messages.
|
|
25
|
+
|
|
26
|
+
## Building a customer-support AI agent
|
|
27
|
+
1. **BASMA Trigger** (MESSAGE_RECEIVED, ignore own messages)
|
|
28
|
+
2. **AI Agent** node (your support system prompt)
|
|
29
|
+
3. **BASMA → Quality → Typing** (show "typing…")
|
|
30
|
+
4. **BASMA → Message → Send Text** (the AI reply)
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class BasmaApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasmaApi = void 0;
|
|
4
|
+
class BasmaApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'basmaApi';
|
|
7
|
+
this.displayName = 'BASMA API';
|
|
8
|
+
this.documentationUrl = 'https://www.basmaweb.com/dashboard/docs';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Your BASMA API key (starts with bsm_live_). Get it from Settings -> API Key.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Base URL',
|
|
21
|
+
name: 'baseUrl',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: 'https://www.basmaweb.com',
|
|
24
|
+
description: 'BASMA platform base URL',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
this.authenticate = {
|
|
28
|
+
type: 'generic',
|
|
29
|
+
properties: {
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
this.test = {
|
|
36
|
+
request: {
|
|
37
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
38
|
+
url: '/api/ping',
|
|
39
|
+
method: 'GET',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.BasmaApi = BasmaApi;
|
|
45
|
+
//# sourceMappingURL=BasmaApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasmaApi.credentials.js","sourceRoot":"","sources":["../../credentials/BasmaApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,QAAQ;IAArB;QACE,SAAI,GAAG,UAAU,CAAC;QAClB,gBAAW,GAAG,WAAW,CAAC;QAC1B,qBAAgB,GAAG,yCAAyC,CAAC;QAC7D,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,8EAA8E;aAC5F;YACD;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,0BAA0B;gBACnC,WAAW,EAAE,yBAAyB;aACvC;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,iCAAiC;iBACjD;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,WAAW;gBAChB,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AAvCD,4BAuCC"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Basma = void 0;
|
|
4
|
+
class Basma {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'BASMA',
|
|
8
|
+
name: 'basma',
|
|
9
|
+
icon: 'file:basma.png',
|
|
10
|
+
group: ['transform'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
13
|
+
description: 'Send WhatsApp messages and manage groups/contacts via BASMA',
|
|
14
|
+
defaults: { name: 'BASMA' },
|
|
15
|
+
inputs: ['main'],
|
|
16
|
+
outputs: ['main'],
|
|
17
|
+
credentials: [{ name: 'basmaApi', required: true }],
|
|
18
|
+
properties: [
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Resource',
|
|
21
|
+
name: 'resource',
|
|
22
|
+
type: 'options',
|
|
23
|
+
noDataExpression: true,
|
|
24
|
+
options: [
|
|
25
|
+
{ name: 'Message', value: 'message' },
|
|
26
|
+
{ name: 'Quality', value: 'quality' },
|
|
27
|
+
{ name: 'Group', value: 'group' },
|
|
28
|
+
{ name: 'Contact', value: 'contact' },
|
|
29
|
+
],
|
|
30
|
+
default: 'message',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Operation',
|
|
34
|
+
name: 'operation',
|
|
35
|
+
type: 'options',
|
|
36
|
+
noDataExpression: true,
|
|
37
|
+
displayOptions: { show: { resource: ['message'] } },
|
|
38
|
+
options: [
|
|
39
|
+
{ name: 'Send Text', value: 'sendText', action: 'Send a text message' },
|
|
40
|
+
{ name: 'Send Image', value: 'sendImage', action: 'Send an image' },
|
|
41
|
+
{ name: 'Send Video', value: 'sendVideo', action: 'Send a video' },
|
|
42
|
+
{ name: 'Send Audio', value: 'sendAudio', action: 'Send an audio / voice note' },
|
|
43
|
+
{ name: 'Send Document', value: 'sendDocument', action: 'Send a document' },
|
|
44
|
+
{ name: 'Send Sticker', value: 'sendSticker', action: 'Send a sticker' },
|
|
45
|
+
{ name: 'Send Location', value: 'sendLocation', action: 'Send a location' },
|
|
46
|
+
{ name: 'Send Contact', value: 'sendContact', action: 'Send a contact card' },
|
|
47
|
+
{ name: 'Send Poll', value: 'sendPoll', action: 'Send a poll' },
|
|
48
|
+
],
|
|
49
|
+
default: 'sendText',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Operation',
|
|
53
|
+
name: 'operation',
|
|
54
|
+
type: 'options',
|
|
55
|
+
noDataExpression: true,
|
|
56
|
+
displayOptions: { show: { resource: ['quality'] } },
|
|
57
|
+
options: [
|
|
58
|
+
{ name: 'Send Typing / Presence', value: 'presence', action: 'Show typing or online presence' },
|
|
59
|
+
{ name: 'Mark As Read', value: 'markRead', action: 'Mark a message as read' },
|
|
60
|
+
],
|
|
61
|
+
default: 'presence',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Operation',
|
|
65
|
+
name: 'operation',
|
|
66
|
+
type: 'options',
|
|
67
|
+
noDataExpression: true,
|
|
68
|
+
displayOptions: { show: { resource: ['group'] } },
|
|
69
|
+
options: [
|
|
70
|
+
{ name: 'List Groups', value: 'listGroups', action: 'List all groups' },
|
|
71
|
+
{ name: 'Create Group', value: 'createGroup', action: 'Create a group' },
|
|
72
|
+
{ name: 'Get Participants', value: 'getParticipants', action: 'Get group participants' },
|
|
73
|
+
{ name: 'Update Participants', value: 'updateParticipants', action: 'Add/remove/promote/demote' },
|
|
74
|
+
{ name: 'Send Group Message', value: 'sendGroup', action: 'Send a message to a group' },
|
|
75
|
+
],
|
|
76
|
+
default: 'listGroups',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Operation',
|
|
80
|
+
name: 'operation',
|
|
81
|
+
type: 'options',
|
|
82
|
+
noDataExpression: true,
|
|
83
|
+
displayOptions: { show: { resource: ['contact'] } },
|
|
84
|
+
options: [
|
|
85
|
+
{ name: 'List Contacts', value: 'listContacts', action: 'List all contacts' },
|
|
86
|
+
{ name: 'Get Contact', value: 'getContact', action: 'Get contact info + picture' },
|
|
87
|
+
],
|
|
88
|
+
default: 'listContacts',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
displayName: 'To (Phone / JID)',
|
|
92
|
+
name: 'to',
|
|
93
|
+
type: 'string',
|
|
94
|
+
default: '',
|
|
95
|
+
placeholder: '201234567890',
|
|
96
|
+
displayOptions: { show: { resource: ['message', 'quality'] } },
|
|
97
|
+
description: 'Recipient phone number or full JID',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Text',
|
|
101
|
+
name: 'text',
|
|
102
|
+
type: 'string',
|
|
103
|
+
typeOptions: { rows: 3 },
|
|
104
|
+
default: '',
|
|
105
|
+
displayOptions: { show: { resource: ['message'], operation: ['sendText'] } },
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Media URL or Base64',
|
|
109
|
+
name: 'media',
|
|
110
|
+
type: 'string',
|
|
111
|
+
default: '',
|
|
112
|
+
displayOptions: { show: { resource: ['message'], operation: ['sendImage', 'sendVideo', 'sendAudio', 'sendDocument', 'sendSticker'] } },
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Caption',
|
|
116
|
+
name: 'caption',
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: '',
|
|
119
|
+
displayOptions: { show: { resource: ['message'], operation: ['sendImage', 'sendVideo'] } },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
displayName: 'File Name',
|
|
123
|
+
name: 'fileName',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: '',
|
|
126
|
+
displayOptions: { show: { resource: ['message'], operation: ['sendDocument'] } },
|
|
127
|
+
},
|
|
128
|
+
{ displayName: 'Latitude', name: 'latitude', type: 'number', default: 0, displayOptions: { show: { resource: ['message'], operation: ['sendLocation'] } } },
|
|
129
|
+
{ displayName: 'Longitude', name: 'longitude', type: 'number', default: 0, displayOptions: { show: { resource: ['message'], operation: ['sendLocation'] } } },
|
|
130
|
+
{ displayName: 'Name', name: 'locName', type: 'string', default: '', displayOptions: { show: { resource: ['message'], operation: ['sendLocation'] } } },
|
|
131
|
+
{ displayName: 'Full Name', name: 'contactName', type: 'string', default: '', displayOptions: { show: { resource: ['message'], operation: ['sendContact'] } } },
|
|
132
|
+
{ displayName: 'Phone Number', name: 'contactPhone', type: 'string', default: '', displayOptions: { show: { resource: ['message'], operation: ['sendContact'] } } },
|
|
133
|
+
{ displayName: 'Question', name: 'question', type: 'string', default: '', displayOptions: { show: { resource: ['message'], operation: ['sendPoll'] } } },
|
|
134
|
+
{ displayName: 'Options (comma separated)', name: 'options', type: 'string', default: '', placeholder: 'Yes, No, Maybe', displayOptions: { show: { resource: ['message'], operation: ['sendPoll'] } } },
|
|
135
|
+
{
|
|
136
|
+
displayName: 'Presence',
|
|
137
|
+
name: 'presence',
|
|
138
|
+
type: 'options',
|
|
139
|
+
options: [
|
|
140
|
+
{ name: 'Typing', value: 'composing' },
|
|
141
|
+
{ name: 'Recording', value: 'recording' },
|
|
142
|
+
{ name: 'Online', value: 'available' },
|
|
143
|
+
{ name: 'Paused', value: 'paused' },
|
|
144
|
+
],
|
|
145
|
+
default: 'composing',
|
|
146
|
+
displayOptions: { show: { resource: ['quality'], operation: ['presence'] } },
|
|
147
|
+
},
|
|
148
|
+
{ displayName: 'Delay (ms)', name: 'delay', type: 'number', default: 1500, displayOptions: { show: { resource: ['quality'], operation: ['presence'] } } },
|
|
149
|
+
{ displayName: 'Remote JID', name: 'remoteJid', type: 'string', default: '', displayOptions: { show: { resource: ['quality'], operation: ['markRead'] } } },
|
|
150
|
+
{ displayName: 'Message ID', name: 'messageId', type: 'string', default: '', displayOptions: { show: { resource: ['quality'], operation: ['markRead'] } } },
|
|
151
|
+
{ displayName: 'Subject', name: 'subject', type: 'string', default: '', displayOptions: { show: { resource: ['group'], operation: ['createGroup'] } } },
|
|
152
|
+
{ displayName: 'Participants (comma separated)', name: 'participants', type: 'string', default: '', displayOptions: { show: { resource: ['group'], operation: ['createGroup', 'updateParticipants'] } } },
|
|
153
|
+
{ displayName: 'Group JID', name: 'groupJid', type: 'string', default: '', displayOptions: { show: { resource: ['group'], operation: ['getParticipants', 'updateParticipants', 'sendGroup'] } } },
|
|
154
|
+
{
|
|
155
|
+
displayName: 'Action', name: 'groupAction', type: 'options',
|
|
156
|
+
options: [{ name: 'Add', value: 'add' }, { name: 'Remove', value: 'remove' }, { name: 'Promote', value: 'promote' }, { name: 'Demote', value: 'demote' }],
|
|
157
|
+
default: 'add', displayOptions: { show: { resource: ['group'], operation: ['updateParticipants'] } },
|
|
158
|
+
},
|
|
159
|
+
{ displayName: 'Text', name: 'groupText', type: 'string', typeOptions: { rows: 3 }, default: '', displayOptions: { show: { resource: ['group'], operation: ['sendGroup'] } } },
|
|
160
|
+
{ displayName: 'Number', name: 'contactNumber', type: 'string', default: '', displayOptions: { show: { resource: ['contact'], operation: ['getContact'] } } },
|
|
161
|
+
{ displayName: 'Instance ID (optional)', name: 'instanceId', type: 'string', default: '', description: 'Leave empty to use your first connected number' },
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async execute() {
|
|
166
|
+
const items = this.getInputData();
|
|
167
|
+
const out = [];
|
|
168
|
+
const creds = await this.getCredentials('basmaApi');
|
|
169
|
+
const baseUrl = creds.baseUrl || 'https://www.basmaweb.com';
|
|
170
|
+
for (let i = 0; i < items.length; i++) {
|
|
171
|
+
const resource = this.getNodeParameter('resource', i);
|
|
172
|
+
const operation = this.getNodeParameter('operation', i);
|
|
173
|
+
const instanceId = this.getNodeParameter('instanceId', i, '');
|
|
174
|
+
let method = 'POST';
|
|
175
|
+
let endpoint = '/api/send';
|
|
176
|
+
const body = {};
|
|
177
|
+
if (instanceId)
|
|
178
|
+
body.instance_id = instanceId;
|
|
179
|
+
if (resource === 'message') {
|
|
180
|
+
body.to = this.getNodeParameter('to', i);
|
|
181
|
+
if (operation === 'sendText') {
|
|
182
|
+
body.text = this.getNodeParameter('text', i);
|
|
183
|
+
}
|
|
184
|
+
else if (operation === 'sendImage') {
|
|
185
|
+
body.type = 'image';
|
|
186
|
+
body.media = this.getNodeParameter('media', i);
|
|
187
|
+
body.caption = this.getNodeParameter('caption', i, '');
|
|
188
|
+
}
|
|
189
|
+
else if (operation === 'sendVideo') {
|
|
190
|
+
body.type = 'video';
|
|
191
|
+
body.media = this.getNodeParameter('media', i);
|
|
192
|
+
body.caption = this.getNodeParameter('caption', i, '');
|
|
193
|
+
}
|
|
194
|
+
else if (operation === 'sendAudio') {
|
|
195
|
+
body.type = 'audio';
|
|
196
|
+
body.media = this.getNodeParameter('media', i);
|
|
197
|
+
}
|
|
198
|
+
else if (operation === 'sendDocument') {
|
|
199
|
+
body.type = 'document';
|
|
200
|
+
body.media = this.getNodeParameter('media', i);
|
|
201
|
+
body.fileName = this.getNodeParameter('fileName', i, '');
|
|
202
|
+
}
|
|
203
|
+
else if (operation === 'sendSticker') {
|
|
204
|
+
body.type = 'sticker';
|
|
205
|
+
body.media = this.getNodeParameter('media', i);
|
|
206
|
+
}
|
|
207
|
+
else if (operation === 'sendLocation') {
|
|
208
|
+
body.type = 'location';
|
|
209
|
+
body.latitude = this.getNodeParameter('latitude', i);
|
|
210
|
+
body.longitude = this.getNodeParameter('longitude', i);
|
|
211
|
+
body.name = this.getNodeParameter('locName', i, '');
|
|
212
|
+
}
|
|
213
|
+
else if (operation === 'sendContact') {
|
|
214
|
+
body.type = 'contact';
|
|
215
|
+
body.contact = { fullName: this.getNodeParameter('contactName', i), phoneNumber: this.getNodeParameter('contactPhone', i) };
|
|
216
|
+
}
|
|
217
|
+
else if (operation === 'sendPoll') {
|
|
218
|
+
body.type = 'poll';
|
|
219
|
+
body.question = this.getNodeParameter('question', i);
|
|
220
|
+
const rawOpts = this.getNodeParameter('options', i, '');
|
|
221
|
+
body.options = rawOpts.split(',').map((s) => s.trim());
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else if (resource === 'quality') {
|
|
225
|
+
body.to = this.getNodeParameter('to', i);
|
|
226
|
+
if (operation === 'presence') {
|
|
227
|
+
endpoint = '/api/presence';
|
|
228
|
+
body.presence = this.getNodeParameter('presence', i);
|
|
229
|
+
body.delay = this.getNodeParameter('delay', i);
|
|
230
|
+
}
|
|
231
|
+
else if (operation === 'markRead') {
|
|
232
|
+
endpoint = '/api/mark-read';
|
|
233
|
+
body.remote_jid = this.getNodeParameter('remoteJid', i);
|
|
234
|
+
body.message_id = this.getNodeParameter('messageId', i);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (resource === 'group') {
|
|
238
|
+
if (operation === 'listGroups') {
|
|
239
|
+
endpoint = '/api/groups';
|
|
240
|
+
method = 'GET';
|
|
241
|
+
}
|
|
242
|
+
else if (operation === 'createGroup') {
|
|
243
|
+
endpoint = '/api/groups';
|
|
244
|
+
body.subject = this.getNodeParameter('subject', i);
|
|
245
|
+
body.participants = this.getNodeParameter('participants', i).split(',').map((s) => s.trim());
|
|
246
|
+
}
|
|
247
|
+
else if (operation === 'getParticipants') {
|
|
248
|
+
endpoint = '/api/groups/participants?group_jid=' + encodeURIComponent(this.getNodeParameter('groupJid', i));
|
|
249
|
+
method = 'GET';
|
|
250
|
+
}
|
|
251
|
+
else if (operation === 'updateParticipants') {
|
|
252
|
+
endpoint = '/api/groups/participants';
|
|
253
|
+
body.group_jid = this.getNodeParameter('groupJid', i);
|
|
254
|
+
body.action = this.getNodeParameter('groupAction', i);
|
|
255
|
+
body.participants = this.getNodeParameter('participants', i).split(',').map((s) => s.trim());
|
|
256
|
+
}
|
|
257
|
+
else if (operation === 'sendGroup') {
|
|
258
|
+
endpoint = '/api/send';
|
|
259
|
+
body.to = this.getNodeParameter('groupJid', i);
|
|
260
|
+
body.text = this.getNodeParameter('groupText', i);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (resource === 'contact') {
|
|
264
|
+
if (operation === 'listContacts') {
|
|
265
|
+
endpoint = '/api/contacts';
|
|
266
|
+
method = 'GET';
|
|
267
|
+
}
|
|
268
|
+
else if (operation === 'getContact') {
|
|
269
|
+
endpoint = '/api/contacts?number=' + encodeURIComponent(this.getNodeParameter('contactNumber', i));
|
|
270
|
+
method = 'GET';
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'basmaApi', {
|
|
274
|
+
method,
|
|
275
|
+
url: baseUrl + endpoint,
|
|
276
|
+
body: method === 'GET' ? undefined : body,
|
|
277
|
+
json: true,
|
|
278
|
+
});
|
|
279
|
+
out.push({ json: response });
|
|
280
|
+
}
|
|
281
|
+
return [out];
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.Basma = Basma;
|
|
285
|
+
//# sourceMappingURL=Basma.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Basma.node.js","sourceRoot":"","sources":["../../../nodes/Basma/Basma.node.ts"],"names":[],"mappings":";;;AASA,MAAa,KAAK;IAAlB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;YAC3B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I,CAAC,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;gBAAC,CAAC;YACpK,CAAC;iBAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAClC,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;oBAAC,QAAQ,GAAG,eAAe,CAAC;oBAAC,MAAM,GAAG,KAAK,CAAC;gBAAC,CAAC;qBAC5E,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;oBAAC,QAAQ,GAAG,uBAAuB,GAAG,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAW,CAAC,CAAC;oBAAC,MAAM,GAAG,KAAK,CAAC;gBAAC,CAAC;YACxK,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE;gBACvF,MAAM;gBACN,GAAG,EAAE,OAAO,GAAG,QAAQ;gBACvB,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAA8B;gBACnE,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAkC,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;CACF;AAzOD,sBAyOC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class BasmaTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: {
|
|
5
|
+
default: {
|
|
6
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
7
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasmaTrigger = void 0;
|
|
4
|
+
class BasmaTrigger {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'BASMA Trigger',
|
|
8
|
+
name: 'basmaTrigger',
|
|
9
|
+
icon: 'file:basma.png',
|
|
10
|
+
group: ['trigger'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '=Events: {{$parameter["events"].join(", ")}}',
|
|
13
|
+
description: 'Starts a workflow when BASMA receives a WhatsApp event',
|
|
14
|
+
defaults: { name: 'BASMA Trigger' },
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: ['main'],
|
|
17
|
+
credentials: [{ name: 'basmaApi', required: false }],
|
|
18
|
+
webhooks: [
|
|
19
|
+
{
|
|
20
|
+
name: 'default',
|
|
21
|
+
httpMethod: 'POST',
|
|
22
|
+
responseMode: 'onReceived',
|
|
23
|
+
path: 'basma',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Events',
|
|
29
|
+
name: 'events',
|
|
30
|
+
type: 'multiOptions',
|
|
31
|
+
options: [
|
|
32
|
+
{ name: 'Message Received', value: 'MESSAGE_RECEIVED' },
|
|
33
|
+
{ name: 'Message Status', value: 'MESSAGE_UPDATE' },
|
|
34
|
+
{ name: 'Connection Update', value: 'CONNECTION_UPDATE' },
|
|
35
|
+
],
|
|
36
|
+
default: ['MESSAGE_RECEIVED'],
|
|
37
|
+
description: 'Which events to listen for',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Ignore Own Messages',
|
|
41
|
+
name: 'ignoreFromMe',
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
default: true,
|
|
44
|
+
description: 'Whether to skip messages sent by you (prevents reply loops)',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
this.webhookMethods = {
|
|
49
|
+
default: {
|
|
50
|
+
async checkExists() { return true; },
|
|
51
|
+
async create() { return true; },
|
|
52
|
+
async delete() { return true; },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async webhook() {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const body = this.getBodyData();
|
|
59
|
+
const ignoreFromMe = this.getNodeParameter('ignoreFromMe', true);
|
|
60
|
+
const events = this.getNodeParameter('events', []);
|
|
61
|
+
if (body.event && events.length && !events.includes(body.event)) {
|
|
62
|
+
return { noWebhookResponse: false, workflowData: undefined };
|
|
63
|
+
}
|
|
64
|
+
if (ignoreFromMe && ((_b = (_a = body.data) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.fromMe) === true) {
|
|
65
|
+
return { workflowData: undefined };
|
|
66
|
+
}
|
|
67
|
+
return { workflowData: [this.helpers.returnJsonArray([body])] };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.BasmaTrigger = BasmaTrigger;
|
|
71
|
+
//# sourceMappingURL=BasmaTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasmaTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Basma/BasmaTrigger.node.ts"],"names":[],"mappings":";;;AASA,MAAa,YAAY;IAAzB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8CAA8C;YACxD,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,EAAE,IAAI,EAAE,eAAe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cAAc,EAAE,IAAI,CAAY,CAAC;QAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAa,CAAC;QAG/D,IAAI,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;QAC/D,CAAC;QAED,IAAI,YAAY,IAAI,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,GAAG,0CAAE,MAAM,MAAK,IAAI,EAAE,CAAC;YACpD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;QACrC,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,CAAC;CACF;AArED,oCAqEC"}
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-basma",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n community node for BASMA — WhatsApp automation API",
|
|
5
|
+
"keywords": ["n8n-community-node-package", "n8n", "workflow", "automation", "basma", "whatsapp"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.basmaweb.com",
|
|
8
|
+
"author": { "name": "BASMA", "email": "admin@basmaweb.com" },
|
|
9
|
+
"repository": { "type": "git", "url": "https://github.com/basmawebinfo-hub/n8n-nodes-basma" },
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && powershell -Command \"Copy-Item nodes/Basma/basma.png dist/nodes/Basma/\"",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"lint": "eslint nodes credentials package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": ["dist"],
|
|
17
|
+
"n8n": {
|
|
18
|
+
"n8nNodesApiVersion": 1,
|
|
19
|
+
"credentials": ["dist/credentials/BasmaApi.credentials.js"],
|
|
20
|
+
"nodes": [
|
|
21
|
+
"dist/nodes/Basma/Basma.node.js",
|
|
22
|
+
"dist/nodes/Basma/BasmaTrigger.node.js"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
27
|
+
"n8n-workflow": "*",
|
|
28
|
+
"typescript": "^5.5.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"n8n-workflow": "*"
|
|
32
|
+
}
|
|
33
|
+
}
|