@pipedream/microsoft_teams 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-get-current-user",
5
+ name: "Get Current User",
6
+ description: "Returns the authenticated Microsoft Teams user's ID, display name, email, and principal name via Microsoft Graph. Call this first when the user says 'my channels', 'my chats', or needs identity context. Use the returned `id` to identify the sender in **Send Channel Message** or **Send Chat Message** results. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-get).",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ microsoftTeams,
16
+ },
17
+ async run({ $ }) {
18
+ const user = await this.microsoftTeams.client()
19
+ .api("/me")
20
+ .select("id,displayName,mail,userPrincipalName")
21
+ .get();
22
+
23
+ const summaryName = user.displayName || user.mail || user.id;
24
+ $.export("$summary", `Retrieved user ${summaryName}`);
25
+
26
+ return {
27
+ id: user.id,
28
+ displayName: user.displayName,
29
+ mail: user.mail,
30
+ userPrincipalName: user.userPrincipalName,
31
+ };
32
+ },
33
+ };
@@ -0,0 +1,57 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-list-channel-messages",
5
+ name: "List Channel Messages",
6
+ description: "Lists messages in a Microsoft Teams channel. [See the documentation](https://learn.microsoft.com/en-us/graph/api/channel-list-messages)",
7
+ type: "action",
8
+ version: "0.0.1",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ microsoftTeams,
16
+ teamId: {
17
+ propDefinition: [
18
+ microsoftTeams,
19
+ "team",
20
+ ],
21
+ },
22
+ channelId: {
23
+ propDefinition: [
24
+ microsoftTeams,
25
+ "channel",
26
+ ({ teamId }) => ({
27
+ teamId,
28
+ }),
29
+ ],
30
+ },
31
+ maxResults: {
32
+ type: "integer",
33
+ label: "Max Results",
34
+ description: "The maximum number of messages to return",
35
+ optional: true,
36
+ },
37
+ },
38
+ async run({ $ }) {
39
+ const messages = [];
40
+ const paginator = this.microsoftTeams.paginate(this.microsoftTeams.listChannelMessages, {
41
+ teamId: this.teamId,
42
+ channelId: this.channelId,
43
+ });
44
+
45
+ for await (const message of paginator) {
46
+ messages.push(message);
47
+ if (this.maxResults && messages.length >= this.maxResults) {
48
+ break;
49
+ }
50
+ }
51
+
52
+ $.export("$summary", `Successfully fetched ${messages.length} message${messages.length === 1
53
+ ? ""
54
+ : "s"}`);
55
+ return messages;
56
+ },
57
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_teams",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Pipedream Microsoft Teams Components",
5
5
  "main": "microsoft_teams.app.mjs",
6
6
  "keywords": [