@scopieflows/app-microsoft-teams 0.3.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.
Files changed (75) hide show
  1. package/README.md +7 -0
  2. package/package.json +31 -0
  3. package/src/i18n/ca.json +35 -0
  4. package/src/i18n/de.json +84 -0
  5. package/src/i18n/es.json +84 -0
  6. package/src/i18n/fr.json +84 -0
  7. package/src/i18n/hi.json +35 -0
  8. package/src/i18n/id.json +35 -0
  9. package/src/i18n/ja.json +84 -0
  10. package/src/i18n/nl.json +84 -0
  11. package/src/i18n/pt.json +84 -0
  12. package/src/i18n/ru.json +35 -0
  13. package/src/i18n/translation.json +84 -0
  14. package/src/i18n/vi.json +35 -0
  15. package/src/i18n/zh.json +84 -0
  16. package/src/index.d.ts +2 -0
  17. package/src/index.js +130 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/create-channel.d.ts +5 -0
  20. package/src/lib/actions/create-channel.js +41 -0
  21. package/src/lib/actions/create-channel.js.map +1 -0
  22. package/src/lib/actions/create-chat-and-send-message.d.ts +6 -0
  23. package/src/lib/actions/create-chat-and-send-message.js +84 -0
  24. package/src/lib/actions/create-chat-and-send-message.js.map +1 -0
  25. package/src/lib/actions/create-private-channel.d.ts +5 -0
  26. package/src/lib/actions/create-private-channel.js +39 -0
  27. package/src/lib/actions/create-private-channel.js.map +1 -0
  28. package/src/lib/actions/delete-chat-message.d.ts +4 -0
  29. package/src/lib/actions/delete-chat-message.js +36 -0
  30. package/src/lib/actions/delete-chat-message.js.map +1 -0
  31. package/src/lib/actions/find-channel.d.ts +4 -0
  32. package/src/lib/actions/find-channel.js +40 -0
  33. package/src/lib/actions/find-channel.js.map +1 -0
  34. package/src/lib/actions/find-team-member.d.ts +5 -0
  35. package/src/lib/actions/find-team-member.js +54 -0
  36. package/src/lib/actions/find-team-member.js.map +1 -0
  37. package/src/lib/actions/get-channel-message.d.ts +6 -0
  38. package/src/lib/actions/get-channel-message.js +39 -0
  39. package/src/lib/actions/get-channel-message.js.map +1 -0
  40. package/src/lib/actions/get-chat-message.d.ts +4 -0
  41. package/src/lib/actions/get-chat-message.js +31 -0
  42. package/src/lib/actions/get-chat-message.js.map +1 -0
  43. package/src/lib/actions/reply-to-channel-message.d.ts +7 -0
  44. package/src/lib/actions/reply-to-channel-message.js +56 -0
  45. package/src/lib/actions/reply-to-channel-message.js.map +1 -0
  46. package/src/lib/actions/request-approval-channel-message.d.ts +5 -0
  47. package/src/lib/actions/request-approval-channel-message.js +104 -0
  48. package/src/lib/actions/request-approval-channel-message.js.map +1 -0
  49. package/src/lib/actions/request-approval-direct-message.d.ts +4 -0
  50. package/src/lib/actions/request-approval-direct-message.js +102 -0
  51. package/src/lib/actions/request-approval-direct-message.js.map +1 -0
  52. package/src/lib/actions/send-channel-message.d.ts +6 -0
  53. package/src/lib/actions/send-channel-message.js +59 -0
  54. package/src/lib/actions/send-channel-message.js.map +1 -0
  55. package/src/lib/actions/send-chat-message.d.ts +5 -0
  56. package/src/lib/actions/send-chat-message.js +57 -0
  57. package/src/lib/actions/send-chat-message.js.map +1 -0
  58. package/src/lib/common/graph.d.ts +10 -0
  59. package/src/lib/common/graph.js +90 -0
  60. package/src/lib/common/graph.js.map +1 -0
  61. package/src/lib/common/index.d.ts +7 -0
  62. package/src/lib/common/index.js +217 -0
  63. package/src/lib/common/index.js.map +1 -0
  64. package/src/lib/triggers/new-channel-message.d.ts +14 -0
  65. package/src/lib/triggers/new-channel-message.js +137 -0
  66. package/src/lib/triggers/new-channel-message.js.map +1 -0
  67. package/src/lib/triggers/new-channel.d.ts +10 -0
  68. package/src/lib/triggers/new-channel.js +95 -0
  69. package/src/lib/triggers/new-channel.js.map +1 -0
  70. package/src/lib/triggers/new-chat-message.d.ts +10 -0
  71. package/src/lib/triggers/new-chat-message.js +132 -0
  72. package/src/lib/triggers/new-chat-message.js.map +1 -0
  73. package/src/lib/triggers/new-chat.d.ts +2 -0
  74. package/src/lib/triggers/new-chat.js +95 -0
  75. package/src/lib/triggers/new-chat.js.map +1 -0
@@ -0,0 +1,5 @@
1
+ export declare const createPrivateChannelAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ channelDisplayName: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ channelDescription: import("@scopieflows/pieces-framework").LongTextProperty<false>;
5
+ }>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPrivateChannelAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const graph_1 = require("../common/graph");
9
+ exports.createPrivateChannelAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_create_private_channel',
12
+ displayName: 'Create Private Channel',
13
+ description: 'Create a new private channel in a team.',
14
+ props: {
15
+ teamId: common_1.microsoftTeamsCommon.teamId,
16
+ channelDisplayName: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Channel Name',
18
+ required: true,
19
+ }),
20
+ channelDescription: pieces_framework_1.Property.LongText({
21
+ displayName: 'Channel Description',
22
+ required: false,
23
+ }),
24
+ },
25
+ run(context) {
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ const { teamId, channelDescription, channelDisplayName } = context.propsValue;
28
+ const client = (0, graph_1.createGraphClient)(context.auth.access_token);
29
+ const channel = {
30
+ displayName: channelDisplayName,
31
+ description: channelDescription,
32
+ membershipType: 'private',
33
+ };
34
+ // https://learn.microsoft.com/graph/api/channel-post?view=graph-rest-1.0
35
+ return yield (0, graph_1.withGraphRetry)(() => client.api(`/teams/${teamId}/channels`).post(channel));
36
+ });
37
+ },
38
+ });
39
+ //# sourceMappingURL=create-private-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-private-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/create-private-channel.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AAEvE,sCAAiD;AACjD,2CAAoE;AAEvD,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,wCAAwC;IAC9C,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,kBAAkB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtC,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrC,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,KAAK;SACf,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE9E,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE5D,MAAM,OAAO,GAAG;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,WAAW,EAAE,kBAAkB;gBAC/B,cAAc,EAAE,SAAS;aACzB,CAAC;YAEF,yEAAyE;YACzE,OAAO,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1F,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const deleteChatMessageAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ chatId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ messageId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteChatMessageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.deleteChatMessageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_delete_chat_message',
12
+ displayName: 'Delete Chat Message',
13
+ description: 'Soft-Deletes a message in chat.You can only delete messages you sent.',
14
+ props: {
15
+ chatId: common_1.microsoftTeamsCommon.chatId,
16
+ messageId: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Message ID',
18
+ required: true,
19
+ description: 'The ID of the message to delete.',
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { chatId, messageId } = context.propsValue;
25
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
26
+ authProvider: {
27
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
28
+ },
29
+ });
30
+ const me = yield client.api('/me').select('id,userPrincipalName').get();
31
+ yield client.api(`/users/${me.id}/chats/${chatId}/messages/${messageId}/softDelete`).post({});
32
+ return { success: true, messageId, chatId };
33
+ });
34
+ },
35
+ });
36
+ //# sourceMappingURL=delete-chat-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-chat-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/delete-chat-message.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AACvE,sCAAiD;AACjD,8EAA2D;AAE9C,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,uEAAuE;IACpF,KAAK,EAAE;QACH,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,kCAAkC;SAClD,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjD,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBAC7B,YAAY,EAAE;oBACV,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBACnE;aACJ,CAAC,CAAC;YAGX,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC;YAExE,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,UAAU,MAAM,aAAa,SAAS,aAAa,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAE9F,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,SAAS,EAAC,MAAM,EAAC,CAAA;QAG1C,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const findChannelAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ channelName: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findChannelAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
8
+ const common_1 = require("../common");
9
+ exports.findChannelAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_find_channel',
12
+ displayName: 'Find Channel',
13
+ description: 'Finds channels by name.',
14
+ props: {
15
+ teamId: common_1.microsoftTeamsCommon.teamId,
16
+ channelName: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Channel Name',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const { teamId, channelName } = context.propsValue;
24
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
25
+ authProvider: {
26
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
27
+ },
28
+ });
29
+ const response = yield client
30
+ .api(`/teams/${teamId}/allChannels`)
31
+ .filter(`displayName eq '${channelName}'`)
32
+ .get();
33
+ return {
34
+ found: response.value.length > 0,
35
+ result: response.value,
36
+ };
37
+ });
38
+ },
39
+ });
40
+ //# sourceMappingURL=find-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/find-channel.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AACvE,8EAA2E;AAC3E,sCAAiD;AAEpC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEnD,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAmB,MAAM,MAAM;iBAC3C,GAAG,CAAC,UAAU,MAAM,cAAc,CAAC;iBACnC,MAAM,CAAC,mBAAmB,WAAW,GAAG,CAAC;iBACzC,GAAG,EAAE,CAAC;YAER,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBAChC,MAAM,EAAE,QAAQ,CAAC,KAAK;aACtB,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const findTeamMemberAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ searchBy: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
4
+ searchValue: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ }>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findTeamMemberAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
8
+ const common_1 = require("../common");
9
+ exports.findTeamMemberAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_find_team_member',
12
+ displayName: 'Find Team Member',
13
+ description: 'Finds a team member by email or display name.',
14
+ props: {
15
+ teamId: common_1.microsoftTeamsCommon.teamId,
16
+ searchBy: pieces_framework_1.Property.StaticDropdown({
17
+ displayName: 'Search By',
18
+ required: true,
19
+ defaultValue: 'email',
20
+ options: {
21
+ disabled: false,
22
+ options: [
23
+ { label: 'Email', value: 'email' },
24
+ { label: 'Name', value: 'name' },
25
+ ],
26
+ },
27
+ }),
28
+ searchValue: pieces_framework_1.Property.ShortText({
29
+ displayName: 'searchValue',
30
+ required: true,
31
+ description: 'Email address or name to search for.',
32
+ }),
33
+ },
34
+ run(context) {
35
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
36
+ const { teamId, searchBy, searchValue } = context.propsValue;
37
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
38
+ authProvider: {
39
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
40
+ },
41
+ });
42
+ const filter = searchBy == 'email' ? `microsoft.graph.aadUserConversationMember/email eq '${searchValue}'` : `microsoft.graph.aadUserConversationMember/displayName eq '${searchValue}'`;
43
+ const response = yield client
44
+ .api(`/teams/${teamId}/members`)
45
+ .filter(filter)
46
+ .get();
47
+ return {
48
+ found: response.value.length > 0,
49
+ result: response.value,
50
+ };
51
+ });
52
+ },
53
+ });
54
+ //# sourceMappingURL=find-team-member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-team-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/find-team-member.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AACvE,8EAA2E;AAC3E,sCAAiD;AAEpC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACjC,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,OAAO;YACrB,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBAChC;aACD;SACD,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,sCAAsC;SACnD,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAA;YAE5D,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACxC,YAAY,EAAE;oBACb,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBAChE;aACD,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAA,uDAAuD,WAAW,GAAG,CAAA,CAAC,CAAA,8DAA8D,WAAW,GAAG,CAAC;YAEvL,MAAM,QAAQ,GAAmB,MAAM,MAAM;iBAC3C,GAAG,CAAC,UAAU,MAAM,UAAU,CAAC;iBAC/B,MAAM,CAAC,MAAM,CAAC;iBACd,GAAG,EAAE,CAAC;YAER,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBAChC,MAAM,EAAE,QAAQ,CAAC,KAAK;aACtB,CAAC;QAEH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const getChannelMessageAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ channelId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ messageId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ replyId: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
6
+ }>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getChannelMessageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const graph_1 = require("../common/graph");
9
+ exports.getChannelMessageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_get_channel_message',
12
+ displayName: 'Get Channel Message',
13
+ description: 'Fetch a specific channel message by team, channel, and message ID (optionally a reply).',
14
+ props: {
15
+ teamId: common_1.microsoftTeamsCommon.teamId,
16
+ channelId: common_1.microsoftTeamsCommon.channelId,
17
+ messageId: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Message ID',
19
+ required: true,
20
+ description: 'The ID of the channel message to retrieve.',
21
+ }),
22
+ replyId: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Reply ID (optional)',
24
+ required: false,
25
+ description: 'Provide to fetch a specific reply under the message.',
26
+ }),
27
+ },
28
+ run(context) {
29
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
+ const { teamId, channelId, messageId, replyId } = context.propsValue;
31
+ const client = (0, graph_1.createGraphClient)(context.auth.access_token);
32
+ // https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0
33
+ const base = `/teams/${teamId}/channels/${channelId}/messages/${messageId}`;
34
+ const path = replyId ? `${base}/replies/${replyId}` : base;
35
+ return yield (0, graph_1.withGraphRetry)(() => client.api(path).get());
36
+ });
37
+ },
38
+ });
39
+ //# sourceMappingURL=get-channel-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-channel-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/get-channel-message.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AAEvE,sCAAiD;AACjD,2CAAoE;AAEvD,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,yFAAyF;IACtG,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,SAAS,EAAE,6BAAoB,CAAC,SAAS;QACzC,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4CAA4C;SACzD,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,sDAAsD;SACnE,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErE,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE5D,4EAA4E;YAC5E,MAAM,IAAI,GAAG,UAAU,MAAM,aAAa,SAAS,aAAa,SAAS,EAAE,CAAC;YAC5E,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3D,OAAO,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3D,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const getChatMessageAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ chatId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ messageId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getChatMessageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const graph_1 = require("../common/graph");
9
+ exports.getChatMessageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_get_chat_message',
12
+ displayName: 'Get Chat Message',
13
+ description: 'Fetch a specific chat message by chat and message ID.',
14
+ props: {
15
+ chatId: common_1.microsoftTeamsCommon.chatId,
16
+ messageId: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Message ID',
18
+ required: true,
19
+ description: 'The ID of the message to retrieve.',
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { chatId, messageId } = context.propsValue;
25
+ const client = (0, graph_1.createGraphClient)(context.auth.access_token);
26
+ // https://learn.microsoft.com/graph/api/chatmessage-get?view=graph-rest-1.0
27
+ return yield (0, graph_1.withGraphRetry)(() => client.api(`/chats/${chatId}/messages/${messageId}`).get());
28
+ });
29
+ },
30
+ });
31
+ //# sourceMappingURL=get-chat-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-chat-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/get-chat-message.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AAEvE,sCAAiD;AACjD,2CAAoE;AAEvD,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,oCAAoC;SACjD,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjD,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE5D,4EAA4E;YAC5E,OAAO,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,aAAa,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/F,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const replyToChannelMessageAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ channelId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ messageId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ contentType: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
6
+ content: import("@scopieflows/pieces-framework").LongTextProperty<true>;
7
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replyToChannelMessageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const graph_1 = require("../common/graph");
9
+ exports.replyToChannelMessageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftTeamsAuth,
11
+ name: 'microsoft_teams_reply_to_channel_message',
12
+ displayName: 'Reply to Channel Message',
13
+ description: 'Post a reply to an existing channel message.',
14
+ props: {
15
+ teamId: common_1.microsoftTeamsCommon.teamId,
16
+ channelId: common_1.microsoftTeamsCommon.channelId,
17
+ messageId: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Message ID',
19
+ required: true,
20
+ description: 'ID of the parent message to reply to.'
21
+ }),
22
+ contentType: pieces_framework_1.Property.StaticDropdown({
23
+ displayName: 'Content Type',
24
+ required: true,
25
+ defaultValue: 'text',
26
+ options: {
27
+ disabled: false,
28
+ options: [
29
+ { label: 'Text', value: 'text' },
30
+ { label: 'HTML', value: 'html' },
31
+ ],
32
+ },
33
+ }),
34
+ content: pieces_framework_1.Property.LongText({
35
+ displayName: 'Message',
36
+ required: true,
37
+ }),
38
+ },
39
+ run(context) {
40
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
+ const { teamId, channelId, messageId, contentType, content } = context.propsValue;
42
+ const client = (0, graph_1.createGraphClient)(context.auth.access_token);
43
+ const chatMessage = {
44
+ body: {
45
+ content: content,
46
+ contentType: contentType,
47
+ },
48
+ };
49
+ // https://learn.microsoft.com/graph/api/chatmessage-post-replies?view=graph-rest-1.0
50
+ return yield (0, graph_1.withGraphRetry)(() => client
51
+ .api(`/teams/${teamId}/channels/${channelId}/messages/${messageId}/replies`)
52
+ .post(chatMessage));
53
+ });
54
+ },
55
+ });
56
+ //# sourceMappingURL=reply-to-channel-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-to-channel-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/reply-to-channel-message.ts"],"names":[],"mappings":";;;;AAAA,8BAA4C;AAC5C,oEAAuE;AAEvE,sCAAiD;AACjD,2CAAoE;AAEvD,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,0CAA0C;IAChD,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,8CAA8C;IAC3D,KAAK,EAAE;QACN,MAAM,EAAE,6BAAoB,CAAC,MAAM;QACnC,SAAS,EAAE,6BAAoB,CAAC,SAAS;QACzC,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,uCAAuC;SACpD,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACpC,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBAChC;aACD;SACD,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAElF,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE5D,MAAM,WAAW,GAAG;gBACnB,IAAI,EAAE;oBACL,OAAO,EAAE,OAAO;oBAChB,WAAW,EAAE,WAAW;iBACxB;aACD,CAAC;YAEF,qFAAqF;YACrF,OAAO,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,CAChC,MAAM;iBACJ,GAAG,CAAC,UAAU,MAAM,aAAa,SAAS,aAAa,SAAS,UAAU,CAAC;iBAC3E,IAAI,CAAC,WAAW,CAAC,CACnB,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const requestApprovalInChannel: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ teamId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ channelId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ message: import("@scopieflows/pieces-framework").LongTextProperty<true>;
5
+ }>;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestApprovalInChannel = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const __1 = require("../..");
7
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
8
+ const common_1 = require("../common");
9
+ const shared_1 = require("@scopieflows/shared");
10
+ exports.requestApprovalInChannel = (0, pieces_framework_1.createAction)({
11
+ auth: __1.microsoftTeamsAuth,
12
+ name: 'request_approval_in_channel',
13
+ displayName: 'Request Approval in Channel',
14
+ description: 'Send approval message to a channel and then wait until the message is approved or disapproved',
15
+ props: {
16
+ teamId: common_1.microsoftTeamsCommon.teamId,
17
+ channelId: common_1.microsoftTeamsCommon.channelId,
18
+ message: pieces_framework_1.Property.LongText({
19
+ displayName: 'Message',
20
+ required: true,
21
+ }),
22
+ },
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ if (context.executionType === shared_1.ExecutionType.BEGIN) {
26
+ const { teamId, channelId, message } = context.propsValue;
27
+ const token = context.auth.access_token;
28
+ (0, shared_1.assertNotNullOrUndefined)(token, 'token');
29
+ (0, shared_1.assertNotNullOrUndefined)(teamId, 'teamId');
30
+ (0, shared_1.assertNotNullOrUndefined)(channelId, 'channelId');
31
+ (0, shared_1.assertNotNullOrUndefined)(message, 'message');
32
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
33
+ authProvider: {
34
+ getAccessToken: () => Promise.resolve(token),
35
+ },
36
+ });
37
+ const attachmentId = Date.now().toString();
38
+ const approvalLink = context.generateResumeUrl({
39
+ queryParams: { action: 'approve' },
40
+ });
41
+ const disapprovalLink = context.generateResumeUrl({
42
+ queryParams: { action: 'disapprove' },
43
+ });
44
+ const chatMessage = {
45
+ body: {
46
+ contentType: 'html',
47
+ content: `${message}<attachment id="${attachmentId}"></attachment>`,
48
+ },
49
+ attachments: [
50
+ {
51
+ id: attachmentId,
52
+ contentType: 'application/vnd.microsoft.card.adaptive',
53
+ contentUrl: null,
54
+ content: JSON.stringify({
55
+ $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
56
+ type: 'AdaptiveCard',
57
+ version: '1.4',
58
+ body: [
59
+ {
60
+ type: 'TextBlock',
61
+ text: 'Please choose an action:',
62
+ },
63
+ ],
64
+ actions: [
65
+ {
66
+ type: 'Action.OpenUrl',
67
+ title: 'Approve',
68
+ url: approvalLink,
69
+ style: 'positive',
70
+ },
71
+ {
72
+ type: 'Action.OpenUrl',
73
+ title: 'Disapprove',
74
+ url: disapprovalLink,
75
+ style: 'destructive',
76
+ },
77
+ ],
78
+ }),
79
+ },
80
+ ],
81
+ };
82
+ // Send the message
83
+ const response = yield client
84
+ .api(`/teams/${teamId}/channels/${channelId}/messages`)
85
+ .post(chatMessage);
86
+ context.run.pause({
87
+ pauseMetadata: {
88
+ type: shared_1.PauseType.WEBHOOK,
89
+ response: {},
90
+ },
91
+ });
92
+ return {
93
+ approved: false, // default approval is false
94
+ };
95
+ }
96
+ else {
97
+ return {
98
+ approved: context.resumePayload.queryParams['action'] === 'approve',
99
+ };
100
+ }
101
+ });
102
+ },
103
+ });
104
+ //# sourceMappingURL=request-approval-channel-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-approval-channel-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/request-approval-channel-message.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,6BAA2C;AAC3C,8EAA2D;AAC3D,sCAAiD;AACjD,gDAI6B;AAGhB,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,+FAA+F;I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@@
1
+ export declare const requestApprovalDirectMessage: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ chatId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ message: import("@scopieflows/pieces-framework").LongTextProperty<true>;
4
+ }>;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestApprovalDirectMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const __1 = require("../..");
7
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
8
+ const common_1 = require("../common");
9
+ const shared_1 = require("@scopieflows/shared");
10
+ exports.requestApprovalDirectMessage = (0, pieces_framework_1.createAction)({
11
+ auth: __1.microsoftTeamsAuth,
12
+ name: 'request_approval_direct_message',
13
+ displayName: 'Request Approval from a User',
14
+ description: 'Send approval message to a user and then wait until the message is approved or disapproved',
15
+ props: {
16
+ chatId: common_1.microsoftTeamsCommon.chatId,
17
+ message: pieces_framework_1.Property.LongText({
18
+ displayName: 'Message',
19
+ required: true,
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ if (context.executionType === shared_1.ExecutionType.BEGIN) {
25
+ const { chatId, message } = context.propsValue;
26
+ const token = context.auth.access_token;
27
+ (0, shared_1.assertNotNullOrUndefined)(token, 'token');
28
+ (0, shared_1.assertNotNullOrUndefined)(chatId, 'chatId');
29
+ (0, shared_1.assertNotNullOrUndefined)(message, 'message');
30
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
31
+ authProvider: {
32
+ getAccessToken: () => Promise.resolve(token),
33
+ },
34
+ });
35
+ const attachmentId = Date.now().toString();
36
+ const approvalLink = context.generateResumeUrl({
37
+ queryParams: { action: 'approve' },
38
+ });
39
+ const disapprovalLink = context.generateResumeUrl({
40
+ queryParams: { action: 'disapprove' },
41
+ });
42
+ const chatMessage = {
43
+ body: {
44
+ contentType: 'html',
45
+ content: `${message}<attachment id="${attachmentId}"></attachment>`,
46
+ },
47
+ attachments: [
48
+ {
49
+ id: attachmentId,
50
+ contentType: 'application/vnd.microsoft.card.adaptive',
51
+ contentUrl: null,
52
+ content: JSON.stringify({
53
+ $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
54
+ type: 'AdaptiveCard',
55
+ version: '1.4',
56
+ body: [
57
+ {
58
+ type: 'TextBlock',
59
+ text: 'Please choose an action:',
60
+ },
61
+ ],
62
+ actions: [
63
+ {
64
+ type: 'Action.OpenUrl',
65
+ title: 'Approve',
66
+ url: approvalLink,
67
+ style: 'positive',
68
+ },
69
+ {
70
+ type: 'Action.OpenUrl',
71
+ title: 'Disapprove',
72
+ url: disapprovalLink,
73
+ style: 'destructive',
74
+ },
75
+ ],
76
+ }),
77
+ },
78
+ ],
79
+ };
80
+ // Send the message
81
+ const response = yield client
82
+ .api(`/chats/${chatId}/messages`)
83
+ .post(chatMessage);
84
+ context.run.pause({
85
+ pauseMetadata: {
86
+ type: shared_1.PauseType.WEBHOOK,
87
+ response: {},
88
+ },
89
+ });
90
+ return {
91
+ approved: false, // default approval is false
92
+ };
93
+ }
94
+ else {
95
+ return {
96
+ approved: context.resumePayload.queryParams['action'] === 'approve',
97
+ };
98
+ }
99
+ });
100
+ },
101
+ });
102
+ //# sourceMappingURL=request-approval-direct-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-approval-direct-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-teams/src/lib/actions/request-approval-direct-message.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,6BAA2C;AAC3C,8EAA2D;AAC3D,sCAAiD;AACjD,gDAI6B;AAEhB,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI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