n8n-nodes-sendzen 1.0.0 → 1.0.2

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.
Files changed (38) hide show
  1. package/LICENSE.md +21 -21
  2. package/README.md +193 -280
  3. package/dist/credentials/SendZenApi.credentials.js +0 -1
  4. package/dist/credentials/SendZenWebhookApi.credentials.d.ts +7 -0
  5. package/dist/credentials/SendZenWebhookApi.credentials.js +21 -0
  6. package/dist/nodes/SendZen/SendZen.node.js +0 -1
  7. package/dist/nodes/SendZen/SendZen.node.json +3 -3
  8. package/dist/nodes/SendZen/SendZenTrigger.node.js +44 -2
  9. package/dist/nodes/SendZen/SendZenTrigger.node.json +20 -0
  10. package/dist/shared/constants.js +0 -1
  11. package/dist/shared/nodeProperties.js +0 -1
  12. package/dist/shared/template/template.api.types.d.ts +2 -2
  13. package/dist/shared/template/template.api.types.js +0 -1
  14. package/dist/shared/template/template.builder.js +1 -2
  15. package/dist/shared/type.js +0 -1
  16. package/dist/shared/utils.js +0 -1
  17. package/index.js +1 -10
  18. package/package.json +33 -26
  19. package/dist/credentials/SendZenApi.credentials.js.map +0 -1
  20. package/dist/nodes/SendZen/SendZen.node.js.map +0 -1
  21. package/dist/nodes/SendZen/SendZenTrigger.node.js.map +0 -1
  22. package/dist/package.json +0 -76
  23. package/dist/shared/constants.js.map +0 -1
  24. package/dist/shared/nodeProperties.js.map +0 -1
  25. package/dist/shared/template/template.api.types.js.map +0 -1
  26. package/dist/shared/template/template.builder.js.map +0 -1
  27. package/dist/shared/type.js.map +0 -1
  28. package/dist/shared/utils.js.map +0 -1
  29. package/jest.config.js +0 -22
  30. package/n8n-nodes-sendzen-1.0.0.tgz +0 -0
  31. package/nodes/SendZen/SendZen.node.json +0 -20
  32. package/nodes/SendZen/sendzen.svg +0 -1
  33. package/shared/constants.ts +0 -1
  34. package/shared/nodeProperties.ts +0 -197
  35. package/shared/template/template.api.types.ts +0 -435
  36. package/shared/template/template.builder.ts +0 -223
  37. package/shared/type.ts +0 -40
  38. package/shared/utils.ts +0 -16
@@ -1,197 +0,0 @@
1
- import { INodeProperties } from 'n8n-workflow';
2
-
3
- export const OperationProperties: INodeProperties = {
4
- displayName: 'Operation',
5
- name: 'operation',
6
- type: 'options',
7
- noDataExpression: true,
8
- options: [
9
- {
10
- name: 'Send Session Message',
11
- value: 'sendSessionMessage',
12
- description: 'Send a free-form message within an active 24-hour WhatsApp conversation window',
13
- action: 'Send session message',
14
- hint: 'Use this option to reply to a user within an active conversation without using a template.',
15
- },
16
- {
17
- name: 'Send Template Message',
18
- value: 'sendTemplateMessage',
19
- description: 'Send a pre-approved WhatsApp template message to a recipient',
20
- action: 'Send template message',
21
- hint: 'Use this option when replying outside the 24-hour session window or when a template is required by WhatsApp.',
22
- },
23
- {
24
- name: 'Mark as Read',
25
- value: 'markAsRead',
26
- description:
27
- 'Mark the incoming message as read.',
28
- action: 'Mark as read',
29
- hint: 'Use this option to mark the incoming message as read.',
30
- },
31
- {
32
- name: 'Show Typing Indicator',
33
- value: 'showTyping',
34
- description:
35
- 'Display a typing indicator while the workflow continues.',
36
- action: 'Show typing indicator',
37
- hint: 'Use this option to show a typing indicator while the workflow continues.',
38
- },
39
- ],
40
- default: 'sendSessionMessage',
41
- required: true,
42
- description: 'Choose how you want to interact with the recipient using SendZen.',
43
- };
44
-
45
- export const WabaAccountProperties: INodeProperties = {
46
- displayName: 'WABA Account',
47
- name: 'wabaAccount',
48
- type: 'options',
49
- noDataExpression: true,
50
- hint: 'Select the WhatsApp Business Account that will be used to send messages.',
51
- default: '',
52
- required: true,
53
- description: 'Select the WhatsApp Business Account (WABA)',
54
- typeOptions: {
55
- loadOptionsMethod: 'getWabaAccounts',
56
- },
57
- displayOptions: {
58
- show: {
59
- operation: ['sendSessionMessage', 'sendTemplateMessage'],
60
- },
61
- },
62
- };
63
-
64
- export const PhoneNumberIdProperties: INodeProperties = {
65
- displayName: 'Phone Number ID',
66
- name: 'phoneNumberId',
67
- type: 'string',
68
- hint: 'Enter the Phone Number ID associated with your WhatsApp Business account.',
69
- default: '',
70
- required: false,
71
- description:
72
- 'The Phone Number ID used to mark the message as read and show the typing indicator.. If left empty, the node will try to find it automatically from the incoming data.',
73
- displayOptions: {
74
- show: {
75
- operation: ['markAsRead', 'showTyping'],
76
- },
77
- },
78
- };
79
-
80
- export const MessageIdProperties: INodeProperties = {
81
- displayName: 'Message ID (Optional)',
82
- name: 'messageId',
83
- type: 'string',
84
- required: false,
85
- default: '',
86
- description:
87
- 'Optionally override the message ID. Leave empty to automatically use the incoming message ID from the previous node.',
88
- hint: 'Only use this if you need to manually specify a message ID. In most cases, this is resolved automatically.',
89
- displayOptions: {
90
- show: {
91
- operation: ['markAsRead', 'showTyping'],
92
- },
93
- },
94
- };
95
-
96
- export const RecipientPhoneNumberProperties: INodeProperties = {
97
- displayName: 'Recipient Phone Number',
98
- name: 'recipient',
99
- type: 'string',
100
- required: true,
101
- placeholder: '+1234567890',
102
- displayOptions: {
103
- show: {
104
- operation: ['sendSessionMessage', 'sendTemplateMessage'],
105
- },
106
- },
107
- default: '',
108
- description: 'The recipient’s phone number in international (E.164) format.',
109
- hint: 'Enter the phone number including country code, for example: +1234567890.',
110
- };
111
-
112
- export const TemplateProperties: INodeProperties = {
113
- displayName: 'Template',
114
- name: 'template',
115
- type: 'options',
116
- noDataExpression: true,
117
- typeOptions: {
118
- loadOptionsMethod: 'getTemplates',
119
- loadOptionsDependsOn: ['wabaAccount'],
120
- },
121
- required: true,
122
- displayOptions: {
123
- show: {
124
- operation: ['sendTemplateMessage'],
125
- },
126
- },
127
- default: '',
128
- description: 'Select a WhatsApp message template to send.',
129
- hint: 'Templates are pre-approved message formats that can include variables and media.',
130
- };
131
-
132
- export const ReplyMessageProperties: INodeProperties = {
133
- displayName: 'Message Text',
134
- name: 'replyMessage',
135
- type: 'string',
136
- required: true,
137
- placeholder: 'Type your message here…',
138
- displayOptions: {
139
- show: {
140
- operation: ['sendSessionMessage'],
141
- },
142
- },
143
- default: '',
144
- description: 'The text message that will be sent to the recipient.',
145
- typeOptions: {
146
- rows: 4,
147
- },
148
- hint: 'This message is sent immediately within an active WhatsApp session.',
149
- };
150
-
151
- export const EnableUrlPreviewProperties: INodeProperties = {
152
- displayName: 'Enable URL Preview',
153
- name: 'enableUrlPreview',
154
- type: 'boolean',
155
- default: false,
156
- description: 'Show a preview for URLs included in the message.',
157
- hint: 'Enable this to display link previews such as images and titles.',
158
- displayOptions: {
159
- show: {
160
- operation: ['sendSessionMessage'],
161
- },
162
- },
163
- };
164
-
165
- export const TemplateNameOrIdProperties: INodeProperties = {
166
- displayName: 'Template Variables',
167
- name: 'templateVariables',
168
- type: 'resourceMapper',
169
- noDataExpression: true,
170
- default: {
171
- mappingMode: 'defineBelow',
172
- value: null,
173
- },
174
- required: true,
175
- placeholder: 'Add template variables',
176
- description: 'Provide values for all variables required by the selected template.',
177
- hint: 'Variable names and requirements are automatically derived from the selected template.',
178
- displayOptions: {
179
- show: {
180
- operation: ['sendTemplateMessage'],
181
- },
182
- },
183
- typeOptions: {
184
- loadOptionsDependsOn: ['template'],
185
- resourceMapper: {
186
- resourceMapperMethod: 'getTemplateVariables',
187
- mode: 'add',
188
- fieldWords: {
189
- singular: 'variable',
190
- plural: 'variables',
191
- },
192
- addAllFields: true,
193
- multiKeyMatch: false,
194
- supportAutoMap: false,
195
- },
196
- },
197
- };
@@ -1,435 +0,0 @@
1
- // shared/template/template.api.types.ts
2
-
3
- // Buttons
4
- export interface UrlButton {
5
- type: 'URL';
6
- text: string;
7
- url: string;
8
- example?: string[];
9
- }
10
-
11
- export interface PhoneNumberButton {
12
- type: 'PHONE_NUMBER';
13
- text: string;
14
- phone_number: string;
15
- }
16
-
17
- export interface QuickReplyButton {
18
- type: 'QUICK_REPLY';
19
- text: string;
20
- }
21
-
22
- export interface CopyCodeButton {
23
- type: 'COPY_CODE';
24
- example: string;
25
- }
26
-
27
- export type TemplateButton = UrlButton | PhoneNumberButton | QuickReplyButton | CopyCodeButton;
28
-
29
- // Components
30
- export interface HeaderTextComponent {
31
- type: 'HEADER';
32
- format: 'TEXT';
33
- text: string;
34
- example?: {
35
- header_text: string[];
36
- }
37
- }
38
-
39
- export interface HeaderMediaComponent {
40
- type: 'HEADER';
41
- format: 'IMAGE' | 'VIDEO' | 'DOCUMENT';
42
- example: {
43
- header_handle: [string];
44
- }
45
- }
46
-
47
- export interface HeaderLocationComponent {
48
- type: 'HEADER';
49
- format: 'LOCATION';
50
- }
51
-
52
- export interface HeaderProductComponent {
53
- type: 'HEADER';
54
- format: 'PRODUCT';
55
- }
56
-
57
- export type HeaderComponent = HeaderTextComponent | HeaderMediaComponent | HeaderLocationComponent | HeaderProductComponent;
58
-
59
- export interface BodyComponent {
60
- type: 'BODY';
61
- text: string;
62
- example?: {
63
- body_text?: string[][];
64
- body_text_named_params?: {
65
- param_name: string;
66
- example: string;
67
- }[];
68
- };
69
- }
70
-
71
- export interface FooterComponent {
72
- type: 'FOOTER';
73
- text: string;
74
- }
75
-
76
- export interface ButtonsComponent {
77
- type: 'BUTTONS';
78
- buttons: TemplateButton[];
79
- }
80
-
81
- export interface LimitedTimeOfferComponent {
82
- type: 'LIMITED_TIME_OFFER';
83
- limited_time_offer: {
84
- text: string;
85
- has_expiration?: boolean;
86
- };
87
- }
88
-
89
- // Media Carousel Template
90
- export type MediaCarouselButton = UrlButton | PhoneNumberButton | QuickReplyButton;
91
-
92
- export interface MediaCarouselCard {
93
- components: (
94
- | {
95
- type: 'HEADER';
96
- format: 'IMAGE' | 'VIDEO';
97
- example: {
98
- header_handle: [string];
99
- };
100
- }
101
- | {
102
- type: 'BUTTONS';
103
- buttons: MediaCarouselButton[];
104
- }
105
- )[];
106
- }
107
-
108
- // Product Carousel Template
109
- export interface SPMButton {
110
- type: 'SPM';
111
- text: string;
112
- }
113
-
114
- export type ProductCarouselButton = SPMButton | UrlButton;
115
-
116
- export interface ProductCarouselCard {
117
- components: (
118
- | HeaderProductComponent
119
- | {
120
- type: 'BUTTONS';
121
- buttons: ProductCarouselButton[];
122
- }
123
- )[];
124
- }
125
-
126
- // Generic Carousel Component
127
- export interface CarouselComponent {
128
- type: 'CAROUSEL';
129
- cards: (MediaCarouselCard | ProductCarouselCard)[];
130
- }
131
-
132
- export type TemplateComponent =
133
- | HeaderComponent
134
- | BodyComponent
135
- | FooterComponent
136
- | ButtonsComponent
137
- | LimitedTimeOfferComponent
138
- | CarouselComponent;
139
-
140
- // Main Template Interface
141
- export interface CustomMarketingTemplate {
142
- name: string;
143
- language: string;
144
- category: 'MARKETING';
145
- parameter_format?: string;
146
- components: TemplateComponent[];
147
- }
148
-
149
- // Catalog Template
150
- export interface CatalogButton {
151
- type: 'CATALOG';
152
- text: string;
153
- }
154
-
155
- export type CatalogTemplateComponent = BodyComponent | FooterComponent | {
156
- type: 'BUTTONS';
157
- buttons: CatalogButton[];
158
- };
159
-
160
- export interface CatalogTemplate {
161
- name: string;
162
- language: string;
163
- category: 'MARKETING';
164
- components: CatalogTemplateComponent[];
165
- }
166
-
167
- // Authentication Template
168
- export interface AuthBodyComponent {
169
- type: 'BODY';
170
- add_security_recommendation?: boolean;
171
- }
172
-
173
- export interface AuthFooterComponent {
174
- type: 'FOOTER';
175
- code_expiration_minutes?: number;
176
- }
177
-
178
- export interface AuthOneTapButton {
179
- type: 'OTP';
180
- otp_type: 'one_tap';
181
- text?: string; // copy_code_button_text
182
- autofill_text?: string;
183
- supported_apps: {
184
- package_name: string;
185
- signature_hash: string;
186
- }[];
187
- }
188
-
189
- export interface AuthZeroTapButton {
190
- type: 'OTP';
191
- otp_type: 'zero_tap';
192
- text?: string; // copy_code_button_text
193
- autofill_text?: string;
194
- zero_tap_terms_accepted: boolean;
195
- supported_apps: {
196
- package_name: string;
197
- signature_hash: string;
198
- }[];
199
- }
200
-
201
- export interface AuthCopyCodeButton {
202
- type: 'OTP';
203
- otp_type: 'copy_code';
204
- text?: string;
205
- }
206
-
207
- export type AuthOtpButton = AuthOneTapButton | AuthZeroTapButton | AuthCopyCodeButton;
208
-
209
- export interface AuthButtonsComponent {
210
- type: 'BUTTONS';
211
- buttons: AuthOtpButton[];
212
- }
213
-
214
- export type AuthTemplateComponent = AuthBodyComponent | AuthFooterComponent | AuthButtonsComponent;
215
-
216
- export interface AuthenticationTemplate {
217
- name: string;
218
- language: string;
219
- category: 'AUTHENTICATION';
220
- message_send_ttl_seconds?: number;
221
- components: AuthTemplateComponent[];
222
- }
223
-
224
- // Call Permission Request Template
225
- export interface CallPermissionRequestComponent {
226
- type: 'CALL_PERMISSION_REQUEST';
227
- }
228
-
229
- export type CallPermissionRequestTemplateComponent = BodyComponent | CallPermissionRequestComponent;
230
-
231
- export interface CallPermissionRequestTemplate {
232
- name: string;
233
- language: string;
234
- category: 'MARKETING' | 'UTILITY';
235
- components: CallPermissionRequestTemplateComponent[];
236
- }
237
-
238
- // MPM Template
239
- export interface MPMButton {
240
- type: 'MPM';
241
- text: string;
242
- }
243
-
244
- export type MPMTemplateComponent = HeaderTextComponent | BodyComponent | FooterComponent | {
245
- type: 'BUTTONS';
246
- buttons: MPMButton[];
247
- };
248
-
249
- export interface MPMTemplate {
250
- name: string;
251
- language: string;
252
- category: 'MARKETING';
253
- components: MPMTemplateComponent[];
254
- }
255
-
256
- export type SPMTemplateComponent = HeaderProductComponent | BodyComponent | FooterComponent | {
257
- type: 'BUTTONS';
258
- buttons: SPMButton[];
259
- };
260
-
261
- // SPM Template
262
- export interface SPMTemplate {
263
- name: string;
264
- language: string;
265
- category: 'MARKETING';
266
- components: SPMTemplateComponent[];
267
- }
268
-
269
- // Utility Template
270
- export interface UtilityTemplate {
271
- name: string;
272
- language: string;
273
- category: 'UTILITY';
274
- parameter_format?: string;
275
- components: TemplateComponent[];
276
- }
277
-
278
- export type CreateTemplatePayload =
279
- | CustomMarketingTemplate
280
- | CatalogTemplate
281
- | AuthenticationTemplate
282
- | CallPermissionRequestTemplate
283
- | MPMTemplate
284
- | SPMTemplate
285
- | UtilityTemplate;
286
-
287
- export interface CreateTemplateResponse {
288
- id: string;
289
- status: string;
290
- category: string;
291
- }
292
-
293
- // --- GET All Templates Response Types ---
294
- export interface Paging {
295
- cursors: {
296
- before: string;
297
- after: string;
298
- };
299
- next?: string;
300
- }
301
-
302
- export interface ResponseUrlButton {
303
- type: 'URL';
304
- text: string;
305
- url: string;
306
- }
307
-
308
- export interface ResponsePhoneNumberButton {
309
- type: 'PHONE_NUMBER';
310
- text: string;
311
- phone_number: string;
312
- }
313
-
314
- export interface ResponseQuickReplyButton {
315
- type: 'QUICK_REPLY';
316
- text: string;
317
- }
318
-
319
- export interface ResponseFlowButton {
320
- type: 'FLOW';
321
- text: string;
322
- flow_id: number;
323
- flow_action: string;
324
- navigate_screen: string;
325
- }
326
-
327
- export interface ResponseSPMButton {
328
- type: 'SPM';
329
- text: string;
330
- }
331
-
332
- export type ResponseButton = ResponseUrlButton | ResponsePhoneNumberButton | ResponseQuickReplyButton | ResponseFlowButton | ResponseSPMButton;
333
-
334
- export interface ResponseHeaderTextComponent {
335
- type: 'HEADER';
336
- format: 'TEXT';
337
- text: string;
338
- example?: {
339
- header_text: string[];
340
- };
341
- }
342
-
343
- export interface ResponseHeaderMediaComponent {
344
- type: 'HEADER';
345
- format: 'IMAGE' | 'VIDEO' | 'DOCUMENT';
346
- example: {
347
- header_handle: string[];
348
- };
349
- }
350
-
351
- export interface ResponseHeaderLocationComponent {
352
- type: 'HEADER';
353
- format: 'LOCATION';
354
- }
355
-
356
- export interface ResponseHeaderProductComponent {
357
- type: 'HEADER';
358
- format: 'PRODUCT';
359
- }
360
-
361
- export type ResponseHeaderComponent =
362
- | ResponseHeaderTextComponent
363
- | ResponseHeaderMediaComponent
364
- | ResponseHeaderLocationComponent
365
- | ResponseHeaderProductComponent;
366
-
367
- export interface ResponseBodyComponent {
368
- type: 'BODY';
369
- text: string;
370
- add_security_recommendation?: boolean;
371
- example?: {
372
- body_text?: string[][];
373
- body_text_named_params?: {
374
- param_name: string;
375
- example: string;
376
- }[];
377
- };
378
- }
379
-
380
- export interface ResponseFooterComponent {
381
- type: 'FOOTER';
382
- text: string;
383
- code_expiration_minutes?: number;
384
- }
385
-
386
- export interface ResponseButtonsComponent {
387
- type: 'BUTTONS';
388
- buttons: ResponseButton[];
389
- }
390
-
391
- export interface ResponseCarouselCard {
392
- components: (ResponseHeaderComponent | ResponseButtonsComponent)[];
393
- }
394
-
395
- export interface ResponseCarouselComponent {
396
- type: 'CAROUSEL';
397
- cards: ResponseCarouselCard[];
398
- }
399
-
400
- export type ResponseComponent =
401
- | ResponseHeaderComponent
402
- | ResponseBodyComponent
403
- | ResponseFooterComponent
404
- | ResponseButtonsComponent
405
- | ResponseCarouselComponent;
406
-
407
- export interface MessageTemplate {
408
- id: string;
409
- name: string;
410
- components?: ResponseComponent[];
411
- language: string;
412
- status: "APPROVED" | "PENDING" | "REJECTED";
413
- category: "UTILITY" | "MARKETING" | "AUTHENTICATION";
414
- message_send_ttl_seconds?: number;
415
- parameter_format?: "named" | "positional";
416
- sub_category?: string;
417
- }
418
-
419
- export interface GetAllTemplatesResponse {
420
- data: MessageTemplate[];
421
- paging?: Paging;
422
- }
423
-
424
-
425
- export interface TemplatesResponse {
426
- data?: { data: MessageTemplate[] };
427
- paging?: {
428
- cursors: {
429
- before: string;
430
- after: string;
431
- };
432
- next?: string;
433
- };
434
- message?: string;
435
- }