@scopieflows/app-salesforce-marketing-cloud 0.1.3 → 0.1.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@scopieflows/app-salesforce-marketing-cloud",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -7,7 +7,12 @@ const shared_1 = require("@scopieflows/shared");
7
7
  const pieces_common_1 = require("@scopieflows/pieces-common");
8
8
  const upsert_data_extension_row_1 = require("./lib/actions/upsert-data-extension-row");
9
9
  const get_data_extension_rows_1 = require("./lib/actions/get-data-extension-rows");
10
+ const delete_data_extension_row_1 = require("./lib/actions/delete-data-extension-row");
10
11
  const trigger_journey_event_1 = require("./lib/actions/trigger-journey-event");
12
+ const get_journey_status_1 = require("./lib/actions/get-journey-status");
13
+ const send_triggered_email_1 = require("./lib/actions/send-triggered-email");
14
+ const send_sms_message_1 = require("./lib/actions/send-sms-message");
15
+ const create_update_contact_1 = require("./lib/actions/create-update-contact");
11
16
  exports.sfmcAuth = pieces_framework_1.PieceAuth.OAuth2({
12
17
  description: `Connect your Salesforce Marketing Cloud account.
13
18
 
@@ -76,7 +81,12 @@ exports.salesforceMarketingCloud = (0, pieces_framework_1.createPiece)({
76
81
  actions: [
77
82
  upsert_data_extension_row_1.upsertDataExtensionRow,
78
83
  get_data_extension_rows_1.getDataExtensionRows,
84
+ delete_data_extension_row_1.deleteDataExtensionRow,
79
85
  trigger_journey_event_1.triggerJourneyEvent,
86
+ get_journey_status_1.getJourneyStatus,
87
+ send_triggered_email_1.sendTriggeredEmail,
88
+ send_sms_message_1.sendSmsMessage,
89
+ create_update_contact_1.createUpdateContact,
80
90
  (0, pieces_common_1.createCustomApiCallAction)({
81
91
  baseUrl: (auth) => {
82
92
  var _a;
package/src/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,EAAE,CAAC;YACP,CAAC;YACD,IAAI,EAAE,gBAAQ;YACd,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,QAAQ,EAAE,EAAE;CACZ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const createUpdateContact: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ contactKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ emailAddress: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
4
+ attributeValues: import("@scopieflows/pieces-framework").ObjectProperty<false>;
5
+ }>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUpdateContact = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../../");
8
+ const common_1 = require("../common");
9
+ exports.createUpdateContact = (0, pieces_framework_1.createAction)({
10
+ auth: __1.sfmcAuth,
11
+ name: 'create_update_contact',
12
+ displayName: 'Create or Update Contact',
13
+ description: 'Creates a new contact or updates an existing one in Salesforce Marketing Cloud.',
14
+ props: {
15
+ contactKey: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Contact Key',
17
+ description: 'The unique identifier for the contact (usually Subscriber Key).',
18
+ required: true,
19
+ }),
20
+ emailAddress: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Email Address',
22
+ description: 'The contact email address.',
23
+ required: false,
24
+ }),
25
+ attributeValues: pieces_framework_1.Property.Object({
26
+ displayName: 'Attribute Values',
27
+ description: 'Key-value pairs of contact attributes to set (e.g. {"FirstName": "John", "LastName": "Doe"}).',
28
+ required: false,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { contactKey, emailAddress, attributeValues } = context.propsValue;
34
+ const auth = context.auth;
35
+ const contactPayload = {
36
+ contactKey,
37
+ };
38
+ if (emailAddress) {
39
+ contactPayload['channels'] = [
40
+ {
41
+ channelType: 'email',
42
+ address: emailAddress,
43
+ },
44
+ ];
45
+ }
46
+ if (attributeValues && Object.keys(attributeValues).length > 0) {
47
+ contactPayload['attributeSets'] = [
48
+ {
49
+ name: 'Email Addresses',
50
+ items: [
51
+ {
52
+ values: Object.entries(attributeValues).map(([key, value]) => ({
53
+ name: key,
54
+ value,
55
+ })),
56
+ },
57
+ ],
58
+ },
59
+ ];
60
+ }
61
+ const response = yield (0, common_1.sfmcApiCall)({
62
+ auth,
63
+ method: pieces_common_1.HttpMethod.POST,
64
+ path: '/contacts/v1/contacts',
65
+ body: contactPayload,
66
+ });
67
+ return response.body;
68
+ });
69
+ },
70
+ });
71
+ //# sourceMappingURL=create-update-contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-update-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-update-contact.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAwD;AACxD,8BAAkC;AAClC,sCAAwC;AAG3B,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EACV,iFAAiF;IAClF,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EACV,iEAAiE;YAClE,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAC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ows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ externalKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ primaryKeys: import("@scopieflows/pieces-framework").ObjectProperty<true>;
4
+ }>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteDataExtensionRow = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../../");
8
+ const common_1 = require("../common");
9
+ exports.deleteDataExtensionRow = (0, pieces_framework_1.createAction)({
10
+ auth: __1.sfmcAuth,
11
+ name: 'delete_data_extension_row',
12
+ displayName: 'Delete Data Extension Row',
13
+ description: 'Deletes a row from a Data Extension by its primary key values.',
14
+ props: {
15
+ externalKey: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Data Extension External Key',
17
+ description: 'The external key of the Data Extension. Find it in SFMC under Email Studio > Subscribers > Data Extensions — click the Data Extension and copy the "External Key" value.',
18
+ required: true,
19
+ }),
20
+ primaryKeys: pieces_framework_1.Property.Object({
21
+ displayName: 'Primary Key Values',
22
+ description: 'Key-value pairs of the primary key columns that identify the row to delete (e.g. {"EmailAddress": "john@example.com"}).',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { externalKey, primaryKeys } = context.propsValue;
29
+ const auth = context.auth;
30
+ const keys = Object.entries(primaryKeys).map(([key, value]) => ({
31
+ Key: key,
32
+ Value: value,
33
+ }));
34
+ const response = yield (0, common_1.sfmcApiCall)({
35
+ auth,
36
+ method: pieces_common_1.HttpMethod.DELETE,
37
+ path: `/hub/v1/dataevents/key:${externalKey}/rows`,
38
+ body: {
39
+ keys,
40
+ },
41
+ });
42
+ return response.body;
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=delete-data-extension-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-data-extension-row.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-data-extension-row.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAwD;AACxD,8BAAkC;AAClC,sCAAwC;AAG3B,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EACV,gEAAgE;IACjE,KAAK,EAAE;QACN,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,6BAA6B;YAC1C,WAAW,EACV,0KAA0K;YAC3K,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EACV,yHAAyH;YAC1H,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,IAAI,GAAG,OAAO,CAAC,IAA2B,CAAC;YAEjD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC/D,GAAG,EAAE,GAAG;gBACR,KAAK,EAAE,KAAK;aACZ,CAAC,CAAC,CAAC;YAEJ,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAA0B;gBAC3D,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,IAAI,EAAE,0BAA0B,WAAW,OAAO;gBAClD,IAAI,EAAE;oBACL,IAAI;iBACJ;aACD,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACtB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const getJourneyStatus: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ journeyId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ versionNumber: import("@scopieflows/pieces-framework").NumberProperty<false>;
4
+ }>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJourneyStatus = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../../");
8
+ const common_1 = require("../common");
9
+ exports.getJourneyStatus = (0, pieces_framework_1.createAction)({
10
+ auth: __1.sfmcAuth,
11
+ name: 'get_journey_status',
12
+ displayName: 'Get Journey Status',
13
+ description: 'Retrieves the status and details of a Journey Builder journey.',
14
+ props: {
15
+ journeyId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Journey ID',
17
+ description: 'The unique ID of the journey. Find it in Journey Builder by opening the journey — the ID is in the URL or in the journey details.',
18
+ required: true,
19
+ }),
20
+ versionNumber: pieces_framework_1.Property.Number({
21
+ displayName: 'Version Number',
22
+ description: 'The journey version number to check. Defaults to 1 if not specified.',
23
+ required: false,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { journeyId, versionNumber } = context.propsValue;
29
+ const auth = context.auth;
30
+ const version = versionNumber !== null && versionNumber !== void 0 ? versionNumber : 1;
31
+ const response = yield (0, common_1.sfmcApiCall)({
32
+ auth,
33
+ method: pieces_common_1.HttpMethod.GET,
34
+ path: `/interaction/v1/interactions/${journeyId}`,
35
+ queryParams: {
36
+ versionNumber: String(version),
37
+ },
38
+ });
39
+ return response.body;
40
+ });
41
+ },
42
+ });
43
+ //# sourceMappingURL=get-journey-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-journey-status.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-journey-status.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAwD;AACxD,8BAAkC;AAClC,sCAAwC;AAG3B,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACV,gEAAgE;IACjE,KAAK,EAAE;QACN,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EACV,mIAAmI;YACpI,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC9B,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACV,sEAAsE;YACvE,QAAQ,EAAE,KAAK;SACf,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,IAAI,GAAG,OAAO,CAAC,IAA2B,CAAC;YAEjD,MAAM,OAAO,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,CAAC,CAAC;YAEnC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAA0B;gBAC3D,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,gCAAgC,SAAS,EAAE;gBACjD,WAAW,EAAE;oBACZ,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC;iBAC9B;aACD,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACtB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const sendSmsMessage: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ definitionKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ subscriberKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ mobileNumber: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ subscriptionName: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
6
+ messageText: import("@scopieflows/pieces-framework").LongTextProperty<false>;
7
+ }>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSmsMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../../");
8
+ const common_1 = require("../common");
9
+ exports.sendSmsMessage = (0, pieces_framework_1.createAction)({
10
+ auth: __1.sfmcAuth,
11
+ name: 'send_sms_message',
12
+ displayName: 'Send SMS Message',
13
+ description: 'Sends a transactional SMS message to a mobile number using a triggered send definition.',
14
+ props: {
15
+ definitionKey: pieces_framework_1.Property.ShortText({
16
+ displayName: 'API Event Definition Key',
17
+ description: 'The key of the transactional SMS send definition. Find it in SFMC under MobileConnect or Journey Builder.',
18
+ required: true,
19
+ }),
20
+ subscriberKey: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Subscriber Key',
22
+ description: 'The unique identifier for the subscriber receiving the SMS.',
23
+ required: true,
24
+ }),
25
+ mobileNumber: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Mobile Number',
27
+ description: 'The recipient mobile number in international format (e.g. "+15551234567").',
28
+ required: true,
29
+ }),
30
+ subscriptionName: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Keyword',
32
+ description: 'The keyword associated with the SMS short/long code.',
33
+ required: false,
34
+ }),
35
+ messageText: pieces_framework_1.Property.LongText({
36
+ displayName: 'Message Text (Override)',
37
+ description: 'Optional override for the SMS message content. If left empty, the template from the definition is used.',
38
+ required: false,
39
+ }),
40
+ },
41
+ run(context) {
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ const { definitionKey, subscriberKey, mobileNumber, subscriptionName, messageText } = context.propsValue;
44
+ const auth = context.auth;
45
+ const recipient = {
46
+ subscriberKey,
47
+ to: mobileNumber,
48
+ };
49
+ if (subscriptionName) {
50
+ recipient['attributes'] = { subscriptionName };
51
+ }
52
+ const body = {
53
+ definitionKey,
54
+ recipients: [recipient],
55
+ };
56
+ if (messageText) {
57
+ body['subscriptions'] = {
58
+ shortCode: subscriptionName !== null && subscriptionName !== void 0 ? subscriptionName : '',
59
+ };
60
+ body['content'] = {
61
+ message: messageText,
62
+ };
63
+ }
64
+ const response = yield (0, common_1.sfmcApiCall)({
65
+ auth,
66
+ method: pieces_common_1.HttpMethod.POST,
67
+ path: '/messaging/v1/sms/messages',
68
+ body,
69
+ });
70
+ return response.body;
71
+ });
72
+ },
73
+ });
74
+ //# sourceMappingURL=send-sms-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-sms-message.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-sms-message.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAwD;AACxD,8BAAkC;AAClC,sCAAwC;AAG3B,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACV,yFAAyF;IAC1F,KAAK,EAAE;QACN,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,0BAA0B;YACvC,WAAW,EACV,2GAA2G;YAC5G,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACV,6DAA6D;YAC9D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,YAAY,EA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AC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACtB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const sendTriggeredEmail: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ triggeredSendKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ subscriberKey: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ emailAddress: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ attributes: import("@scopieflows/pieces-framework").ObjectProperty<false>;
6
+ }>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendTriggeredEmail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../../");
8
+ const common_1 = require("../common");
9
+ exports.sendTriggeredEmail = (0, pieces_framework_1.createAction)({
10
+ auth: __1.sfmcAuth,
11
+ name: 'send_triggered_email',
12
+ displayName: 'Send Triggered Email',
13
+ description: 'Sends a triggered email to one or more subscribers using a triggered send definition.',
14
+ props: {
15
+ triggeredSendKey: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Triggered Send Key',
17
+ description: 'The external key of the triggered send definition. Find it in SFMC under Email Studio > Interactions > Triggered Sends.',
18
+ required: true,
19
+ }),
20
+ subscriberKey: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Subscriber Key',
22
+ description: 'The unique identifier for the subscriber (usually Subscriber Key or email address).',
23
+ required: true,
24
+ }),
25
+ emailAddress: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Email Address',
27
+ description: 'The email address to send to.',
28
+ required: true,
29
+ }),
30
+ attributes: pieces_framework_1.Property.Object({
31
+ displayName: 'Subscriber Attributes',
32
+ description: 'Key-value pairs of subscriber attributes to personalize the email (e.g. {"FirstName": "John", "LastName": "Doe"}).',
33
+ required: false,
34
+ }),
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { triggeredSendKey, subscriberKey, emailAddress, attributes } = context.propsValue;
39
+ const auth = context.auth;
40
+ const subscriber = {
41
+ SubscriberKey: subscriberKey,
42
+ EmailAddress: emailAddress,
43
+ };
44
+ if (attributes && Object.keys(attributes).length > 0) {
45
+ subscriber['Attributes'] = attributes;
46
+ }
47
+ const response = yield (0, common_1.sfmcApiCall)({
48
+ auth,
49
+ method: pieces_common_1.HttpMethod.POST,
50
+ path: `/messaging/v1/messageDefinitionSends/key:${triggeredSendKey}/send`,
51
+ body: {
52
+ From: { Address: emailAddress },
53
+ To: {
54
+ Address: emailAddress,
55
+ SubscriberKey: subscriberKey,
56
+ ContactAttributes: {
57
+ SubscriberAttributes: attributes !== null && attributes !== void 0 ? attributes : {},
58
+ },
59
+ },
60
+ },
61
+ });
62
+ return response.body;
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=send-triggered-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-triggered-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-triggered-email.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAwD;AACxD,8BAAkC;AAClC,sCAAwC;AAG3B,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACV,uFAAuF;IACxF,KAAK,EAAE;QACN,gBAAgB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACpC,WAAW,EAAE,oBAAoB;YACjC,WAAW,EACV,yHAAyH;YAC1H,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,gBAAgB;YAC7B,WA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