n8n-nodes-mailchimp-cmdesign 0.2.8 → 0.3.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.
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.createUpdateSubscriber = void 0;
7
4
  const n8n_workflow_1 = require("n8n-workflow");
8
- const crypto_1 = __importDefault(require("crypto"));
9
5
  async function createUpdateSubscriber(apiUrl, apiKey) {
10
6
  var _a, _b;
11
7
  const listId = this.getNodeParameter('listId', 0);
@@ -17,16 +13,20 @@ async function createUpdateSubscriber(apiUrl, apiKey) {
17
13
  mergeFields[field.mailChimpField] = String((_b = field.subscriberIncomingKey) !== null && _b !== void 0 ? _b : '');
18
14
  }
19
15
  }
20
- const subscriberHash = crypto_1.default.createHash('md5').update(email.toLowerCase()).digest('hex');
21
16
  const body = {
22
- email_address: email,
23
- status: 'subscribed',
24
- merge_fields: mergeFields,
17
+ members: [
18
+ {
19
+ email_address: email,
20
+ status: 'subscribed',
21
+ merge_fields: mergeFields,
22
+ },
23
+ ],
24
+ update_existing: true,
25
25
  };
26
26
  try {
27
27
  const response = await this.helpers.httpRequest({
28
- method: 'PUT',
29
- url: `${apiUrl}/lists/${listId}/members/${subscriberHash}`,
28
+ method: 'POST',
29
+ url: `${apiUrl}/lists/${listId}`,
30
30
  headers: {
31
31
  Authorization: `apikey ${apiKey}`,
32
32
  },
@@ -37,7 +37,7 @@ async function createUpdateSubscriber(apiUrl, apiKey) {
37
37
  }
38
38
  catch (error) {
39
39
  throw new n8n_workflow_1.NodeApiError(this.getNode(), error, {
40
- message: 'Hiba történt az előfizető létrehozása közben.',
40
+ message: 'Hiba történt az előfizető létrehozása/frissítése közben.',
41
41
  });
42
42
  }
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mailchimp-cmdesign",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "n8n node to interact with Mailchimp API",
5
5
  "main": "index.js",
6
6
  "scripts": {