@awell-health/awell-extensions 2.0.251 → 2.0.253

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.
@@ -930,4 +930,125 @@ export declare const actions: {
930
930
  helpers: import("@awell-health/extensions-core").Helpers;
931
931
  }) => Promise<void>;
932
932
  };
933
+ sendCampaign: {
934
+ key: string;
935
+ title: string;
936
+ description: string;
937
+ category: import("@awell-health/extensions-core").Category.COMMUNICATION;
938
+ fields: {
939
+ campaignId: {
940
+ id: string;
941
+ label: string;
942
+ type: import("@awell-health/extensions-core").FieldType.STRING;
943
+ required: true;
944
+ description: string;
945
+ };
946
+ sendId: {
947
+ id: string;
948
+ label: string;
949
+ type: import("@awell-health/extensions-core").FieldType.STRING;
950
+ required: false;
951
+ description: string;
952
+ };
953
+ externalUserId: {
954
+ id: string;
955
+ label: string;
956
+ type: import("@awell-health/extensions-core").FieldType.STRING;
957
+ required: false;
958
+ description: string;
959
+ };
960
+ email: {
961
+ id: string;
962
+ label: string;
963
+ type: import("@awell-health/extensions-core").FieldType.STRING;
964
+ required: false;
965
+ description: string;
966
+ };
967
+ triggerProperties: {
968
+ id: string;
969
+ label: string;
970
+ type: import("@awell-health/extensions-core").FieldType.JSON;
971
+ required: false;
972
+ description: string;
973
+ };
974
+ attributes: {
975
+ id: string;
976
+ label: string;
977
+ type: import("@awell-health/extensions-core").FieldType.JSON;
978
+ required: false;
979
+ description: string;
980
+ };
981
+ };
982
+ dataPoints: {
983
+ EmailDispatchId: {
984
+ key: string;
985
+ valueType: "string";
986
+ };
987
+ };
988
+ previewable: false;
989
+ onEvent: ({ payload, onComplete, onError, helpers }: {
990
+ payload: import("@awell-health/extensions-core").NewActivityPayload<{
991
+ campaignId: {
992
+ id: string;
993
+ label: string;
994
+ type: import("@awell-health/extensions-core").FieldType.STRING;
995
+ required: true;
996
+ description: string;
997
+ };
998
+ sendId: {
999
+ id: string;
1000
+ label: string;
1001
+ type: import("@awell-health/extensions-core").FieldType.STRING;
1002
+ required: false;
1003
+ description: string;
1004
+ };
1005
+ externalUserId: {
1006
+ id: string;
1007
+ label: string;
1008
+ type: import("@awell-health/extensions-core").FieldType.STRING;
1009
+ required: false;
1010
+ description: string;
1011
+ };
1012
+ email: {
1013
+ id: string;
1014
+ label: string;
1015
+ type: import("@awell-health/extensions-core").FieldType.STRING;
1016
+ required: false;
1017
+ description: string;
1018
+ };
1019
+ triggerProperties: {
1020
+ id: string;
1021
+ label: string;
1022
+ type: import("@awell-health/extensions-core").FieldType.JSON;
1023
+ required: false;
1024
+ description: string;
1025
+ };
1026
+ attributes: {
1027
+ id: string;
1028
+ label: string;
1029
+ type: import("@awell-health/extensions-core").FieldType.JSON;
1030
+ required: false;
1031
+ description: string;
1032
+ };
1033
+ }, {
1034
+ apiKey: {
1035
+ key: string;
1036
+ label: string;
1037
+ obfuscated: true;
1038
+ required: true;
1039
+ description: string;
1040
+ };
1041
+ baseUrl: {
1042
+ key: string;
1043
+ label: string;
1044
+ obfuscated: false;
1045
+ required: true;
1046
+ description: string;
1047
+ };
1048
+ }>;
1049
+ onComplete: import("@awell-health/extensions-core").OnCompleteCallback<string>;
1050
+ onError: import("@awell-health/extensions-core").OnErrorCallback;
1051
+ helpers: import("@awell-health/extensions-core").Helpers;
1052
+ }) => Promise<void>;
1053
+ };
933
1054
  };
@@ -6,11 +6,13 @@ const scheduleSMS_1 = require("./scheduleSMS");
6
6
  const sendEmail_1 = require("./sendEmail");
7
7
  const scheduleEmail_1 = require("./scheduleEmail");
8
8
  const sendEmailUsingTemplate_1 = require("./sendEmailUsingTemplate");
9
+ const sendCampaign_1 = require("./sendCampaign");
9
10
  exports.actions = {
10
11
  sendSMS: sendSMS_1.sendSMS,
11
12
  scheduleSMS: scheduleSMS_1.scheduleSMS,
12
13
  sendEmail: sendEmail_1.sendEmail,
13
14
  scheduleEmail: scheduleEmail_1.scheduleEmail,
14
15
  sendEmailUsingTemplate: sendEmailUsingTemplate_1.sendEmailUsingTemplate,
16
+ sendCampaign: sendCampaign_1.sendCampaign,
15
17
  };
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/braze/actions/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,+CAA2C;AAC3C,2CAAuC;AACvC,mDAA+C;AAC/C,qEAAiE;AAEpD,QAAA,OAAO,GAAG;IACrB,OAAO,EAAP,iBAAO;IACP,WAAW,EAAX,yBAAW;IACX,SAAS,EAAT,qBAAS;IACT,aAAa,EAAb,6BAAa;IACb,sBAAsB,EAAtB,+CAAsB;CACvB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/braze/actions/index.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,+CAA2C;AAC3C,2CAAuC;AACvC,mDAA+C;AAC/C,qEAAiE;AACjE,iDAA6C;AAEhC,QAAA,OAAO,GAAG;IACrB,OAAO,EAAP,iBAAO;IACP,WAAW,EAAX,yBAAW;IACX,SAAS,EAAT,qBAAS;IACT,aAAa,EAAb,6BAAa;IACb,sBAAsB,EAAtB,+CAAsB;IACtB,YAAY,EAAZ,2BAAY;CACb,CAAA"}
@@ -0,0 +1,75 @@
1
+ import { FieldType } from '@awell-health/extensions-core';
2
+ import { z } from 'zod';
3
+ export declare const fields: {
4
+ campaignId: {
5
+ id: string;
6
+ label: string;
7
+ type: FieldType.STRING;
8
+ required: true;
9
+ description: string;
10
+ };
11
+ sendId: {
12
+ id: string;
13
+ label: string;
14
+ type: FieldType.STRING;
15
+ required: false;
16
+ description: string;
17
+ };
18
+ externalUserId: {
19
+ id: string;
20
+ label: string;
21
+ type: FieldType.STRING;
22
+ required: false;
23
+ description: string;
24
+ };
25
+ email: {
26
+ id: string;
27
+ label: string;
28
+ type: FieldType.STRING;
29
+ required: false;
30
+ description: string;
31
+ };
32
+ triggerProperties: {
33
+ id: string;
34
+ label: string;
35
+ type: FieldType.JSON;
36
+ required: false;
37
+ description: string;
38
+ };
39
+ attributes: {
40
+ id: string;
41
+ label: string;
42
+ type: FieldType.JSON;
43
+ required: false;
44
+ description: string;
45
+ };
46
+ };
47
+ export declare const dataPoints: {
48
+ EmailDispatchId: {
49
+ key: string;
50
+ valueType: "string";
51
+ };
52
+ };
53
+ export declare const FieldsSchema: z.ZodObject<{
54
+ campaignId: z.ZodString;
55
+ sendId: z.ZodOptional<z.ZodString>;
56
+ externalUserId: z.ZodOptional<z.ZodString>;
57
+ email: z.ZodOptional<z.ZodString>;
58
+ triggerProperties: z.ZodEffects<z.ZodOptional<z.ZodString>, Record<string, string> | undefined, string | undefined>;
59
+ attributes: z.ZodEffects<z.ZodOptional<z.ZodString>, Record<string, string> | undefined, string | undefined>;
60
+ }, "strip", z.ZodTypeAny, {
61
+ campaignId: string;
62
+ email?: string | undefined;
63
+ externalUserId?: string | undefined;
64
+ sendId?: string | undefined;
65
+ triggerProperties?: Record<string, string> | undefined;
66
+ attributes?: Record<string, string> | undefined;
67
+ }, {
68
+ campaignId: string;
69
+ email?: string | undefined;
70
+ externalUserId?: string | undefined;
71
+ sendId?: string | undefined;
72
+ triggerProperties?: string | undefined;
73
+ attributes?: string | undefined;
74
+ }>;
75
+ export type ActionFields = z.infer<typeof FieldsSchema>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsSchema = exports.dataPoints = exports.fields = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const lodash_1 = require("lodash");
6
+ const zod_1 = require("zod");
7
+ exports.fields = {
8
+ campaignId: {
9
+ id: 'campaignId',
10
+ label: 'Campaign ID',
11
+ type: extensions_core_1.FieldType.STRING,
12
+ required: true,
13
+ description: 'The ID of the campaign to send the email with attributes to.',
14
+ },
15
+ sendId: {
16
+ id: 'sendId',
17
+ label: 'Send ID',
18
+ type: extensions_core_1.FieldType.STRING,
19
+ required: false,
20
+ description: 'Send identifier (optional)',
21
+ },
22
+ externalUserId: {
23
+ id: 'externalUserId',
24
+ label: 'External User ID',
25
+ type: extensions_core_1.FieldType.STRING,
26
+ required: false,
27
+ description: 'The ID of the user in your system that this message is being sent to. Either external_user_id or email must be provided.',
28
+ },
29
+ email: {
30
+ id: 'email',
31
+ label: 'Email',
32
+ type: extensions_core_1.FieldType.STRING,
33
+ required: false,
34
+ description: 'The email address of the user to send the email to. Either External User ID or Email must be provided.',
35
+ },
36
+ triggerProperties: {
37
+ id: 'triggerProperties',
38
+ label: 'Trigger Properties',
39
+ type: extensions_core_1.FieldType.JSON,
40
+ required: false,
41
+ description: 'Key-value pairs that can be referenced in your message template to personalize it and insert dynamic content.',
42
+ },
43
+ attributes: {
44
+ id: 'attributes',
45
+ label: 'Attributes',
46
+ type: extensions_core_1.FieldType.JSON,
47
+ required: false,
48
+ description: 'Create or update user-specific profile attribute. Attributes can trigger campaigns, can be used for segmentation, and personalization of messages.',
49
+ },
50
+ };
51
+ exports.dataPoints = {
52
+ EmailDispatchId: {
53
+ key: 'EmailDispatchId',
54
+ valueType: 'string',
55
+ },
56
+ };
57
+ exports.FieldsSchema = zod_1.z.object({
58
+ campaignId: zod_1.z.string().min(1),
59
+ sendId: zod_1.z.string().optional(),
60
+ externalUserId: zod_1.z.string().optional(),
61
+ email: zod_1.z.string().optional(),
62
+ triggerProperties: zod_1.z
63
+ .string()
64
+ .optional()
65
+ .transform((str, ctx) => {
66
+ if ((0, lodash_1.isNil)(str) || (0, lodash_1.isEmpty)(str))
67
+ return undefined;
68
+ try {
69
+ const parsedJson = JSON.parse(str);
70
+ return parsedJson;
71
+ }
72
+ catch (e) {
73
+ ctx.addIssue({
74
+ code: 'custom',
75
+ message: 'triggerProperties is not a valid JSON object',
76
+ });
77
+ return zod_1.z.NEVER;
78
+ }
79
+ }),
80
+ attributes: zod_1.z
81
+ .string()
82
+ .optional()
83
+ .transform((str, ctx) => {
84
+ if ((0, lodash_1.isNil)(str) || (0, lodash_1.isEmpty)(str))
85
+ return undefined;
86
+ try {
87
+ const parsedJson = JSON.parse(str);
88
+ return parsedJson;
89
+ }
90
+ catch (e) {
91
+ ctx.addIssue({
92
+ code: 'custom',
93
+ message: 'attributes is not a valid JSON object',
94
+ });
95
+ return zod_1.z.NEVER;
96
+ }
97
+ }),
98
+ });
99
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../extensions/braze/actions/sendCampaign/config.ts"],"names":[],"mappings":";;;AAAA,mEAIsC;AACtC,mCAAuC;AACvC,6BAAuB;AAEV,QAAA,MAAM,GAAG;IACpB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,8DAA8D;KAC5E;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,4BAA4B;KAC1C;IACD,cAAc,EAAE;QACd,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,0HAA0H;KAC7H;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,wGAAwG;KAC3G;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,+GAA+G;KAClH;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QACh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CAAC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;QAEhD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClC,OAAO,UAAU,CAAA;QACnB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uCAAuC;aACjD,CAAC,CAAA;YACF,OAAO,OAAC,CAAC,KAAK,CAAA;QAChB,CAAC;IACH,CAAC,CAAC;CACL,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './sendCampaign';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./sendCampaign"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/braze/actions/sendCampaign/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
@@ -0,0 +1,122 @@
1
+ import { Category } from '@awell-health/extensions-core';
2
+ export declare const sendCampaign: {
3
+ key: string;
4
+ title: string;
5
+ description: string;
6
+ category: Category.COMMUNICATION;
7
+ fields: {
8
+ campaignId: {
9
+ id: string;
10
+ label: string;
11
+ type: import("@awell-health/extensions-core").FieldType.STRING;
12
+ required: true;
13
+ description: string;
14
+ };
15
+ sendId: {
16
+ id: string;
17
+ label: string;
18
+ type: import("@awell-health/extensions-core").FieldType.STRING;
19
+ required: false;
20
+ description: string;
21
+ };
22
+ externalUserId: {
23
+ id: string;
24
+ label: string;
25
+ type: import("@awell-health/extensions-core").FieldType.STRING;
26
+ required: false;
27
+ description: string;
28
+ };
29
+ email: {
30
+ id: string;
31
+ label: string;
32
+ type: import("@awell-health/extensions-core").FieldType.STRING;
33
+ required: false;
34
+ description: string;
35
+ };
36
+ triggerProperties: {
37
+ id: string;
38
+ label: string;
39
+ type: import("@awell-health/extensions-core").FieldType.JSON;
40
+ required: false;
41
+ description: string;
42
+ };
43
+ attributes: {
44
+ id: string;
45
+ label: string;
46
+ type: import("@awell-health/extensions-core").FieldType.JSON;
47
+ required: false;
48
+ description: string;
49
+ };
50
+ };
51
+ dataPoints: {
52
+ EmailDispatchId: {
53
+ key: string;
54
+ valueType: "string";
55
+ };
56
+ };
57
+ previewable: false;
58
+ onEvent: ({ payload, onComplete, onError, helpers }: {
59
+ payload: import("@awell-health/extensions-core").NewActivityPayload<{
60
+ campaignId: {
61
+ id: string;
62
+ label: string;
63
+ type: import("@awell-health/extensions-core").FieldType.STRING;
64
+ required: true;
65
+ description: string;
66
+ };
67
+ sendId: {
68
+ id: string;
69
+ label: string;
70
+ type: import("@awell-health/extensions-core").FieldType.STRING;
71
+ required: false;
72
+ description: string;
73
+ };
74
+ externalUserId: {
75
+ id: string;
76
+ label: string;
77
+ type: import("@awell-health/extensions-core").FieldType.STRING;
78
+ required: false;
79
+ description: string;
80
+ };
81
+ email: {
82
+ id: string;
83
+ label: string;
84
+ type: import("@awell-health/extensions-core").FieldType.STRING;
85
+ required: false;
86
+ description: string;
87
+ };
88
+ triggerProperties: {
89
+ id: string;
90
+ label: string;
91
+ type: import("@awell-health/extensions-core").FieldType.JSON;
92
+ required: false;
93
+ description: string;
94
+ };
95
+ attributes: {
96
+ id: string;
97
+ label: string;
98
+ type: import("@awell-health/extensions-core").FieldType.JSON;
99
+ required: false;
100
+ description: string;
101
+ };
102
+ }, {
103
+ apiKey: {
104
+ key: string;
105
+ label: string;
106
+ obfuscated: true;
107
+ required: true;
108
+ description: string;
109
+ };
110
+ baseUrl: {
111
+ key: string;
112
+ label: string;
113
+ obfuscated: false;
114
+ required: true;
115
+ description: string;
116
+ };
117
+ }>;
118
+ onComplete: import("@awell-health/extensions-core").OnCompleteCallback<string>;
119
+ onError: import("@awell-health/extensions-core").OnErrorCallback;
120
+ helpers: import("@awell-health/extensions-core").Helpers;
121
+ }) => Promise<void>;
122
+ };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendCampaign = void 0;
4
+ const zod_1 = require("zod");
5
+ const lodash_1 = require("lodash");
6
+ const extensions_core_1 = require("@awell-health/extensions-core");
7
+ const settings_1 = require("../../settings");
8
+ const client_1 = require("../../client");
9
+ const config_1 = require("./config");
10
+ exports.sendCampaign = {
11
+ key: 'sendCampaign',
12
+ title: 'Send campaign',
13
+ description: 'Send a campaign with Braze',
14
+ category: extensions_core_1.Category.COMMUNICATION,
15
+ fields: config_1.fields,
16
+ dataPoints: config_1.dataPoints,
17
+ previewable: false,
18
+ onEvent: async ({ payload, onComplete, onError, helpers }) => {
19
+ const { fields: { externalUserId: external_user_id, sendId: send_id, email, campaignId: campaign_id, triggerProperties: trigger_properties, attributes, }, settings: { apiKey, baseUrl }, } = (0, extensions_core_1.validate)({
20
+ schema: zod_1.z.object({
21
+ fields: config_1.FieldsSchema,
22
+ settings: settings_1.SettingsValidationSchema,
23
+ }),
24
+ payload,
25
+ });
26
+ if ((0, lodash_1.isNil)(external_user_id) && (0, lodash_1.isNil)(email)) {
27
+ throw new Error('Either externalUserId or email must be provided.');
28
+ }
29
+ const client = new client_1.BrazeClient({ apiKey, baseUrl });
30
+ const requestBody = {
31
+ campaign_id,
32
+ recipients: [
33
+ {
34
+ ...(!(0, lodash_1.isNil)(external_user_id) && {
35
+ external_user_id,
36
+ }),
37
+ ...(!(0, lodash_1.isNil)(email) && {
38
+ email,
39
+ }),
40
+ ...(!(0, lodash_1.isNil)(trigger_properties) && {
41
+ trigger_properties,
42
+ }),
43
+ ...(!(0, lodash_1.isNil)(attributes) && {
44
+ attributes,
45
+ }),
46
+ },
47
+ ],
48
+ ...(!(0, lodash_1.isNil)(send_id) && {
49
+ send_id,
50
+ }),
51
+ };
52
+ const resp = await client.sendCampaign(requestBody);
53
+ await onComplete({
54
+ events: [
55
+ {
56
+ date: new Date().toISOString(),
57
+ text: { en: `Email sent. Response: ${JSON.stringify(resp)}` },
58
+ },
59
+ ],
60
+ data_points: {
61
+ EmailDispatchId: resp.dispatch_id,
62
+ },
63
+ });
64
+ },
65
+ };
66
+ //# sourceMappingURL=sendCampaign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendCampaign.js","sourceRoot":"","sources":["../../../../../extensions/braze/actions/sendCampaign/sendCampaign.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mCAA8B;AAC9B,mEAA+E;AAE/E,6CAAwE;AACxE,yCAA0C;AAC1C,qCAA2D;AAE9C,QAAA,YAAY,GAAG;IAC1B,GAAG,EAAE,cAAc;IACnB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,4BAA4B;IACzC,QAAQ,EAAE,0BAAQ,CAAC,aAAa;IAChC,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3D,MAAM,EACJ,MAAM,EAAE,EACN,cAAc,EAAE,gBAAgB,EAChC,MAAM,EAAE,OAAO,EACf,KAAK,EACL,UAAU,EAAE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AE,EAAE,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;iBAC9D;aACF;YACD,WAAW,EAAE;gBACX,eAAe,EAAE,IAAI,CAAC,WAAW;aAClC;SACF,CAAC,CAAA;IACJ,CAAC;CAC+C,CAAA"}
@@ -14,5 +14,6 @@ export declare class BrazeClient {
14
14
  });
15
15
  sendMessageImmediately(data: Record<string, any>): Promise<SendMessageImmediatelyResponse>;
16
16
  scheduleMessage(data: Record<string, any>): Promise<ScheduleMessageResponse>;
17
+ sendCampaign(data: Record<string, any>): Promise<SendMessageImmediatelyResponse>;
17
18
  }
18
19
  export {};
@@ -24,6 +24,10 @@ class BrazeClient {
24
24
  const response = await this.client.post(`/messages/schedule/create`, data);
25
25
  return response.data;
26
26
  }
27
+ async sendCampaign(data) {
28
+ const response = await this.client.post(`/campaigns/trigger/send`, data);
29
+ return response.data;
30
+ }
27
31
  }
28
32
  exports.BrazeClient = BrazeClient;
29
33
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../extensions/braze/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;AAYjD,MAAa,WAAW;IAGtB,YAAY,EAAE,MAAM,EAAE,OAAO,EAAuC;QAClE,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,EAAE;gBACjC,cAAc,EAAE,kBAAkB;gBAClC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC1B,IAAyB;QAEzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAAyB;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAA;QAC1E,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AA3BD,kCA2BC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../extensions/braze/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiD;AAYjD,MAAa,WAAW;IAGtB,YAAY,EAAE,MAAM,EAAE,OAAO,EAAuC;QAClE,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,EAAE;gBACjC,cAAc,EAAE,kBAAkB;gBAClC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC1B,IAAyB;QAEzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAAyB;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAA;QAC1E,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,IAAyB;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAA;QACxE,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AAlCD,kCAkCC"}
@@ -16,7 +16,7 @@
16
16
  "changelog": "# CHANGELOG"
17
17
  },
18
18
  "braze": {
19
- "readme": "---\ntitle: Braze\ndescription: Braze is a customer engagement platform that helps you communicate with your patients.\n---\n\n# Braze\n\nBraze is a comprehensive customer engagement platform that specializes in helping businesses connect with their users through personalized messaging channels.\n\n## Supported Actins\n\n- **sendSMS** - Send an immediate SMS message to a specified user\n- **scheduleSMS** - Schedule an SMS message to be sent at a specific time\n- **sendEmail** - Send an immediate email to a specified user\n- **scheduleEmail** - Schedule an email to be sent at a specific time\n- **sendEmailUsingTemplate** - Send an email using a pre-defined Braze template\n\n## Extension settings\n\nAn api key and the REST Endpoint URL are needed to be provided in order for the extension to authenticate with Braze's API.\nList of URLs can be found [here](https://www.braze.com/docs/api/basics/#endpoints) - make sure it's the REST Endpoint URL.\nDocumentation on API keys can be found [here](https://www.braze.com/docs/api/basics/#about-rest-api-keys).\n\nPermissions needed for the API key: \n- messages.schedule.create (Schedule a message to be sent at a specific time.)\n- messages.send (Send an immediate message to specific users.)\n\n\n",
19
+ "readme": "---\ntitle: Braze\ndescription: Braze is a customer engagement platform that helps you communicate with your patients.\n---\n\n# Braze\n\nBraze is a comprehensive customer engagement platform that specializes in helping businesses connect with their users through personalized messaging channels.\n\n## Extension settings\n\nAn api key and the REST Endpoint URL are needed to be provided in order for the extension to authenticate with Braze's API.\n\nList of URLs can be found [here](https://www.braze.com/docs/api/basics/#endpoints) - make sure it's the REST Endpoint URL. Documentation on API keys can be found [here](https://www.braze.com/docs/api/basics/#about-rest-api-keys).\n\n## Supported Actins\n\n### Send SMS\n\nSend an immediate SMS message to a specified user\n\nRequired permissions: `messages.send`\n\n### Schedule SMS\n\nSchedule an SMS message to be sent at a specific time\n\nRequired permissions: `messages.schedule.create`\n\n### Send Email\n\nSend an immediate email to a specified user\n\nRequired permissions: `messages.send`\n\n### Schedule Email\n\nSchedule an email to be sent at a specific time\n\nRequired permissions: `messages.schedule.create`\n\n### Send Email Using Template\n\nSend an email using a pre-defined Braze template\n\nRequired permissions: `messages.send`\n\n### Send campaign\n\nSend a campaign message.\n\nRequired permissions: `campaigns.trigger.send`\n",
20
20
  "changelog": "# Braze changelog\n"
21
21
  },
22
22
  "calDotCom": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.251",
3
+ "version": "2.0.253",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {