@pipedream/microsoft_teams 0.1.3 → 0.1.5
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/actions/create-channel/create-channel.mjs +1 -1
- package/actions/list-channels/list-channels.mjs +1 -1
- package/actions/list-shifts/list-shifts.mjs +1 -1
- package/actions/send-channel-message/send-channel-message.mjs +1 -1
- package/actions/send-chat-message/send-chat-message.mjs +1 -1
- package/microsoft_teams.app.mjs +61 -67
- package/package.json +1 -1
- package/sources/common/base.mjs +0 -2
- package/sources/new-channel/new-channel.mjs +1 -1
- package/sources/new-channel-message/new-channel-message.mjs +1 -1
- package/sources/new-chat/new-chat.mjs +1 -1
- package/sources/new-chat-message/new-chat-message.mjs +1 -1
- package/sources/new-team/new-team.mjs +1 -1
- package/sources/new-team-member/new-team-member.mjs +1 -1
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Create Channel",
|
|
6
6
|
description: "Create a new channel in Microsoft Teams. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-post?view=graph-rest-1.0&tabs=http)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
microsoftTeams,
|
|
11
11
|
teamId: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "List Channels",
|
|
6
6
|
description: "Lists all channels in a Microsoft Team. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0&tabs=http)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
microsoftTeams,
|
|
11
11
|
teamId: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "List Shifts",
|
|
6
6
|
description: "Get the list of shift instances for a team. [See the documentation](https://learn.microsoft.com/en-us/graph/api/schedule-list-shifts?view=graph-rest-1.0&tabs=http)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.5",
|
|
9
9
|
props: {
|
|
10
10
|
microsoftTeams,
|
|
11
11
|
teamId: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Send Channel Message",
|
|
6
6
|
description: "Send a message to a team's channel. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=http)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
microsoftTeams,
|
|
11
11
|
teamId: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Send Chat Message",
|
|
6
6
|
description: "Send a message to a team's chat. [See the docs here](https://docs.microsoft.com/en-us/graph/api/chat-post-messages?view=graph-rest-1.0&tabs=http)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
props: {
|
|
10
10
|
microsoftTeams,
|
|
11
11
|
chatId: {
|
package/microsoft_teams.app.mjs
CHANGED
|
@@ -34,7 +34,8 @@ export default {
|
|
|
34
34
|
label: "Channel",
|
|
35
35
|
description: "Team Channel",
|
|
36
36
|
async options({
|
|
37
|
-
teamId,
|
|
37
|
+
teamId,
|
|
38
|
+
prevContext,
|
|
38
39
|
}) {
|
|
39
40
|
const response = prevContext.nextLink
|
|
40
41
|
? await this.makeRequest({
|
|
@@ -58,69 +59,69 @@ export default {
|
|
|
58
59
|
chat: {
|
|
59
60
|
type: "string",
|
|
60
61
|
label: "Chat",
|
|
61
|
-
description: "
|
|
62
|
-
async options({
|
|
63
|
-
|
|
62
|
+
description: "Select a chat (type to search by participant names)",
|
|
63
|
+
async options({
|
|
64
|
+
prevContext, query,
|
|
65
|
+
}) {
|
|
66
|
+
let path = "/chats?$expand=members";
|
|
67
|
+
path += "&$top=20";
|
|
68
|
+
|
|
69
|
+
if (query) {
|
|
70
|
+
path += `&$search="${query}"`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const response = prevContext?.nextLink
|
|
64
74
|
? await this.makeRequest({
|
|
65
75
|
path: prevContext.nextLink,
|
|
66
76
|
})
|
|
67
|
-
: await this.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const options = [];
|
|
77
|
+
: await this.makeRequest({
|
|
78
|
+
path,
|
|
79
|
+
});
|
|
71
80
|
|
|
72
81
|
this._userCache = this._userCache || new Map();
|
|
82
|
+
const options = [];
|
|
73
83
|
|
|
74
84
|
for (const chat of response.value) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
let displayName = member.displayName || this._userCache.get(cacheKey);
|
|
85
|
+
let members = chat.members.map((member) => ({
|
|
86
|
+
displayName: member.displayName,
|
|
87
|
+
wasNull: !member.displayName,
|
|
88
|
+
userId: member.userId,
|
|
89
|
+
email: member.email,
|
|
90
|
+
}));
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (userMessage?.from?.user?.displayName) {
|
|
89
|
-
displayName = userMessage.from.user.displayName;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
+
if (members.some((member) => !member.displayName)) {
|
|
93
|
+
try {
|
|
94
|
+
const messages = await this.makeRequest({
|
|
95
|
+
path: `/chats/${chat.id}/messages?$top=10&$orderby=createdDateTime desc`,
|
|
96
|
+
});
|
|
92
97
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
displayName = userDetails.displayName;
|
|
98
|
+
const nameMap = new Map();
|
|
99
|
+
messages.value.forEach((msg) => {
|
|
100
|
+
if (msg.from?.user?.id && msg.from?.user?.displayName) {
|
|
101
|
+
nameMap.set(msg.from.user.id, msg.from.user.displayName);
|
|
98
102
|
}
|
|
103
|
+
});
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
displayName = "Unknown User";
|
|
108
|
-
}
|
|
109
|
-
console.error(`Failed to fetch user details for ${member.userId}:`, err);
|
|
110
|
-
}
|
|
105
|
+
members = members.map((member) => ({
|
|
106
|
+
...member,
|
|
107
|
+
displayName: member.displayName || nameMap.get(member.userId) || member.email || "Unknown User",
|
|
108
|
+
}));
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.error(`Failed to fetch messages for chat ${chat.id}:`, err);
|
|
111
111
|
}
|
|
112
|
+
}
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
? `${displayName} (External)`
|
|
116
|
-
: displayName;
|
|
117
|
-
}));
|
|
114
|
+
const memberNames = members.map((member) =>
|
|
115
|
+
member.wasNull
|
|
116
|
+
? `${member.displayName} (External)`
|
|
117
|
+
: member.displayName);
|
|
118
118
|
|
|
119
119
|
options.push({
|
|
120
|
-
label:
|
|
120
|
+
label: memberNames.join(", "),
|
|
121
121
|
value: chat.id,
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
+
|
|
124
125
|
return {
|
|
125
126
|
options,
|
|
126
127
|
context: {
|
|
@@ -128,6 +129,7 @@ export default {
|
|
|
128
129
|
},
|
|
129
130
|
};
|
|
130
131
|
},
|
|
132
|
+
useQuery: true,
|
|
131
133
|
},
|
|
132
134
|
channelDisplayName: {
|
|
133
135
|
type: "string",
|
|
@@ -168,7 +170,10 @@ export default {
|
|
|
168
170
|
});
|
|
169
171
|
},
|
|
170
172
|
async makeRequest({
|
|
171
|
-
method,
|
|
173
|
+
method,
|
|
174
|
+
path,
|
|
175
|
+
params = {},
|
|
176
|
+
content,
|
|
172
177
|
}) {
|
|
173
178
|
const api = this.client().api(path);
|
|
174
179
|
|
|
@@ -192,22 +197,6 @@ export default {
|
|
|
192
197
|
: reduction;
|
|
193
198
|
}, api);
|
|
194
199
|
},
|
|
195
|
-
async getAuthenticatedUserTenant() {
|
|
196
|
-
try {
|
|
197
|
-
const { value } = await this.client()
|
|
198
|
-
.api("/organization")
|
|
199
|
-
.get();
|
|
200
|
-
|
|
201
|
-
if (!value || value.length === 0) {
|
|
202
|
-
throw new Error("No organization found");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return value[0].id;
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error("Failed to fetch tenant ID:", error);
|
|
208
|
-
throw new Error("Unable to determine tenant ID");
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
200
|
async authenticatedUserId() {
|
|
212
201
|
const { id } = await this.client()
|
|
213
202
|
.api("/me")
|
|
@@ -231,7 +220,8 @@ export default {
|
|
|
231
220
|
});
|
|
232
221
|
},
|
|
233
222
|
async createChannel({
|
|
234
|
-
teamId,
|
|
223
|
+
teamId,
|
|
224
|
+
content,
|
|
235
225
|
}) {
|
|
236
226
|
return this.makeRequest({
|
|
237
227
|
method: "post",
|
|
@@ -240,7 +230,9 @@ export default {
|
|
|
240
230
|
});
|
|
241
231
|
},
|
|
242
232
|
async sendChannelMessage({
|
|
243
|
-
teamId,
|
|
233
|
+
teamId,
|
|
234
|
+
channelId,
|
|
235
|
+
content,
|
|
244
236
|
}) {
|
|
245
237
|
return this.makeRequest({
|
|
246
238
|
method: "post",
|
|
@@ -249,7 +241,8 @@ export default {
|
|
|
249
241
|
});
|
|
250
242
|
},
|
|
251
243
|
async sendChatMessage({
|
|
252
|
-
chatId,
|
|
244
|
+
chatId,
|
|
245
|
+
content,
|
|
253
246
|
}) {
|
|
254
247
|
return this.makeRequest({
|
|
255
248
|
method: "post",
|
|
@@ -279,7 +272,8 @@ export default {
|
|
|
279
272
|
.get();
|
|
280
273
|
},
|
|
281
274
|
async listChannelMessages({
|
|
282
|
-
teamId,
|
|
275
|
+
teamId,
|
|
276
|
+
channelId,
|
|
283
277
|
}) {
|
|
284
278
|
return this.makeRequest({
|
|
285
279
|
path: `/teams/${teamId}/channels/${channelId}/messages/delta`,
|
package/package.json
CHANGED
package/sources/common/base.mjs
CHANGED
|
@@ -6,8 +6,6 @@ export default {
|
|
|
6
6
|
microsoftTeams,
|
|
7
7
|
db: "$.service.db",
|
|
8
8
|
timer: {
|
|
9
|
-
label: "Polling interval",
|
|
10
|
-
description: "Pipedream will poll the YouTube API on this schedule",
|
|
11
9
|
type: "$.interface.timer",
|
|
12
10
|
default: {
|
|
13
11
|
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|