Spaces:
Runtime error
Runtime error
File size: 866 Bytes
5b12974 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import axios from 'axios';
export interface ActivityCreate {
url: string;
text: string;
sourceId: string;
sourceURL: string;
integrationAccountId: string;
}
export async function getSlackTeamInfo(slackTeamId: string, accessToken: string) {
const response = await axios.get(`https://slack.com/api/team.info?team=${slackTeamId}`, {
headers: {
'Content-Type': 'application/json; charset=utf-8',
Authorization: `Bearer ${accessToken}`,
},
});
return response.data;
}
export async function getUserDetails(userIds: string[], accessToken: string) {
return await Promise.all(
userIds.map(async (userId) => {
const userResponse = await axios.get(`https://slack.com/api/users.info?user=${userId}`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
return userResponse.data.user;
}),
);
}
|