fix: huddle01 is not generating meeting link (#17417)

* fix: huddle01 not generating link

* update
This commit is contained in:
Anik Dhabal Babu
2024-10-31 04:59:34 +00:00
committed by GitHub
parent ced7f282a5
commit f649f8b78d
3 changed files with 10 additions and 20 deletions
+3
View File
@@ -386,6 +386,9 @@ UNKEY_ROOT_KEY=
# https://retellai.com
RETELL_AI_KEY=
# Used for the huddle01 integration
HUDDLE01_API_TOKEN=
# Used to disallow emails as being added as guests on bookings
BLACKLISTED_GUEST_EMAILS=
@@ -4,13 +4,18 @@ import type { CredentialPayload } from "@calcom/types/Credential";
import type { PartialReference } from "@calcom/types/EventManager";
import type { VideoApiAdapter } from "@calcom/types/VideoApiAdapter";
import { getHuddle01APIKey, getHuddle01Credential } from "../utils/storage";
import { getHuddle01Credential } from "../utils/storage";
const API_END_POINT = "https://platform-api.huddle01.workers.dev/api/v2/calendar";
const fetchHuddleAPI = async (userId: number) => {
const { identityToken } = await getHuddle01Credential(userId);
const { apiKey } = await getHuddle01APIKey();
const apiKey = process.env.HUDDLE01_API_TOKEN;
if (!apiKey) {
log.error("[Huddle01 Error] -> app key not found");
throw new Error("Huddle01 app key not found");
}
const headers = {
"x-api-key": apiKey,
@@ -49,21 +49,3 @@ export async function getHuddle01Credential(userId: number) {
return huddle01AppKeySchema.parse(credential?.key);
}
const huddle01APIKeySchema = z.object({
apiKey: z.string(),
});
export async function getHuddle01APIKey() {
const appCreds = await prisma.app.findFirst({
where: {
slug: "huddle01",
},
});
if (!appCreds) {
throw new Error("Huddle01 app credential not found");
}
return huddle01APIKeySchema.parse(appCreds?.keys);
}