mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-12 05:58:36 +00:00
* Feat: v2 * feat: add chat functionality * First cut: integrations * Feat: add conversation API * Enhance conversation handling and memory management * Feat: added conversation --------- Co-authored-by: Manoj K <saimanoj58@gmail.com>
33 lines
866 B
TypeScript
33 lines
866 B
TypeScript
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;
|
|
}),
|
|
);
|
|
}
|