@activepieces/piece-mautic 0.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 +10 -0
- package/package.json +16 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +17 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-contact.d.ts +1 -0
- package/src/lib/actions/create-contact.js +53 -0
- package/src/lib/actions/create-contact.js.map +1 -0
- package/src/lib/common/index.d.ts +12 -0
- package/src/lib/common/index.js +59 -0
- package/src/lib/common/index.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# pieces-mautic
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Running lint
|
|
6
|
+
|
|
7
|
+
Run `nx lint pieces-mautic` to execute the lint via [ESLint](https://eslint.org/).
|
|
8
|
+
|
|
9
|
+
## For Testing
|
|
10
|
+
Create a Sandbox account by following instructions [here](https://www.mautic.org/demo)
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-mautic",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "0.26.8",
|
|
6
|
+
"axios": "1.2.4",
|
|
7
|
+
"lodash": "4.17.21",
|
|
8
|
+
"nanoid": "3.3.4",
|
|
9
|
+
"@activepieces/pieces-framework": "0.3.19",
|
|
10
|
+
"@activepieces/shared": "0.3.27",
|
|
11
|
+
"@activepieces/pieces-common": "0.0.1",
|
|
12
|
+
"tslib": "2.4.1"
|
|
13
|
+
},
|
|
14
|
+
"main": "./src/index.js",
|
|
15
|
+
"types": "./src/index.d.ts"
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mautic: import("@activepieces/pieces-framework").Piece;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mautic = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
7
|
+
const create_contact_1 = require("./lib/actions/create-contact");
|
|
8
|
+
exports.mautic = (0, pieces_framework_1.createPiece)({
|
|
9
|
+
name: "mautic",
|
|
10
|
+
displayName: "Mautic",
|
|
11
|
+
logoUrl: "https://cdn.activepieces.com/pieces/mautic.png",
|
|
12
|
+
version: package_json_1.default.version,
|
|
13
|
+
authors: ["bibhuty-did-this"],
|
|
14
|
+
actions: [create_contact_1.createContact],
|
|
15
|
+
triggers: [],
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/mautic/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAA6D;AAC7D,2EAA0C;AAC1C,iEAA2D;AAE9C,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,gDAAgD;IACzD,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,OAAO,EAAE,CAAC,kBAAkB,CAAC;IAC7B,OAAO,EAAE,CAAC,8BAAa,CAAC;IACxB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createContact: import("@activepieces/pieces-framework").Action;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createContact = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.createContact = (0, pieces_framework_1.createAction)({
|
|
9
|
+
description: 'Creates a new contact in Mautic CRM',
|
|
10
|
+
displayName: 'Create Contact',
|
|
11
|
+
name: 'create_mautic_contact',
|
|
12
|
+
sampleData: {
|
|
13
|
+
"firstname": "firstname",
|
|
14
|
+
"lastname": "lastname",
|
|
15
|
+
"email": "email@email.com",
|
|
16
|
+
"tags": "danger",
|
|
17
|
+
"company": "company",
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
authentication: common_1.mauticCommon.authentication,
|
|
21
|
+
firstname: common_1.mauticCommon.firstname,
|
|
22
|
+
lastname: common_1.mauticCommon.lastname,
|
|
23
|
+
email: common_1.mauticCommon.email,
|
|
24
|
+
tags: common_1.mauticCommon.tags,
|
|
25
|
+
company: common_1.mauticCommon.company,
|
|
26
|
+
},
|
|
27
|
+
run: function (context) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const { authentication, firstname, lastname, email, tags, company, } = context.propsValue;
|
|
30
|
+
const { base_url: BASE_URL, username, password } = authentication;
|
|
31
|
+
const accessToken = Buffer.from(`${username}:${password}`).toString('base64');
|
|
32
|
+
const body = JSON.stringify({
|
|
33
|
+
firstname,
|
|
34
|
+
lastname,
|
|
35
|
+
email,
|
|
36
|
+
tags,
|
|
37
|
+
company,
|
|
38
|
+
});
|
|
39
|
+
const headers = {
|
|
40
|
+
'Authorization': 'Basic ' + accessToken,
|
|
41
|
+
'Content-Type': 'application/json'
|
|
42
|
+
};
|
|
43
|
+
const request = {
|
|
44
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
45
|
+
url: (BASE_URL.endsWith('/') ? BASE_URL : BASE_URL + '/') + 'api/contacts/new',
|
|
46
|
+
body,
|
|
47
|
+
headers
|
|
48
|
+
};
|
|
49
|
+
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=create-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/mautic/src/lib/actions/create-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAKqC;AACrC,sCAAyC;AAE5B,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,WAAW,EAAE,qCAAqC;IAClD,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,UAAU,EAAE;QACR,WAAW,EAAE,WAAW;QACxB,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,SAAS;KACvB;IACD,KAAK,EAAE;QACH,cAAc,EAAE,qBAAY,CAAC,cAAc;QAC3C,SAAS,EAAE,qBAAY,CAAC,SAAS;QACjC,QAAQ,EAAE,qBAAY,CAAC,QAAQ;QAC/B,KAAK,EAAE,qBAAY,CAAC,KAAK;QACzB,IAAI,EAAE,qBAAY,CAAC,IAAI;QACvB,OAAO,EAAE,qBAAY,CAAC,OAAO;KAChC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAExB,MAAM,EACF,cAAc,EACd,SAAS,EACT,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,OAAO,GACV,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;YAElE,MAAM,WAAW,GAAW,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAEtF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;gBACxB,SAAS;gBACT,QAAQ;gBACR,KAAK;gBACL,IAAI;gBACJ,OAAO;aACV,CAAC,CAAC;YACH,MAAM,OAAO,GAAgB;gBACzB,eAAe,EAAE,QAAQ,GAAG,WAAW;gBACvC,cAAc,EAAE,kBAAkB;aACrC,CAAA;YACD,MAAM,OAAO,GAAgB;gBACzB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,kBAAkB;gBAC9E,IAAI;gBACJ,OAAO;aACV,CAAA;YACD,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const mauticCommon: {
|
|
2
|
+
authentication: import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
3
|
+
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
password: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
firstname: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
lastname: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
11
|
+
company: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mauticCommon = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const markdownDescription = `
|
|
6
|
+
Follow these steps:
|
|
7
|
+
|
|
8
|
+
1. **Enter the Base URL:** Open your Mautic instance and copy the URL from the address bar. If your dashboard link is "https://mautic.ddev.site/s/dashboard", set your base URL as "https://mautic.ddev.site/".
|
|
9
|
+
|
|
10
|
+
2. **Enable Basic Authentication:** Log in to Mautic, go to **Settings** > **Configuration** > **API Settings**, and ensure that Basic Authentication is enabled.
|
|
11
|
+
|
|
12
|
+
`;
|
|
13
|
+
exports.mauticCommon = {
|
|
14
|
+
authentication: pieces_framework_1.Property.CustomAuth({
|
|
15
|
+
displayName: "Authentication",
|
|
16
|
+
description: markdownDescription,
|
|
17
|
+
props: {
|
|
18
|
+
base_url: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Base URL',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
username: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Username',
|
|
24
|
+
required: true
|
|
25
|
+
}),
|
|
26
|
+
password: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Password',
|
|
28
|
+
required: true
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
required: true
|
|
32
|
+
}),
|
|
33
|
+
firstname: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'First Name',
|
|
35
|
+
description: 'First name of the contact',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
lastname: pieces_framework_1.Property.ShortText({
|
|
39
|
+
displayName: 'Last Name',
|
|
40
|
+
description: 'Last name of the contact',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
email: pieces_framework_1.Property.ShortText({
|
|
44
|
+
displayName: 'Email',
|
|
45
|
+
description: 'Email of the contact',
|
|
46
|
+
required: false,
|
|
47
|
+
}),
|
|
48
|
+
tags: pieces_framework_1.Property.Array({
|
|
49
|
+
displayName: 'Tags',
|
|
50
|
+
description: 'Tags of the contact',
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
53
|
+
company: pieces_framework_1.Property.ShortText({
|
|
54
|
+
displayName: 'Primary company',
|
|
55
|
+
description: 'Primary company of the contact',
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/mautic/src/lib/common/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwD;AAExD,MAAM,mBAAmB,GAAG;;;;;;;CAO3B,CAAC;AAEW,QAAA,YAAY,GAAE;IACvB,cAAc,EAAE,2BAAQ,CAAC,UAAU,CAAC;QAChC,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,mBAAmB;QAChC,KAAK,EAAE;YACH,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;gBACzB,WAAW,EAAE,UAAU;gBACvB,QAAQ,EAAE,IAAI;aACjB,CAAC;YACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;gBACzB,WAAW,EAAE,UAAU;gBACvB,QAAQ,EAAE,IAAI;aACjB,CAAC;YACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;gBACzB,WAAW,EAAE,UAAU;gBACvB,QAAQ,EAAE,IAAI;aACjB,CAAC;SACL;QACD,QAAQ,EAAE,IAAI;KACjB,CAAC;IACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;QAC1B,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,2BAA2B;QACxC,QAAQ,EAAE,KAAK;KAClB,CAAC;IACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;QACzB,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,KAAK;KAClB,CAAC;IACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;QACtB,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,sBAAsB;QACnC,QAAQ,EAAE,KAAK;KAClB,CAAC;IACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;QACjB,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,qBAAqB;QAClC,QAAQ,EAAE,KAAK;KAClB,CAAC;IACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;QACxB,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,gCAAgC;QAC7C,QAAQ,EAAE,KAAK;KAClB,CAAC;CACL,CAAC"}
|