n8n-nodes-mailchimp-cmdesign 0.2.6 → 0.2.8

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,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.createUpdateSubscriber = void 0;
4
7
  const n8n_workflow_1 = require("n8n-workflow");
8
+ const crypto_1 = __importDefault(require("crypto"));
5
9
  async function createUpdateSubscriber(apiUrl, apiKey) {
6
10
  var _a, _b;
7
11
  const listId = this.getNodeParameter('listId', 0);
@@ -13,6 +17,7 @@ async function createUpdateSubscriber(apiUrl, apiKey) {
13
17
  mergeFields[field.mailChimpField] = String((_b = field.subscriberIncomingKey) !== null && _b !== void 0 ? _b : '');
14
18
  }
15
19
  }
20
+ const subscriberHash = crypto_1.default.createHash('md5').update(email.toLowerCase()).digest('hex');
16
21
  const body = {
17
22
  email_address: email,
18
23
  status: 'subscribed',
@@ -21,7 +26,7 @@ async function createUpdateSubscriber(apiUrl, apiKey) {
21
26
  try {
22
27
  const response = await this.helpers.httpRequest({
23
28
  method: 'PUT',
24
- url: `${apiUrl}/lists/${listId}/members`,
29
+ url: `${apiUrl}/lists/${listId}/members/${subscriberHash}`,
25
30
  headers: {
26
31
  Authorization: `apikey ${apiKey}`,
27
32
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mailchimp-cmdesign",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "n8n node to interact with Mailchimp API",
5
5
  "main": "index.js",
6
6
  "scripts": {