@activepieces/piece-sendinblue 0.1.1 → 0.1.3
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/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-sendinblue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@sinclair/typebox": "
|
|
6
|
-
"axios": "1.
|
|
7
|
-
"dayjs": "
|
|
8
|
-
"is-base64": "
|
|
9
|
-
"
|
|
5
|
+
"@sinclair/typebox": "0.26.8",
|
|
6
|
+
"axios": "^1.6.3",
|
|
7
|
+
"dayjs": "1.11.9",
|
|
8
|
+
"is-base64": "1.1.0",
|
|
9
|
+
"lodash": "4.17.21",
|
|
10
|
+
"nanoid": "3.3.6",
|
|
10
11
|
"semver": "7.5.4",
|
|
11
|
-
"@activepieces/pieces-common": "0.2.
|
|
12
|
-
"@activepieces/pieces-framework": "0.
|
|
13
|
-
"@activepieces/shared": "0.
|
|
14
|
-
"tslib": "2.6.
|
|
12
|
+
"@activepieces/pieces-common": "0.2.8",
|
|
13
|
+
"@activepieces/pieces-framework": "0.7.14",
|
|
14
|
+
"@activepieces/shared": "0.10.66",
|
|
15
|
+
"tslib": "2.6.2"
|
|
15
16
|
},
|
|
16
17
|
"main": "./src/index.js",
|
|
17
|
-
"
|
|
18
|
+
"type": "commonjs"
|
|
18
19
|
}
|
package/src/index.js
CHANGED
|
@@ -3,19 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sendinblue = exports.sendinblueAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const create_or_update_contact_1 = require("./lib/actions/create-or-update-contact");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
7
|
exports.sendinblueAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
7
|
-
displayName:
|
|
8
|
-
description:
|
|
9
|
-
required: true
|
|
8
|
+
displayName: 'Project API key',
|
|
9
|
+
description: 'Your project API key',
|
|
10
|
+
required: true,
|
|
10
11
|
});
|
|
11
12
|
exports.sendinblue = (0, pieces_framework_1.createPiece)({
|
|
12
|
-
displayName:
|
|
13
|
-
description:
|
|
13
|
+
displayName: 'Brevo',
|
|
14
|
+
description: 'sendinblue',
|
|
14
15
|
minimumSupportedRelease: '0.5.0',
|
|
15
|
-
logoUrl:
|
|
16
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/brevo.png',
|
|
16
17
|
authors: ['kanarelo'],
|
|
17
18
|
auth: exports.sendinblueAuth,
|
|
18
|
-
actions: [
|
|
19
|
+
actions: [
|
|
20
|
+
create_or_update_contact_1.createOrUpdateContact,
|
|
21
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
22
|
+
baseUrl: () => 'https://api.sendinblue.com/v3',
|
|
23
|
+
auth: exports.sendinblueAuth,
|
|
24
|
+
authMapping: (auth) => ({
|
|
25
|
+
'api-key': auth,
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
19
29
|
triggers: [],
|
|
20
30
|
});
|
|
21
31
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/sendinblue/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,qFAA+E;AAC/E,+DAAwE;AAE3D,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,YAAY;IACzB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,IAAI,EAAE,sBAAc;IACpB,OAAO,EAAE;QACP,gDAAqB;QACrB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,+BAA+B;YAC9C,IAAI,EAAE,sBAAc;YACpB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACtB,SAAS,EAAE,IAAc;aAC1B,CAAC;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -12,92 +12,97 @@ exports.createOrUpdateContact = (0, pieces_framework_1.createAction)({
|
|
|
12
12
|
description: 'Create or update an existing contact',
|
|
13
13
|
props: {
|
|
14
14
|
email: pieces_framework_1.Property.ShortText({
|
|
15
|
-
displayName:
|
|
15
|
+
displayName: 'Email',
|
|
16
16
|
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"}`,
|
|
17
|
-
required: true
|
|
17
|
+
required: true,
|
|
18
18
|
}),
|
|
19
19
|
ext_id: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName:
|
|
20
|
+
displayName: 'External ID',
|
|
21
21
|
description: `Pass your own Id to create a contact.`,
|
|
22
|
-
required: false
|
|
22
|
+
required: false,
|
|
23
23
|
}),
|
|
24
24
|
attributes: pieces_framework_1.Property.Object({
|
|
25
|
-
displayName:
|
|
25
|
+
displayName: 'Attributes',
|
|
26
26
|
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:
|
|
27
|
-
|
|
27
|
+
{"FNAME":"Elly", "LNAME":"Roger"}`,
|
|
28
28
|
required: false,
|
|
29
29
|
defaultValue: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
30
|
+
FIRST_NAME: '',
|
|
31
|
+
LAST_NAME: '',
|
|
32
|
+
SMS: '',
|
|
33
|
+
CIV: '',
|
|
34
|
+
DOB: '',
|
|
35
|
+
ADDRESS: '',
|
|
36
|
+
ZIP_CODE: '',
|
|
37
|
+
CITY: '',
|
|
38
|
+
AREA: '',
|
|
39
|
+
},
|
|
40
40
|
}),
|
|
41
41
|
email_blacklisted: pieces_framework_1.Property.Checkbox({
|
|
42
|
-
displayName:
|
|
42
|
+
displayName: 'Email Blacklisted?',
|
|
43
43
|
description: `Set this field to blacklist the contact for emails (emailBlacklisted = true)`,
|
|
44
44
|
required: false,
|
|
45
|
-
defaultValue: false
|
|
45
|
+
defaultValue: false,
|
|
46
46
|
}),
|
|
47
47
|
sms_blacklisted: pieces_framework_1.Property.Checkbox({
|
|
48
|
-
displayName:
|
|
48
|
+
displayName: 'SMS Blacklisted?',
|
|
49
49
|
description: `Set this field to blacklist the contact for SMS (smsBlacklisted = true)`,
|
|
50
50
|
required: false,
|
|
51
|
-
defaultValue: false
|
|
51
|
+
defaultValue: false,
|
|
52
52
|
}),
|
|
53
53
|
list_ids: pieces_framework_1.Property.Array({
|
|
54
|
-
displayName:
|
|
54
|
+
displayName: 'List IDs',
|
|
55
55
|
description: `Ids of the lists to add the contact to.`,
|
|
56
56
|
required: false,
|
|
57
|
-
defaultValue: []
|
|
57
|
+
defaultValue: [],
|
|
58
58
|
}),
|
|
59
59
|
smtp_blacklist_sender: pieces_framework_1.Property.Checkbox({
|
|
60
|
-
displayName:
|
|
60
|
+
displayName: 'SMTP Blacklist Sender',
|
|
61
61
|
description: `transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )`,
|
|
62
62
|
required: false,
|
|
63
|
-
defaultValue: false
|
|
64
|
-
})
|
|
63
|
+
defaultValue: false,
|
|
64
|
+
}),
|
|
65
65
|
},
|
|
66
66
|
run(context) {
|
|
67
67
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
let listIds = [];
|
|
69
|
+
if (context.propsValue.list_ids) {
|
|
70
|
+
listIds = context.propsValue.list_ids.map((listId) => {
|
|
71
|
+
return parseInt(listId);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
68
74
|
const contact = {
|
|
69
75
|
email: context.propsValue.email,
|
|
70
76
|
ext_id: context.propsValue.ext_id,
|
|
71
77
|
attributes: context.propsValue.attributes,
|
|
72
78
|
emailBlacklisted: context.propsValue.email_blacklisted,
|
|
73
79
|
smsBlacklisted: context.propsValue.sms_blacklisted,
|
|
74
|
-
listIds:
|
|
75
|
-
unlinkListIds: context.propsValue.list_ids,
|
|
80
|
+
listIds: listIds,
|
|
76
81
|
smtpBlacklistSender: context.propsValue.smtp_blacklist_sender,
|
|
77
|
-
updateEnabled: true
|
|
82
|
+
updateEnabled: true,
|
|
78
83
|
};
|
|
79
84
|
const identifier = context.propsValue.email;
|
|
80
85
|
// filter out undefined values
|
|
81
86
|
const body = Object.fromEntries(Object.entries(contact).filter(([_, value]) => Boolean(value)));
|
|
82
|
-
console.log(
|
|
87
|
+
console.log('Contact update request ' + identifier);
|
|
83
88
|
const updateResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
84
89
|
method: pieces_common_1.HttpMethod.POST,
|
|
85
90
|
url: `https://api.sendinblue.com/v3/contacts`,
|
|
86
91
|
body,
|
|
87
92
|
headers: {
|
|
88
|
-
'api-key': context.auth
|
|
89
|
-
}
|
|
93
|
+
'api-key': context.auth,
|
|
94
|
+
},
|
|
90
95
|
});
|
|
91
|
-
console.debug(
|
|
96
|
+
console.debug('Contact update response', updateResponse);
|
|
92
97
|
const contactREsponse = yield pieces_common_1.httpClient.sendRequest({
|
|
93
98
|
method: pieces_common_1.HttpMethod.GET,
|
|
94
99
|
url: `https://api.sendinblue.com/v3/contacts/${encodeURI(identifier)}`,
|
|
95
100
|
headers: {
|
|
96
|
-
'api-key': context.auth
|
|
97
|
-
}
|
|
101
|
+
'api-key': context.auth,
|
|
102
|
+
},
|
|
98
103
|
});
|
|
99
104
|
return contactREsponse.body;
|
|
100
105
|
});
|
|
101
|
-
}
|
|
106
|
+
},
|
|
102
107
|
});
|
|
103
108
|
//# sourceMappingURL=create-or-update-contact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/sendinblue/src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAuC;AAE1B,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,qOAAqO;YAClP,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE;0CACuB;YACpC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE;gBACZ,UAAU,EAAE,EAAE;gBACd,SAAS,EAAE,EAAE;gBACb,GAAG,EAAE,EAAE;gBACP,GAAG,EAAE,EAAE;gBACP,GAAG,EAAE,EAAE;gBACP,OAAO,EAAE,EAAE;gBACX,QAAQ,E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