@activepieces/piece-sendinblue 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 +7 -0
- package/package.json +14 -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-or-update-contact.d.ts +1 -0
- package/src/lib/actions/create-or-update-contact.js +124 -0
- package/src/lib/actions/create-or-update-contact.js.map +1 -0
- package/src/lib/common/props.d.ts +3 -0
- package/src/lib/common/props.js +12 -0
- package/src/lib/common/props.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-sendinblue",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "0.26.3",
|
|
6
|
+
"axios": "1.2.4",
|
|
7
|
+
"nanoid": "3.3.4",
|
|
8
|
+
"@activepieces/framework": "0.3.2",
|
|
9
|
+
"@activepieces/shared": "0.3.1",
|
|
10
|
+
"tslib": "2.4.1"
|
|
11
|
+
},
|
|
12
|
+
"main": "./src/index.js",
|
|
13
|
+
"types": "./src/index.d.ts"
|
|
14
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sendinblue: import("@activepieces/framework").Piece;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendinblue = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
7
|
+
const create_or_update_contact_1 = require("./lib/actions/create-or-update-contact");
|
|
8
|
+
exports.sendinblue = (0, framework_1.createPiece)({
|
|
9
|
+
name: "sendinblue",
|
|
10
|
+
displayName: "Sendinblue",
|
|
11
|
+
logoUrl: "https://cdn.activepieces.com/pieces/sendinblue.png",
|
|
12
|
+
version: package_json_1.default.version,
|
|
13
|
+
authors: ['kanarelo'],
|
|
14
|
+
actions: [create_or_update_contact_1.createOrUpdateContact],
|
|
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/sendinblue/src/index.ts"],"names":[],"mappings":";;;;AACA,uDAAsD;AACtD,2EAA0C;AAC1C,qFAA+E;AAElE,QAAA,UAAU,GAAG,IAAA,uBAAW,EAAC;IACpC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE,CAAC,gDAAqB,CAAC;IAChC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createOrUpdateContact: import("@activepieces/framework").Action;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOrUpdateContact = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const props_1 = require("../common/props");
|
|
7
|
+
exports.createOrUpdateContact = (0, framework_1.createAction)({
|
|
8
|
+
name: 'create_or_update_contact',
|
|
9
|
+
displayName: 'Create or Update Contact',
|
|
10
|
+
description: 'Create or update an existing contact',
|
|
11
|
+
sampleData: {
|
|
12
|
+
"id": 42,
|
|
13
|
+
"email": "peggy.rain@example.com",
|
|
14
|
+
"emailBlacklisted": false,
|
|
15
|
+
"smsBlacklisted": false,
|
|
16
|
+
"createdAt": "2017-05-02T16:40:31Z",
|
|
17
|
+
"modifiedAt": "2017-05-02T16:40:31Z",
|
|
18
|
+
"attributes": {
|
|
19
|
+
"FIRST_NAME": "Peggy",
|
|
20
|
+
"LAST_NAME": "Rain",
|
|
21
|
+
"SMS": "3087433387669",
|
|
22
|
+
"CIV": "1",
|
|
23
|
+
"DOB": "1986-04-13",
|
|
24
|
+
"ADDRESS": "987 5th avenue",
|
|
25
|
+
"ZIP_CODE": "87544",
|
|
26
|
+
"CITY": "New-York",
|
|
27
|
+
"AREA": "NY"
|
|
28
|
+
},
|
|
29
|
+
"listIds": [
|
|
30
|
+
40
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
api_key: props_1.sendInBluePropsContactsProps.api_key,
|
|
35
|
+
email: framework_1.Property.ShortText({
|
|
36
|
+
displayName: "Email",
|
|
37
|
+
description: `Email address of the user. Mandatory if "SMS" field is not passed in "attributes" parameter. Mobile Number in SMS field should be passed with proper country code. For example: {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}`,
|
|
38
|
+
required: true
|
|
39
|
+
}),
|
|
40
|
+
ext_id: framework_1.Property.ShortText({
|
|
41
|
+
displayName: "External ID",
|
|
42
|
+
description: `Pass your own Id to create a contact.`,
|
|
43
|
+
required: false
|
|
44
|
+
}),
|
|
45
|
+
attributes: framework_1.Property.Object({
|
|
46
|
+
displayName: "Attributes",
|
|
47
|
+
description: `Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. These attributes must be present in your SendinBlue account. For eg:
|
|
48
|
+
{"FNAME":"Elly", "LNAME":"Roger"}`,
|
|
49
|
+
required: false,
|
|
50
|
+
defaultValue: {
|
|
51
|
+
"FIRST_NAME": "",
|
|
52
|
+
"LAST_NAME": "",
|
|
53
|
+
"SMS": "",
|
|
54
|
+
"CIV": "",
|
|
55
|
+
"DOB": "",
|
|
56
|
+
"ADDRESS": "",
|
|
57
|
+
"ZIP_CODE": "",
|
|
58
|
+
"CITY": "",
|
|
59
|
+
"AREA": ""
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
email_blacklisted: framework_1.Property.Checkbox({
|
|
63
|
+
displayName: "Email Blacklisted?",
|
|
64
|
+
description: `Set this field to blacklist the contact for emails (emailBlacklisted = true)`,
|
|
65
|
+
required: false,
|
|
66
|
+
defaultValue: false
|
|
67
|
+
}),
|
|
68
|
+
sms_blacklisted: framework_1.Property.Checkbox({
|
|
69
|
+
displayName: "SMS Blacklisted?",
|
|
70
|
+
description: `Set this field to blacklist the contact for SMS (smsBlacklisted = true)`,
|
|
71
|
+
required: false,
|
|
72
|
+
defaultValue: false
|
|
73
|
+
}),
|
|
74
|
+
list_ids: framework_1.Property.Array({
|
|
75
|
+
displayName: "List IDs",
|
|
76
|
+
description: `Ids of the lists to add the contact to.`,
|
|
77
|
+
required: false,
|
|
78
|
+
defaultValue: []
|
|
79
|
+
}),
|
|
80
|
+
smtp_blacklist_sender: framework_1.Property.Checkbox({
|
|
81
|
+
displayName: "SMTP Blacklist Sender",
|
|
82
|
+
description: `transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )`,
|
|
83
|
+
required: false,
|
|
84
|
+
defaultValue: false
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
run(context) {
|
|
88
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const contact = {
|
|
90
|
+
email: context.propsValue.email,
|
|
91
|
+
ext_id: context.propsValue.ext_id,
|
|
92
|
+
attributes: context.propsValue.attributes,
|
|
93
|
+
emailBlacklisted: context.propsValue.email_blacklisted,
|
|
94
|
+
smsBlacklisted: context.propsValue.sms_blacklisted,
|
|
95
|
+
listIds: context.propsValue.list_ids,
|
|
96
|
+
unlinkListIds: context.propsValue.list_ids,
|
|
97
|
+
smtpBlacklistSender: context.propsValue.smtp_blacklist_sender,
|
|
98
|
+
updateEnabled: true
|
|
99
|
+
};
|
|
100
|
+
const identifier = context.propsValue.email;
|
|
101
|
+
// filter out undefined values
|
|
102
|
+
const body = Object.fromEntries(Object.entries(contact).filter(([_, value]) => Boolean(value)));
|
|
103
|
+
console.log("Contact update request " + identifier);
|
|
104
|
+
const updateResponse = yield framework_1.httpClient.sendRequest({
|
|
105
|
+
method: framework_1.HttpMethod.POST,
|
|
106
|
+
url: `https://api.sendinblue.com/v3/contacts`,
|
|
107
|
+
body,
|
|
108
|
+
headers: {
|
|
109
|
+
'api-key': context.propsValue.api_key
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
console.debug("Contact update response", updateResponse);
|
|
113
|
+
const contactREsponse = yield framework_1.httpClient.sendRequest({
|
|
114
|
+
method: framework_1.HttpMethod.GET,
|
|
115
|
+
url: `https://api.sendinblue.com/v3/contacts/${encodeURI(identifier)}`,
|
|
116
|
+
headers: {
|
|
117
|
+
'api-key': context.propsValue.api_key
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return contactREsponse.body;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=create-or-update-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/sendinblue/src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":";;;;AAAA,uDAAyF;AACzF,2CAA+D;AAElD,QAAA,qBAAqB,GAAG,IAAA,wBAAY,EAAC;IAChD,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,sCAAsC;IACnD,UAAU,EAAE;QACV,IAAI,EACF,EAAE;QACJ,OAAO,EAAE,wBAAwB;QACjC,kBAAkB,EAAE,KAAK;QACzB,gBAAgB,EAAE,KAAK;QACvB,WAAW,EAAE,sBAAsB;QACnC,YAAY,EAAE,sBAAsB;QACpC,YAAY,EAAE;YACZ,YAAY,EAAE,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D,MAAM,EAAE,sBAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,wCAAwC;gBAC7C,IAAI;gBACJ,OAAO,EAAE;oBACP,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;iBACtC;aACF,CAAC,CAAA;YACF,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,cAAc,CAAC,CAAC;YAEzD,MAAM,eAAe,GAAG,MAAM,sBAAU,CAAC,WAAW,CAAC;gBACnD,MAAM,EAAE,sBAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,0CAA0C,SAAS,CAAC,UAAU,CAAC,EAAE;gBACtE,OAAO,EAAE;oBACP,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;iBACtC;aACF,CAAC,CAAA;YACF,OAAO,eAAe,CAAC,IAAI,CAAC;QAC9B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendInBluePropsContactsProps = void 0;
|
|
4
|
+
const framework_1 = require("@activepieces/framework");
|
|
5
|
+
exports.sendInBluePropsContactsProps = {
|
|
6
|
+
api_key: framework_1.Property.SecretText({
|
|
7
|
+
displayName: "Project API key",
|
|
8
|
+
description: "Your project API key",
|
|
9
|
+
required: true
|
|
10
|
+
})
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/sendinblue/src/lib/common/props.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAEtC,QAAA,4BAA4B,GAAG;IAC1C,OAAO,EAAE,oBAAQ,CAAC,UAAU,CAAC;QAC3B,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,sBAAsB;QACnC,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAA"}
|