n8n-nodes-idb2b 3.1.3 → 3.1.5

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.
@@ -58,6 +58,7 @@ class IDB2B {
58
58
  };
59
59
  }
60
60
  async execute() {
61
+ var _a;
61
62
  const items = this.getInputData();
62
63
  const returnData = [];
63
64
  const errorHandler = errorHandler_1.defaultErrorHandler;
@@ -103,8 +104,8 @@ class IDB2B {
103
104
  method = "POST";
104
105
  endpoint = constants_1.ENDPOINTS.CONTACTS;
105
106
  const name = this.getNodeParameter("name", i);
106
- const email = this.getNodeParameter("email", i);
107
- const phone_number = this.getNodeParameter("phone_number", i, "");
107
+ const email = this.getNodeParameter("email", i, "") || "";
108
+ const phone_number = this.getNodeParameter("phone_number", i, "") || "";
108
109
  const additionalFields = this.getNodeParameter("additionalFields", i, {});
109
110
  const validation = validator.validateContactData(name, email, phone_number, false);
110
111
  if (!validation.isValid) {
@@ -249,9 +250,17 @@ class IDB2B {
249
250
  });
250
251
  continue;
251
252
  }
252
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
253
- itemIndex: i,
254
- });
253
+ let errorMsg = error.message;
254
+ if (error instanceof Error &&
255
+ "response" in error &&
256
+ ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
257
+ try {
258
+ const apiError = error.response.data;
259
+ errorMsg += ` | API response: ${typeof apiError === "string" ? apiError : JSON.stringify(apiError)}`;
260
+ }
261
+ catch (_b) { }
262
+ }
263
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), new Error(errorMsg), { itemIndex: i });
255
264
  }
256
265
  }
257
266
  return [returnData];
@@ -117,11 +117,10 @@ function buildContactRequestBody(data, includesPhone = true) {
117
117
  if (data.name !== undefined) {
118
118
  body.name = typeof data.name === "string" ? data.name.trim() : data.name;
119
119
  }
120
- if (data.email !== undefined && data.email !== "") {
121
- body.email =
122
- typeof data.email === "string" ? data.email.trim() : data.email;
123
- if (body.email === "")
124
- delete body.email;
120
+ if (data.email !== undefined && data.email !== null && data.email !== "") {
121
+ const trimmedEmail = typeof data.email === "string" ? data.email.trim() : data.email;
122
+ if (trimmedEmail !== "")
123
+ body.email = trimmedEmail;
125
124
  }
126
125
  // Include phone if provided
127
126
  if (includesPhone &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-idb2b",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "n8n community node for IDB2B - WhatsApp AI Agents",
5
5
  "main": "index.js",
6
6
  "scripts": {