n8n-nodes-idb2b 2.0.5 → 2.0.7

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/README.md CHANGED
@@ -1,12 +1,16 @@
1
1
  # n8n-nodes-idb2b
2
2
 
3
- This is an n8n community node for IDB2B CRM API integration with advanced features for contact management and workflow automation.
3
+ An n8n community node for integrating with [IDB2B](https://idb2b.com) AI Agents that turn conversations into customers for WhatsApp, Instagram & TikTok.
4
4
 
5
5
  [n8n](https://n8n.io/) is a workflow automation platform.
6
6
 
7
+ ## What is this node?
8
+
9
+ IDB2B is an AI Agents platform that converts conversations into customers across WhatsApp, Instagram, and TikTok. This node lets you connect n8n to your IDB2B account to automate contact and company management — create, read, update, and delete records without writing code.
10
+
7
11
  ## Installation
8
12
 
9
- Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n documentation.
13
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n documentation, or install directly:
10
14
 
11
15
  ```bash
12
16
  npm install n8n-nodes-idb2b
@@ -14,107 +18,99 @@ npm install n8n-nodes-idb2b
14
18
 
15
19
  ## Credentials
16
20
 
17
- Configure the following credentials in n8n:
21
+ 1. In n8n, go to **Credentials → New → IDB2B WhatsApp AI Agents**
22
+ 2. Fill in:
23
+ - **Email**: Your IDB2B account email
24
+ - **Password**: Your IDB2B account password
25
+ - **Base URL**: `https://api.idb2b.com` (default)
26
+ 3. Click **Test connection** to verify, then **Save**
27
+
28
+ ## Resources & Operations
29
+
30
+ ### Contact
18
31
 
19
- - **Email**: Your IDB2B account email
20
- - **Password**: Your IDB2B account password
21
- - **Base URL**: Your IDB2B API base URL (default: `https://api-stage.idb2b.com`)
32
+ | Operation | Description |
33
+ |-----------|-------------|
34
+ | Get All | Retrieve a paginated list of contacts |
35
+ | Get | Fetch a single contact by ID |
36
+ | Create | Create a new contact |
37
+ | Update | Update an existing contact |
38
+ | Delete | Delete a contact |
22
39
 
23
- ## Features
40
+ ### Company
24
41
 
25
- ### 🚀 Performance Optimizations
26
- - **Token Caching**: Automatic authentication token caching (1-hour cache) for 60x faster subsequent requests
27
- - **Field Selection**: Choose specific fields to reduce payload size and improve performance
28
- - **Pagination**: Efficient handling of large contact datasets
42
+ | Operation | Description |
43
+ |-----------|-------------|
44
+ | Get All | Retrieve a paginated list of companies |
45
+ | Get | Fetch a single company by ID |
46
+ | Create | Create a new company |
47
+ | Update | Update an existing company |
48
+ | Delete | Delete a company |
29
49
 
30
- ### 🛡️ Enhanced Error Handling
31
- - Specific error messages for different HTTP status codes (401, 403, 404, 422, 429, 500)
32
- - Detailed error context with status codes and API response details
33
- - Graceful error recovery with continue-on-fail support
50
+ ## How to Use
34
51
 
35
- ## Contact Operations
52
+ ### Basic workflow
53
+
54
+ 1. Add the **IDB2B CRM** node to your workflow
55
+ 2. Select your saved credential under **Credential to connect with**
56
+ 3. Choose a **Resource** (Contact or Company)
57
+ 4. Choose an **Operation** (Get All, Get, Create, Update, Delete)
58
+ 5. Fill in the required parameters and execute
36
59
 
37
60
  ### Get All Contacts
38
- Retrieve contacts with advanced filtering and pagination:
39
-
40
- **Parameters:**
41
- - **Limit**: Maximum number of contacts to return (default: 50)
42
- - **Page**: Page number for pagination (default: 1)
43
- - **Fields to Return**: Select specific fields (id, name, email, phone_number, tags, etc.)
44
- - **Query Parameters**: Additional custom query parameters
45
-
46
- **Supported Fields:**
47
- - `id` - Contact ID
48
- - `name` - Contact name
49
- - `email` - Contact email
50
- - `phone_number` - Phone number
51
- - `organization_id` - Organization ID
52
- - `user_id` - Associated user ID
53
- - `lead_id` - Associated lead ID
54
- - `created_at` - Creation timestamp
55
- - `updated_at` - Last update timestamp
56
- - `favorites` - Favorite status
57
- - `tags` - Associated tags
58
61
 
59
- ### Create Contact
60
- Create new contacts with comprehensive data validation:
62
+ - **Limit**: Number of contacts per page (default: 10)
63
+ - **Page**: Page number (default: 1)
64
+ - **Fields to Return**: Optionally select specific fields (id, name, email, phone_number, tags, etc.)
65
+ - **Query Parameters**: Add any extra filters supported by the API
61
66
 
62
- **Required Fields:**
63
- - **Name**: Contact name (validated for non-empty)
64
- - **Email**: Contact email (validated for proper email format)
67
+ ### Get All Companies
65
68
 
66
- **Optional Fields:**
67
- - **Phone Number**: Contact phone number
68
- - **User ID**: Associate with specific user
69
- - **Lead ID**: Link to existing lead
70
- - **Favorites**: Mark as favorite (boolean)
71
- - **Tags**: Add multiple tags with names
69
+ - **Limit**: Number of companies per page (default: 10)
70
+ - **Page**: Page number (default: 1)
71
+ - **Fields to Return**: Optionally select specific fields
72
+ - **Query Parameters**: Add any extra filters
73
+
74
+ ### Create Contact
72
75
 
73
- **Features:**
74
- - Email format validation
75
- - Required field validation
76
- - ✅ Data sanitization (automatic trimming)
77
- - ✅ Support for all IDB2B contact fields
76
+ Required:
77
+ - **Name**: Contact full name
78
+ - **Email**: Valid email address
78
79
 
79
- ## Custom API Operations
80
+ Optional (under Additional Fields):
81
+ - Phone Number, User ID, Lead ID, Favorites, Tags
80
82
 
81
- For advanced use cases, the node supports custom API requests:
83
+ ### Create Company
82
84
 
83
- - **GET requests** - Custom endpoint queries
84
- - **POST requests** - Create resources with JSON body
85
- - **PUT requests** - Update resources with JSON body
86
- - **DELETE requests** - Delete resources
85
+ Required:
86
+ - **Name**: Company name
87
87
 
88
- **Custom Request Features:**
89
- - Custom endpoints specification
90
- - Query parameters support
91
- - JSON body for POST/PUT requests
92
- - Full HTTP method support
88
+ Optional (under Additional Fields):
89
+ - Any additional company fields supported by the API
93
90
 
94
91
  ## Example Workflows
95
92
 
96
- ### 1. Paginated Contact Retrieval
93
+ ### Retrieve all contacts and companies
94
+
97
95
  ```
98
- Trigger → IDB2B (Get All Contacts)
99
- - Limit: 100
100
- - Page: 1
101
- - Fields: ["id", "name", "email", "tags"]
96
+ Manual Trigger → Get all contacts → Get all companies
102
97
  ```
103
98
 
104
- ### 2. Contact Creation with Validation
99
+ ### Sync new contacts from a webhook
100
+
105
101
  ```
106
- Webhook → IDB2B (Create Contact)
107
- - Name: {{$json.name}}
108
- - Email: {{$json.email}}
109
- - Phone: {{$json.phone}}
110
- - Tags: [{"name": "Website Lead"}]
102
+ Webhook → IDB2B Create Contact
103
+ - Name: {{ $json.name }}
104
+ - Email: {{ $json.email }}
105
+ - Phone: {{ $json.phone }}
111
106
  ```
112
107
 
113
- ### 3. Custom API Query
108
+ ### Paginate through all contacts
109
+
114
110
  ```
115
- Schedule → IDB2B (Custom GET)
116
- - Endpoint: /api/v1/reports/contacts
117
- - Query Parameters: {"from": "2024-01-01", "to": "2024-12-31"}
111
+ Schedule Trigger → IDB2B Get All Contacts
112
+ - Limit: 100
113
+ - Page: 1
118
114
  ```
119
115
 
120
116
  ## Development
@@ -123,36 +119,29 @@ Schedule → IDB2B (Custom GET)
123
119
  # Install dependencies
124
120
  npm install
125
121
 
126
- # Build the project
122
+ # Build
127
123
  npm run build
128
124
 
129
- # Development with watch mode
125
+ # Watch mode
130
126
  npm run dev
131
127
 
132
- # Run linting
128
+ # Lint
133
129
  npm run lint
134
-
135
- # Format code
136
- npm run format
137
130
  ```
138
131
 
139
132
  ## Version History
140
133
 
134
+ ### v2.0.3
135
+ - Fixed endpoint paths (`/contacts`, `/companies`)
136
+ - Fixed access token parsing from login response
137
+ - Added Company resource with full CRUD operations
138
+
141
139
  ### v1.0.4
142
- - Enhanced contact operations with full API field support
143
- - Added pagination (limit, page) for contact retrieval
144
- - Implemented field selection for optimized responses
145
- - Added comprehensive input validation for contact creation
146
- - Enhanced error handling with specific HTTP status codes
147
- - Added token caching for improved performance
148
- - Updated to use modern n8n httpRequest API
140
+ - Added pagination, field selection, and token caching
141
+ - Enhanced error handling with HTTP status codes
149
142
 
150
143
  ### v1.0.3
151
- - Initial release with basic CRUD operations
152
-
153
- ## Contributing
154
-
155
- Contributions are welcome! Please feel free to submit a Pull Request.
144
+ - Initial release with basic contact CRUD operations
156
145
 
157
146
  ## License
158
147
 
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IDB2B = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
5
  const node_crypto_1 = require("node:crypto");
6
+ const node_timers_1 = require("node:timers");
6
7
  const contactProperties_1 = require("./descriptions/contactProperties");
7
8
  const companyProperties_1 = require("./descriptions/companyProperties");
8
9
  class SecureTokenCache {
@@ -129,12 +130,12 @@ async function makeRequestWithRetry(executeFunctions, options, maxRetries = 3, i
129
130
  if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 429) {
130
131
  const retryAfter = (_c = error.response.headers) === null || _c === void 0 ? void 0 : _c['retry-after'];
131
132
  const delay = retryAfter ? parseInt(retryAfter) * 1000 : initialDelay * Math.pow(2, attempt);
132
- await new Promise(resolve => setTimeout(resolve, Math.min(delay, 30000)));
133
+ await new Promise(resolve => (0, node_timers_1.setTimeout)(resolve, Math.min(delay, 30000)));
133
134
  }
134
135
  else {
135
136
  // Exponential backoff for other errors
136
137
  const delay = initialDelay * Math.pow(2, attempt);
137
- await new Promise(resolve => setTimeout(resolve, Math.min(delay, 10000)));
138
+ await new Promise(resolve => (0, node_timers_1.setTimeout)(resolve, Math.min(delay, 10000)));
138
139
  }
139
140
  }
140
141
  }
@@ -258,13 +259,13 @@ function sanitizeErrorData(data) {
258
259
  class IDB2B {
259
260
  constructor() {
260
261
  this.description = {
261
- displayName: 'IDB2B CRM',
262
+ displayName: 'IDB2B API',
262
263
  name: 'idb2b',
263
264
  icon: 'file:Icon.svg',
264
265
  group: ['transform'],
265
266
  version: 1,
266
267
  subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
267
- description: 'Interact with IDB2B API',
268
+ description: 'AI Agents that turn conversations into customers for WhatsApp, Instagram & TikTok',
268
269
  defaults: {
269
270
  name: 'IDB2B',
270
271
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-idb2b",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "n8n community node for IDB2B - WhatsApp AI Agents",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "format": "prettier nodes credentials --write",
10
10
  "lint": "eslint nodes/**/*.ts credentials/**/*.ts",
11
11
  "lintfix": "eslint nodes/**/*.ts credentials/**/*.ts --fix",
12
- "prepublishOnly": "npm run build"
12
+ "prepublishOnly": "npm run build",
13
+ "test": "npm run lint && npm run build"
13
14
  },
14
15
  "files": [
15
16
  "dist"