@orchesty/connector-mailchimp 1.0.2 → 2.0.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.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Mailchimp Connector
2
+
3
+ [![npm](https://img.shields.io/npm/v/@orchesty/connector-mailchimp?color=15ba68)](https://www.npmjs.com/package/@orchesty/connector-mailchimp)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-15ba68)](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE)
5
+
6
+ An [Orchesty](https://orchesty.io) connector for Mailchimp, a mail marketing automation service that lets you send out professional-looking newsletters and manage your audience.
7
+
8
+ ## Application Type
9
+
10
+ **OAuth 2.0**
11
+
12
+ This connector uses the Mailchimp OAuth 2.0 authorization flow. After entering your credentials in Orchesty, you will be redirected to Mailchimp to authorize access. The connector also supports webhook subscriptions for real-time audience events.
13
+
14
+ | Field | Description |
15
+ |---|---|
16
+ | `client_id` | OAuth Client ID from the Mailchimp Developer Portal |
17
+ | `client_secret` | OAuth Client Secret from the Mailchimp Developer Portal |
18
+ | `audience_id` | ID of the Mailchimp audience (list) to work with |
19
+
20
+ ## Components
21
+
22
+ | Class | Type | Description |
23
+ |---|---|---|
24
+ | `MailchimpCreateContactConnector` | Connector | Creates a new contact (member) in the configured audience via `POST /3.0/lists/{audienceId}/members/` |
25
+ | `MailchimpTagContactConnector` | Connector | Adds a contact to a segment (tag) within the audience via `POST /3.0/lists/{audienceId}/segments/{segmentId}/members` |
26
+
27
+ ## Setup
28
+
29
+ ### Credentials
30
+
31
+ 1. Log in to [Mailchimp](https://mailchimp.com/) and navigate to **Account → Extras → Registered apps**.
32
+ 2. Click **Register an app** and provide a name and redirect URL.
33
+ 3. Copy the **Client ID** and **Client Secret**.
34
+ 4. Find your **Audience ID** in **Audience → All contacts → Settings → Audience name and defaults**.
35
+ 5. In Orchesty, open the Mailchimp application settings, enter the credentials, and complete the OAuth authorization flow.
36
+
37
+ ### API Documentation
38
+
39
+ Mailchimp Marketing API: [https://mailchimp.com/developer/marketing/api/](https://mailchimp.com/developer/marketing/api/)
40
+
41
+ ## Installation & Usage
42
+
43
+ Install the package:
44
+
45
+ ```bash
46
+ npm install @orchesty/connector-mailchimp @orchesty/nodejs-sdk
47
+ # or
48
+ pnpm add @orchesty/connector-mailchimp @orchesty/nodejs-sdk
49
+ ```
50
+
51
+ Register the application and nodes in your Orchesty DI container:
52
+
53
+ ```typescript
54
+ import { container } from '@orchesty/nodejs-sdk';
55
+ import CurlSender from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/CurlSender';
56
+ import { OAuth2Provider } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Provider/OAuth2/OAuth2Provider';
57
+ import MailchimpApplication from '@orchesty/connector-mailchimp/dist/MailchimpApplication';
58
+ import MailchimpCreateContactConnector from '@orchesty/connector-mailchimp/dist/Connector/MailchimpCreateContactConnector';
59
+ import MailchimpTagContactConnector from '@orchesty/connector-mailchimp/dist/Connector/MailchimpTagContactConnector';
60
+
61
+ const app = new MailchimpApplication(container.get(CurlSender), container.get(OAuth2Provider));
62
+ container.setApplication(app);
63
+ container.setNode(new MailchimpCreateContactConnector(), app);
64
+ container.setNode(new MailchimpTagContactConnector(), app);
65
+ ```
66
+
67
+ ## License
68
+
69
+ This connector is released under the **Apache License 2.0**. See the [LICENSE](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE) file for the full license text.
70
+
71
+ ## Contributing
72
+
73
+ Contributions are welcome! This connector is part of the open-source [Orchesty Node.js Connectors](https://github.com/Orchesty/orchesty-nodejs-connectors) monorepo.
74
+
75
+ For guidelines on how to create or update connectors — including project setup, coding conventions, and how to write tests — please refer to the **[Contributing to Connectors](https://orchesty.io/community/contributing-to-connectors)** guide.
76
+
77
+ All contributions should include:
78
+ - Source code in `src/` following the existing connector structure
79
+ - Tests in `src/**/__tests__/` with `input.json`, `mock.json`, and `output.json` fixtures
80
+ - An updated `CHANGELOG.md` entry
@@ -122,7 +122,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
122
122
  ];
123
123
  }
124
124
  getWebhookSubscribeRequestDto(applicationInstall, subscription, url) {
125
- return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.POST, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}
125
+ return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), applicationInstall.getSdk(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.POST, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}
126
126
  /3.0/lists/${applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUDIENCE_ID]}/webhooks`, JSON.stringify({
127
127
  url,
128
128
  events: {
@@ -136,7 +136,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
136
136
  }));
137
137
  }
138
138
  getWebhookUnsubscribeRequestDto(applicationInstall, webhook) {
139
- return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.DELETE, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}/3.0/lists/${applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUDIENCE_ID]}/webhooks/${webhook.getWebhookId()}`);
139
+ return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), applicationInstall.getSdk(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.DELETE, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}/3.0/lists/${applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUDIENCE_ID]}/webhooks/${webhook.getWebhookId()}`);
140
140
  }
141
141
  processWebhookSubscribeResponse(dto, applicationInstall) {
142
142
  return JSON.parse(dto.getBody()).id;
@@ -145,7 +145,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
145
145
  return dto.getResponseCode() === http_status_codes_1.StatusCodes.NO_CONTENT;
146
146
  }
147
147
  async getApiEndpoint(applicationInstall) {
148
- const output = await this.sender.send(this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.GET, '%s/oauth2/metadata', exports.MAILCHIMP_DATACENTER_URL));
148
+ const output = await this.sender.send(this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), applicationInstall.getSdk(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.GET, '%s/oauth2/metadata', exports.MAILCHIMP_DATACENTER_URL));
149
149
  return output.getJsonBody() ?? '';
150
150
  }
151
151
  }
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orchesty/connector-mailchimp",
3
3
  "description": "",
4
- "version": "1.0.1",
4
+ "version": "2.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
7
  "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
@@ -17,7 +17,7 @@
17
17
  "keywords": [],
18
18
  "author": "info@hanaboso.com",
19
19
  "dependencies": {
20
- "@orchesty/nodejs-sdk": "^4.3.6",
20
+ "@orchesty/nodejs-sdk": "^5.0.13",
21
21
  "http-status-codes": "^2.3.0"
22
22
  },
23
23
  "engines": {
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@orchesty/connector-mailchimp",
3
3
  "description": "",
4
- "version": "1.0.2",
4
+ "version": "2.0.1",
5
5
  "license": "Apache-2.0",
6
6
  "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
- "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Orchesty/orchesty-nodejs-connectors"
10
+ },
8
11
  "files": [
9
12
  "dist"
10
13
  ],
11
14
  "keywords": [],
12
15
  "author": "info@hanaboso.com",
13
16
  "dependencies": {
14
- "@orchesty/nodejs-sdk": "^4.3.6",
17
+ "@orchesty/nodejs-sdk": "^5.0.13",
15
18
  "http-status-codes": "^2.3.0"
16
19
  },
17
20
  "engines": {