Files
calendar/packages/app-store/slackmessaging/lib/utils.ts
T
sean-brydonGitHubPeer Richelsenzomarskodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
c03ff0a543 Fixes slack verification and timeout errors (#2972)
* Fixing slack create event

* Fixes verify working 90% of the time :S

* Verify V2

* Fixing verify - not needed on interaction payload

* Fixing verifcation + response

* Fix verifcation

* DM user error/success

* Remove random 200

* Timeout return

* Adding Zod schema verification

* Added validations, cleanup

* Type fixes

* Update event.ts

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-11 22:30:52 +01:00

19 lines
551 B
TypeScript

import { WebClient } from "@slack/web-api";
import { z } from "zod";
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
export const getUserEmail = async (client: WebClient, userId: string) =>
(await client.users.info({ user: userId })).user?.profile?.email;
const slackAppKeysSchema = z.object({
client_id: z.string(),
client_secret: z.string(),
signing_secret: z.string(),
});
export const getSlackAppKeys = async () => {
const appKeys = await getAppKeysFromSlug("slack");
return slackAppKeysSchema.parse(appKeys);
};