n8n-nodes-idb2b 3.1.9 → 3.2.1

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.
@@ -111,15 +111,10 @@ class IDB2B {
111
111
  if (!validation.isValid) {
112
112
  throw new Error(validation.error);
113
113
  }
114
- const contactData = Object.assign({ name }, additionalFields);
114
+ const contactData = Object.assign({ name, phone_number: phone_number || "" }, additionalFields);
115
115
  if (email)
116
116
  contactData.email = email;
117
- if (phone_number)
118
- contactData.phone_number = phone_number;
119
117
  body = (0, common_1.buildContactRequestBody)(contactData);
120
- // DEBUG: remove after fix confirmed
121
- console.log('[IDB2B DEBUG] contact create body:', JSON.stringify(body));
122
- console.log('[IDB2B DEBUG] raw params - email:', JSON.stringify(email), 'phone:', JSON.stringify(phone_number), 'additionalFields:', JSON.stringify(additionalFields));
123
118
  initialBody = body;
124
119
  }
125
120
  else if (operation === "update") {
@@ -209,10 +204,6 @@ class IDB2B {
209
204
  endpoint = `${constants_1.ENDPOINTS.COMPANIES}/${(0, common_1.sanitizeId)(companyId)}`;
210
205
  }
211
206
  }
212
- // DEBUG: remove after fix confirmed
213
- if (operation === "create" && resource === "contact") {
214
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), new Error(`DEBUG body sent: ${JSON.stringify(body)}`), { itemIndex: i });
215
- }
216
207
  const response = await httpClient.makeRequest({
217
208
  method,
218
209
  url: `${credentials.baseUrl}${endpoint}`,
@@ -122,12 +122,9 @@ function buildContactRequestBody(data, includesPhone = true) {
122
122
  if (trimmedEmail !== "")
123
123
  body.email = trimmedEmail;
124
124
  }
125
- // Include phone if provided
126
- if (includesPhone &&
127
- data.phone_number !== undefined &&
128
- data.phone_number !== null &&
129
- data.phone_number !== "") {
130
- body.phone_number = data.phone_number;
125
+ // Always include phone_number as a string (API requires it)
126
+ if (includesPhone) {
127
+ body.phone_number = (data.phone_number != null && data.phone_number !== "") ? String(data.phone_number) : "";
131
128
  }
132
129
  // Handle tags specially - convert from fixedCollection format
133
130
  if (data.tags && data.tags.tag && Array.isArray(data.tags.tag)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-idb2b",
3
- "version": "3.1.9",
3
+ "version": "3.2.1",
4
4
  "description": "n8n community node for IDB2B - WhatsApp AI Agents",
5
5
  "main": "index.js",
6
6
  "scripts": {