@webzzconnect/n8n-nodes-webzzconnect 0.0.0-stage → 0.4.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/dist/credentials/WebzzConnectApi.credentials.d.ts +10 -0
  4. package/dist/credentials/WebzzConnectApi.credentials.js +46 -0
  5. package/dist/credentials/WebzzConnectApi.credentials.js.map +1 -0
  6. package/dist/credentials/WebzzConnectOAuth2Api.credentials.d.ts +9 -0
  7. package/dist/credentials/WebzzConnectOAuth2Api.credentials.js +76 -0
  8. package/dist/credentials/WebzzConnectOAuth2Api.credentials.js.map +1 -0
  9. package/dist/nodes/WebzzConnect/GenericFunctions.d.ts +43 -0
  10. package/dist/nodes/WebzzConnect/GenericFunctions.js +253 -0
  11. package/dist/nodes/WebzzConnect/GenericFunctions.js.map +1 -0
  12. package/dist/nodes/WebzzConnect/WebzzConnect.node.d.ts +20 -0
  13. package/dist/nodes/WebzzConnect/WebzzConnect.node.js +789 -0
  14. package/dist/nodes/WebzzConnect/WebzzConnect.node.js.map +1 -0
  15. package/dist/nodes/WebzzConnect/WebzzConnect.node.json +12 -0
  16. package/dist/nodes/WebzzConnect/descriptions/ContactDescription.d.ts +3 -0
  17. package/dist/nodes/WebzzConnect/descriptions/ContactDescription.js +185 -0
  18. package/dist/nodes/WebzzConnect/descriptions/ContactDescription.js.map +1 -0
  19. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.d.ts +3 -0
  20. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.js +484 -0
  21. package/dist/nodes/WebzzConnect/descriptions/ConversationDescription.js.map +1 -0
  22. package/dist/nodes/WebzzConnect/descriptions/DealDescription.d.ts +3 -0
  23. package/dist/nodes/WebzzConnect/descriptions/DealDescription.js +282 -0
  24. package/dist/nodes/WebzzConnect/descriptions/DealDescription.js.map +1 -0
  25. package/dist/nodes/WebzzConnect/descriptions/WhatsAppTemplateDescription.d.ts +3 -0
  26. package/dist/nodes/WebzzConnect/descriptions/WhatsAppTemplateDescription.js +92 -0
  27. package/dist/nodes/WebzzConnect/descriptions/WhatsAppTemplateDescription.js.map +1 -0
  28. package/dist/nodes/WebzzConnect/webzzconnect.dark.svg +19 -0
  29. package/dist/nodes/WebzzConnect/webzzconnect.svg +19 -0
  30. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.d.ts +18 -0
  31. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.js +290 -0
  32. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.js.map +1 -0
  33. package/dist/nodes/WebzzConnectTrigger/WebzzConnectTrigger.node.json +12 -0
  34. package/dist/nodes/WebzzConnectTrigger/webzzconnect.dark.svg +19 -0
  35. package/dist/nodes/WebzzConnectTrigger/webzzconnect.svg +19 -0
  36. package/dist/package.json +64 -0
  37. package/dist/tsconfig.tsbuildinfo +1 -0
  38. package/package.json +62 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Webzz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # @webzzconnect/n8n-nodes-webzzconnect
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This is an n8n community node package for [WebzzConnect](https://connect.webzz.cloud), the omnichannel inbox, CRM and chatbot platform for small businesses. It lets you manage contacts, deals, conversations and WhatsApp templates from your n8n workflows, and start workflows instantly when something happens in WebzzConnect.
4
+
5
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
6
+
7
+ [Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Trigger](#trigger) · [Rate limits](#rate-limits) · [Compatibility](#compatibility)
8
+
9
+ ## Installation
10
+
11
+ Follow the [community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) and install `@webzzconnect/n8n-nodes-webzzconnect`.
12
+
13
+ ## Credentials
14
+
15
+ The package ships two credentials. Both nodes have an **Authentication** selector to pick one. The WebzzConnect address is fixed (`https://connect.webzz.cloud`), so there is no URL field.
16
+
17
+ **WebzzConnect API (self-hosted n8n)**
18
+
19
+ 1. In WebzzConnect, open **Settings > API keys** (administrators) and create a key. Tick `contacts:edit`, `deals:edit`, `conversations:reply`, `conversations:assign` and `conversations:resolve`, and optionally limit it to specific inboxes. The key is shown once.
20
+ 2. In n8n, create a **WebzzConnect API** credential and paste the key. The credential test calls `token_info`; the account is taken from the key.
21
+
22
+ **WebzzConnect OAuth2 API (n8n Cloud)**
23
+
24
+ Create a **WebzzConnect OAuth2 API** credential and click **Connect my account**. It is a public PKCE (S256) client with the client id built in, so there is nothing to paste. Sign in to WebzzConnect if asked and approve the permissions: `contacts:edit`, `deals:edit`, `conversations:reply`, `conversations:assign` and `conversations:resolve` (each edit scope includes the matching read access). The account is taken from the token. If you untick a permission, the matching actions fail with a clear "insufficient scope" message.
25
+
26
+ **Chatbot flows**
27
+
28
+ Use an API key: messages sent with it arrive with `sender` null and `additional_attributes.sender_name` = the key's name ("Sent by <key name>"), so they never match the human-reply rule. Messages sent through OAuth show the connected user as sender.
29
+
30
+ A human replied when `message_type` is outgoing, `private` is false, `content_attributes.automation_rule_id` is empty, and `sender.type` is "user" or `content_attributes.external_echo` is true (a reply from the WhatsApp Business app). WhatsApp campaign and scheduled template sends arrive with `message_type` "template", so they never match.
31
+
32
+ `button_payload` is customer input: compare it with Equals in a Switch node and keep a fallback; never use it in a Code node, a URL or an ID field.
33
+
34
+ Both credentials also work with n8n's HTTP Request node (**Predefined Credential Type**) for any WebzzConnect API call this node does not cover. Requests go to `https://connect.webzz.cloud/api/v1/accounts/<account id>/...`.
35
+
36
+ ## Operations
37
+
38
+ **Contact**
39
+ - Create
40
+ - Update
41
+ - Get
42
+ - Search (by name, email or phone)
43
+ - Create or Update: finds an existing contact by exact email or by phone number (national formats such as `050-1234567` match the stored international number), updates it, or creates a new one. Running it twice with the same data never creates a duplicate.
44
+
45
+ **Deal**
46
+ - Create (pick the pipeline and stage from your own lists)
47
+ - Update
48
+ - Move Stage (including won and lost, with an optional lost reason and note)
49
+ - Get
50
+ - Search (query, contact, pipeline, stage, owner, status)
51
+
52
+ **Conversation**
53
+ - Create (with an optional first message)
54
+ - Send Message (reply, or add a private note; optionally attach a file by public URL, with the text as a caption). **Message Type** also offers WhatsApp interactive messages: **Reply Buttons** (up to 3), **List** (up to 10 rows with optional descriptions and sections, and a menu label) and **Link Button** (one button that opens a URL), each with an optional header (text, or image / video / document by URL; a list only takes text) and footer. The message text is the body and is required. Each button or row has an ID (the title if left empty) that comes back as `button_payload` when the contact taps it. Interactive messages need a WhatsApp Cloud inbox and the 24-hour window; WebzzConnect checks WhatsApp's limits and answers with a clear message.
55
+ - Set Custom Attributes (key / value pairs, merged into the conversation's existing attributes; needs the conversations view and resolve permissions)
56
+ - Add Labels (comma-separated, sent in lowercase, added to the conversation's existing labels; needs the conversations view and reply permissions)
57
+ - Get
58
+ - Get Many (by status and inbox)
59
+ - Assign (an agent and/or a team; the agent must be a member of the conversation's inbox, and the node fails if the assignment was not applied)
60
+ - Unassign (agent, team, or both)
61
+ - Update Status (Open, Resolved or Snoozed with an optional Snooze Until). Resolved sends the CSAT survey when the inbox has CSAT on. Open through an agent's OAuth connection assigns the conversation to that agent; API keys do not.
62
+
63
+ **WhatsApp Template**
64
+ - Send: choose a WhatsApp inbox, a contact and an approved template, then fill the fields that appear for the template: header text or media URL, body variables (numbered or named), URL button variables and the copy-code coupon. If the template is set by an expression, fill **Body Variables** in order instead. The message is created in the contact's open conversation, or in a new one.
65
+
66
+ **Custom API Call**
67
+ - For an endpoint the node doesn't cover, pick **Custom API Call** in the node's actions. It opens an HTTP Request node. Set **Authentication** to *Predefined Credential Type*, choose **WebzzConnect API** (or **WebzzConnect OAuth2 API**), and call `https://connect.webzz.cloud/api/v1/accounts/<account id>/...`.
68
+
69
+ List-style operations have **Return All** and **Limit**. Fields that WebzzConnect uses internally (names starting with `wz_`) are removed from the output. Errors show the message from WebzzConnect; a rate-limit error tells you how long to wait.
70
+
71
+ ## Trigger
72
+
73
+ **WebzzConnect Trigger** starts a workflow instantly (no polling). Choose one or more events:
74
+
75
+ - New Conversation, Conversation Status Changed, Conversation Updated
76
+ - New Message (filter by incoming or outgoing). The output has a top-level `button_payload`: the ID of the tapped reply button or list row, the text (or payload) of a template quick reply, or `null` for typed text, so a Switch node can branch on `{{$json.button_payload}}`.
77
+ - Contact Created, Contact Updated
78
+ - Deal Created, Deal Updated, Deal Stage Changed, Deal Won, Deal Lost, Deal Deleted
79
+
80
+ Optionally narrow conversation and message events to some inboxes, and deal events to some pipelines. Leave a picker empty to receive events from all of them. To change the events or the pickers, deactivate and activate the workflow again.
81
+
82
+ Activating the workflow registers the n8n webhook address in WebzzConnect; deactivating removes it. If the n8n webhook address changes (for example a new host), the next activation replaces the old registration. Every delivery is checked against its HMAC-SHA256 signature (`X-WebzzConnect-Signature`) and rejected if it is older than five minutes. Your n8n webhook address must be reachable from the internet (set `WEBHOOK_URL` for self-hosted n8n).
83
+
84
+ The connected user needs access to the data behind each event, otherwise activation fails with a message naming the missing permission.
85
+
86
+ ## Rate limits
87
+
88
+ WebzzConnect allows 600 requests per minute per connection, and contact search is limited to 100 requests per minute per account. When a limit is hit the node fails with a rate-limit error that includes the `Retry-After` wait. Use **Retry On Fail** on the node, or a Wait node, in high-volume workflows.
89
+
90
+ ## Compatibility
91
+
92
+ Tested with n8n 1.x and 2.x (Node.js 22). Requires a WebzzConnect account.
93
+
94
+ ## Resources
95
+
96
+ - [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
97
+ - [WebzzConnect](https://connect.webzz.cloud)
98
+
99
+ ## Version history
100
+
101
+ - 0.1.0: first release.
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
2
+ export declare class WebzzConnectApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebzzConnectApi = void 0;
4
+ class WebzzConnectApi {
5
+ constructor() {
6
+ this.name = 'webzzConnectApi';
7
+ this.displayName = 'WebzzConnect API';
8
+ this.icon = {
9
+ light: 'file:../nodes/WebzzConnect/webzzconnect.svg',
10
+ dark: 'file:../nodes/WebzzConnect/webzzconnect.dark.svg',
11
+ };
12
+ this.documentationUrl = 'https://api-connect.webzz.cloud';
13
+ this.properties = [
14
+ {
15
+ displayName: 'Use on self-hosted n8n. Create the key in WebzzConnect > Settings > API keys (admins).',
16
+ name: 'notice',
17
+ type: 'notice',
18
+ default: '',
19
+ },
20
+ {
21
+ displayName: 'API Key',
22
+ name: 'apiKey',
23
+ type: 'string',
24
+ typeOptions: { password: true },
25
+ default: '',
26
+ required: true,
27
+ },
28
+ ];
29
+ this.authenticate = {
30
+ type: 'generic',
31
+ properties: {
32
+ headers: {
33
+ Authorization: '=Bearer {{$credentials.apiKey}}',
34
+ },
35
+ },
36
+ };
37
+ this.test = {
38
+ request: {
39
+ baseURL: 'https://connect.webzz.cloud',
40
+ url: '/api/v1/token_info',
41
+ },
42
+ };
43
+ }
44
+ }
45
+ exports.WebzzConnectApi = WebzzConnectApi;
46
+ //# sourceMappingURL=WebzzConnectApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebzzConnectApi.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectApi.credentials.ts"],"names":[],"mappings":";;;AAYA,MAAa,eAAe;IAA5B;QACC,SAAI,GAAG,iBAAiB,CAAC;QAEzB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EACV,wFAAwF;gBACzF,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,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;aACd;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6BAA6B;gBACtC,GAAG,EAAE,oBAAoB;aACzB;SACD,CAAC;IACH,CAAC;CAAA;AA7CD,0CA6CC"}
@@ -0,0 +1,9 @@
1
+ import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class WebzzConnectOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ extends: string[];
5
+ displayName: string;
6
+ icon: Icon;
7
+ documentationUrl: string;
8
+ properties: INodeProperties[];
9
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebzzConnectOAuth2Api = void 0;
4
+ class WebzzConnectOAuth2Api {
5
+ constructor() {
6
+ this.name = 'webzzConnectOAuth2Api';
7
+ this.extends = ['oAuth2Api'];
8
+ this.displayName = 'WebzzConnect OAuth2 API';
9
+ this.icon = {
10
+ light: 'file:../nodes/WebzzConnect/webzzconnect.svg',
11
+ dark: 'file:../nodes/WebzzConnect/webzzconnect.dark.svg',
12
+ };
13
+ this.documentationUrl = 'https://api-connect.webzz.cloud';
14
+ this.properties = [
15
+ {
16
+ displayName: 'For n8n Cloud. On self-hosted n8n, use WebzzConnect API.',
17
+ name: 'notice',
18
+ type: 'notice',
19
+ default: '',
20
+ },
21
+ {
22
+ displayName: 'Grant Type',
23
+ name: 'grantType',
24
+ type: 'hidden',
25
+ default: 'pkce',
26
+ },
27
+ {
28
+ displayName: 'Authorization URL',
29
+ name: 'authUrl',
30
+ type: 'hidden',
31
+ default: 'https://connect.webzz.cloud/oauth/authorize',
32
+ required: true,
33
+ },
34
+ {
35
+ displayName: 'Access Token URL',
36
+ name: 'accessTokenUrl',
37
+ type: 'hidden',
38
+ default: 'https://connect.webzz.cloud/oauth/token',
39
+ required: true,
40
+ },
41
+ {
42
+ displayName: 'Client ID',
43
+ name: 'clientId',
44
+ type: 'hidden',
45
+ default: '-nXfHxzbF6UryNF2eXwo2ufe3tbvUA2rbTZ-k6Mz-gM',
46
+ },
47
+ {
48
+ displayName: 'Client Secret',
49
+ name: 'clientSecret',
50
+ type: 'hidden',
51
+ typeOptions: { password: true },
52
+ default: '',
53
+ },
54
+ {
55
+ displayName: 'Scope',
56
+ name: 'scope',
57
+ type: 'hidden',
58
+ default: 'contacts:edit deals:edit conversations:reply conversations:assign conversations:resolve',
59
+ },
60
+ {
61
+ displayName: 'Auth URI Query Parameters',
62
+ name: 'authQueryParameters',
63
+ type: 'hidden',
64
+ default: '',
65
+ },
66
+ {
67
+ displayName: 'Authentication',
68
+ name: 'authentication',
69
+ type: 'hidden',
70
+ default: 'body',
71
+ },
72
+ ];
73
+ }
74
+ }
75
+ exports.WebzzConnectOAuth2Api = WebzzConnectOAuth2Api;
76
+ //# sourceMappingURL=WebzzConnectOAuth2Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebzzConnectOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/WebzzConnectOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,qBAAqB;IAAlC;QACC,SAAI,GAAG,uBAAuB,CAAC;QAE/B,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,yBAAyB,CAAC;QAExC,SAAI,GAAS;YACZ,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,kDAAkD;SACxD,CAAC;QAEF,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,0DAA0D;gBACvE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;gBACtD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yCAAyC;gBAClD,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6CAA6C;aACtD;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,yFAAyF;aAClG;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;SACD,CAAC;IACH,CAAC;CAAA;AAzED,sDAyEC"}
@@ -0,0 +1,43 @@
1
+ import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions, INode, INodeProperties, IWebhookFunctions } from 'n8n-workflow';
2
+ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
3
+ export declare const BASE_URL = "https://connect.webzz.cloud";
4
+ export declare const API_KEY_CREDENTIAL = "webzzConnectApi";
5
+ export declare const PKCE_CREDENTIAL = "webzzConnectOAuth2Api";
6
+ export declare const authenticationProperty: INodeProperties;
7
+ export type WzContext = IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions;
8
+ interface RequestOptions {
9
+ qs?: IDataObject;
10
+ body?: IDataObject;
11
+ absolute?: boolean;
12
+ }
13
+ export interface ErrorInfo {
14
+ status?: number;
15
+ message: string;
16
+ retryAfter?: string;
17
+ body?: IDataObject;
18
+ }
19
+ export declare function digitsOnly(value: string): string;
20
+ export declare function stripInternalKeys<T>(value: T): T;
21
+ export declare function getCredentialName(this: WzContext): string;
22
+ export declare function getAccountId(this: WzContext): Promise<string>;
23
+ export declare function pathId(this: WzContext, value: unknown): string;
24
+ export declare function wzRawRequest(this: WzContext, method: IHttpRequestMethods, path: string, options?: RequestOptions): Promise<unknown>;
25
+ export declare function readErrorInfo(error: unknown): ErrorInfo;
26
+ export declare function handleApiError(this: WzContext, error: unknown): never;
27
+ export declare function errorForItem(node: INode, error: unknown, itemIndex: number): NodeApiError | NodeOperationError;
28
+ export declare function wzApiRequest(this: WzContext, method: IHttpRequestMethods, path: string, options?: RequestOptions): Promise<unknown>;
29
+ interface PaginateOptions {
30
+ qs?: IDataObject;
31
+ returnAll: boolean;
32
+ limit: number;
33
+ pageSize: number;
34
+ extract: (response: unknown) => IDataObject[];
35
+ hasMore?: (response: unknown, items: IDataObject[]) => boolean;
36
+ }
37
+ export declare function wzPaginate(this: WzContext, path: string, options: PaginateOptions): Promise<IDataObject[]>;
38
+ export declare function asArray(response: unknown): IDataObject[];
39
+ export declare function asObject(value: unknown): IDataObject;
40
+ export declare function unwrapContact(response: unknown): IDataObject;
41
+ export declare function pairsToObject(pairs: IDataObject | undefined): IDataObject;
42
+ export declare function phonesMatch(a: string, b: string): boolean;
43
+ export {};
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authenticationProperty = exports.PKCE_CREDENTIAL = exports.API_KEY_CREDENTIAL = exports.BASE_URL = void 0;
4
+ exports.digitsOnly = digitsOnly;
5
+ exports.stripInternalKeys = stripInternalKeys;
6
+ exports.getCredentialName = getCredentialName;
7
+ exports.getAccountId = getAccountId;
8
+ exports.pathId = pathId;
9
+ exports.wzRawRequest = wzRawRequest;
10
+ exports.readErrorInfo = readErrorInfo;
11
+ exports.handleApiError = handleApiError;
12
+ exports.errorForItem = errorForItem;
13
+ exports.wzApiRequest = wzApiRequest;
14
+ exports.wzPaginate = wzPaginate;
15
+ exports.asArray = asArray;
16
+ exports.asObject = asObject;
17
+ exports.unwrapContact = unwrapContact;
18
+ exports.pairsToObject = pairsToObject;
19
+ exports.phonesMatch = phonesMatch;
20
+ const n8n_workflow_1 = require("n8n-workflow");
21
+ exports.BASE_URL = 'https://connect.webzz.cloud';
22
+ exports.API_KEY_CREDENTIAL = 'webzzConnectApi';
23
+ exports.PKCE_CREDENTIAL = 'webzzConnectOAuth2Api';
24
+ exports.authenticationProperty = {
25
+ displayName: 'Authentication',
26
+ name: 'authentication',
27
+ type: 'options',
28
+ options: [
29
+ { name: 'API Key', value: 'apiKey' },
30
+ { name: 'OAuth2', value: 'oAuth2' },
31
+ ],
32
+ default: 'apiKey',
33
+ description: 'For a chatbot flow, use an API key: its messages arrive with sender null ("Sent by &lt;key name&gt;"), so they never match the human-reply rule in the trigger\'s New Message description. Messages sent through OAuth show the connected user as sender.',
34
+ };
35
+ function digitsOnly(value) {
36
+ return value.replace(/\D/g, '');
37
+ }
38
+ function stripInternalKeys(value) {
39
+ if (Array.isArray(value)) {
40
+ return value.map((entry) => stripInternalKeys(entry));
41
+ }
42
+ if (value !== null && typeof value === 'object') {
43
+ const clean = {};
44
+ for (const [key, entry] of Object.entries(value)) {
45
+ if (key.startsWith('wz_'))
46
+ continue;
47
+ clean[key] = stripInternalKeys(entry);
48
+ }
49
+ return clean;
50
+ }
51
+ return value;
52
+ }
53
+ function getCredentialName() {
54
+ const selected = 'getInputData' in this
55
+ ? this.getNodeParameter('authentication', 0, 'apiKey')
56
+ : this.getNodeParameter('authentication', 'apiKey');
57
+ return selected === 'oAuth2' ? exports.PKCE_CREDENTIAL : exports.API_KEY_CREDENTIAL;
58
+ }
59
+ const accountIdCache = new WeakMap();
60
+ async function sendRequest(method, url, options) {
61
+ const requestOptions = {
62
+ method,
63
+ url,
64
+ json: true,
65
+ headers: { Accept: 'application/json' },
66
+ };
67
+ if (options.qs && Object.keys(options.qs).length > 0)
68
+ requestOptions.qs = options.qs;
69
+ if (options.body && Object.keys(options.body).length > 0)
70
+ requestOptions.body = options.body;
71
+ return await this.helpers.httpRequestWithAuthentication.call(this, getCredentialName.call(this), requestOptions);
72
+ }
73
+ async function getAccountId() {
74
+ const credentialName = getCredentialName.call(this);
75
+ if (credentialName === exports.PKCE_CREDENTIAL) {
76
+ const credentials = await this.getCredentials(credentialName);
77
+ const tokenData = credentials.oauthTokenData;
78
+ if ((tokenData === null || tokenData === void 0 ? void 0 : tokenData.account_id) !== undefined && tokenData.account_id !== null) {
79
+ return String(tokenData.account_id);
80
+ }
81
+ }
82
+ const cached = accountIdCache.get(this);
83
+ if (cached !== undefined)
84
+ return cached;
85
+ const info = (await sendRequest.call(this, 'GET', `${exports.BASE_URL}/api/v1/token_info`, {}));
86
+ const account = info.account;
87
+ if ((account === null || account === void 0 ? void 0 : account.id) === undefined) {
88
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not determine the WebzzConnect account for this credential. Check the API key, or reconnect the OAuth credential.');
89
+ }
90
+ const accountId = String(account.id);
91
+ accountIdCache.set(this, accountId);
92
+ return accountId;
93
+ }
94
+ function pathId(value) {
95
+ const id = String(value !== null && value !== void 0 ? value : '').trim();
96
+ if (!/^\d+$/.test(id)) {
97
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `"${String(value)}" is not a valid ID (a number)`);
98
+ }
99
+ return id;
100
+ }
101
+ async function wzRawRequest(method, path, options = {}) {
102
+ if (options.absolute) {
103
+ return await sendRequest.call(this, method, `${exports.BASE_URL}${path}`, options);
104
+ }
105
+ const accountId = await getAccountId.call(this);
106
+ return await sendRequest.call(this, method, `${exports.BASE_URL}/api/v1/accounts/${pathId.call(this, accountId)}${path}`, options);
107
+ }
108
+ function readErrorInfo(error) {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
110
+ const err = error;
111
+ const response = (_a = err.response) !== null && _a !== void 0 ? _a : (_b = err.cause) === null || _b === void 0 ? void 0 : _b.response;
112
+ const rawStatus = (_f = (_e = (_d = (_c = err.httpCode) !== null && _c !== void 0 ? _c : err.statusCode) !== null && _d !== void 0 ? _d : err.status) !== null && _e !== void 0 ? _e : response === null || response === void 0 ? void 0 : response.status) !== null && _f !== void 0 ? _f : (_g = err.cause) === null || _g === void 0 ? void 0 : _g.status;
113
+ const status = rawStatus !== undefined ? Number(rawStatus) : undefined;
114
+ let body = (_j = (_h = response === null || response === void 0 ? void 0 : response.data) !== null && _h !== void 0 ? _h : response === null || response === void 0 ? void 0 : response.body) !== null && _j !== void 0 ? _j : (_k = err.context) === null || _k === void 0 ? void 0 : _k.data;
115
+ if (typeof body === 'string') {
116
+ try {
117
+ body = JSON.parse(body);
118
+ }
119
+ catch {
120
+ }
121
+ }
122
+ const bodyObject = body !== null && typeof body === 'object' ? body : undefined;
123
+ let message = '';
124
+ if (bodyObject) {
125
+ const direct = (_m = (_l = bodyObject.message) !== null && _l !== void 0 ? _l : bodyObject.error_description) !== null && _m !== void 0 ? _m : bodyObject.error;
126
+ if (typeof direct === 'string')
127
+ message = direct;
128
+ else if (Array.isArray(bodyObject.errors))
129
+ message = bodyObject.errors.join(', ');
130
+ }
131
+ else if (typeof body === 'string') {
132
+ message = body;
133
+ }
134
+ const headers = ((_o = response === null || response === void 0 ? void 0 : response.headers) !== null && _o !== void 0 ? _o : {});
135
+ const retryAfter = (_p = headers['retry-after']) !== null && _p !== void 0 ? _p : headers['Retry-After'];
136
+ return {
137
+ status: Number.isFinite(status) ? status : undefined,
138
+ message: message || err.description || err.message || 'Unknown error',
139
+ retryAfter: retryAfter !== undefined ? String(retryAfter) : undefined,
140
+ body: bodyObject,
141
+ };
142
+ }
143
+ function handleApiError(error) {
144
+ if (error instanceof n8n_workflow_1.NodeOperationError)
145
+ throw error;
146
+ const info = readErrorInfo(error);
147
+ const options = {
148
+ message: info.message,
149
+ };
150
+ if (info.status !== undefined)
151
+ options.httpCode = String(info.status);
152
+ if (info.status === 429) {
153
+ options.message = 'WebzzConnect rate limit reached';
154
+ options.description = info.retryAfter
155
+ ? `Too many requests. WebzzConnect asks you to retry after ${info.retryAfter} seconds (Retry-After). Add a Wait node or enable "Retry On Fail" for this node.`
156
+ : 'Too many requests. Wait a moment and retry, or enable "Retry On Fail" for this node. Contact search is limited to 100 requests per minute per account.';
157
+ }
158
+ else if (info.status === 403) {
159
+ options.message = info.message || 'Forbidden';
160
+ options.description =
161
+ 'The API key or OAuth consent does not allow this action (insufficient scope or inbox restriction). Check the key\'s permissions in WebzzConnect, or reconnect the OAuth credential and approve all requested permissions.';
162
+ }
163
+ else if (info.status === 401) {
164
+ options.description =
165
+ 'The WebzzConnect API key or access token was rejected. Check the API key (it may have been revoked), or reconnect the OAuth credential. A password change in WebzzConnect revokes OAuth connections.';
166
+ }
167
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error, options);
168
+ }
169
+ function errorForItem(node, error, itemIndex) {
170
+ if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
171
+ error.context.itemIndex = itemIndex;
172
+ return error;
173
+ }
174
+ return new n8n_workflow_1.NodeApiError(node, error, { itemIndex });
175
+ }
176
+ async function wzApiRequest(method, path, options = {}) {
177
+ try {
178
+ return await wzRawRequest.call(this, method, path, options);
179
+ }
180
+ catch (error) {
181
+ return handleApiError.call(this, error);
182
+ }
183
+ }
184
+ async function wzPaginate(path, options) {
185
+ var _a;
186
+ const results = [];
187
+ let page = 1;
188
+ for (let guard = 0; guard < 1000; guard++) {
189
+ const response = await wzApiRequest.call(this, 'GET', path, {
190
+ qs: { ...((_a = options.qs) !== null && _a !== void 0 ? _a : {}), page },
191
+ });
192
+ const items = options.extract(response);
193
+ results.push(...items);
194
+ if (!options.returnAll && results.length >= options.limit)
195
+ break;
196
+ const more = options.hasMore
197
+ ? options.hasMore(response, items)
198
+ : items.length >= options.pageSize;
199
+ if (!more || items.length === 0)
200
+ break;
201
+ page++;
202
+ }
203
+ return options.returnAll ? results : results.slice(0, options.limit);
204
+ }
205
+ function asArray(response) {
206
+ if (Array.isArray(response))
207
+ return response;
208
+ const root = asObject(response);
209
+ for (const key of ['payload', 'data']) {
210
+ if (Array.isArray(root[key]))
211
+ return root[key];
212
+ }
213
+ return [];
214
+ }
215
+ function asObject(value) {
216
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
217
+ ? value
218
+ : {};
219
+ }
220
+ function unwrapContact(response) {
221
+ const root = asObject(response);
222
+ const payload = asObject(root.payload);
223
+ if (Object.keys(payload).length > 0) {
224
+ const nested = asObject(payload.contact);
225
+ return Object.keys(nested).length > 0 ? nested : payload;
226
+ }
227
+ return root;
228
+ }
229
+ function pairsToObject(pairs) {
230
+ var _a, _b;
231
+ const out = {};
232
+ const entries = (_a = pairs === null || pairs === void 0 ? void 0 : pairs.values) !== null && _a !== void 0 ? _a : [];
233
+ for (const entry of entries) {
234
+ const key = String((_b = entry.key) !== null && _b !== void 0 ? _b : '').trim();
235
+ if (key)
236
+ out[key] = entry.value;
237
+ }
238
+ return out;
239
+ }
240
+ function phonesMatch(a, b) {
241
+ const da = digitsOnly(a);
242
+ const db = digitsOnly(b);
243
+ if (!da || !db)
244
+ return false;
245
+ if (da === db)
246
+ return true;
247
+ const sa = da.replace(/^0+/, '');
248
+ const sb = db.replace(/^0+/, '');
249
+ if (sa.length < 7 || sb.length < 7)
250
+ return false;
251
+ return sa.endsWith(sb) || sb.endsWith(sa);
252
+ }
253
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/WebzzConnect/GenericFunctions.ts"],"names":[],"mappings":";;;AAqDA,gCAEC;AAGD,8CAaC;A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AAK,EAAE,EAAE,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACjD,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription, ResourceMapperFields } from 'n8n-workflow';
2
+ export declare class WebzzConnect implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ resourceMapping: {
6
+ getTemplateFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
7
+ };
8
+ loadOptions: {
9
+ getPipelines(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
10
+ getStages(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
11
+ getLostReasons(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
12
+ getInboxes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
13
+ getAgents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
14
+ getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
15
+ getWhatsAppInboxes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
16
+ getWhatsAppTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
17
+ };
18
+ };
19
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
20
+ }