Update language on /outline help text
Update Slack hooks to use zod validation closes #5768
This commit is contained in:
44
plugins/slack/server/api/schema.ts
Normal file
44
plugins/slack/server/api/schema.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const HooksUnfurlSchema = z.object({
|
||||
body: z
|
||||
.object({
|
||||
challenge: z.string(),
|
||||
})
|
||||
.or(
|
||||
z.object({
|
||||
token: z.string(),
|
||||
event: z.object({
|
||||
channel: z.string(),
|
||||
message_ts: z.string(),
|
||||
links: z.array(
|
||||
z.object({
|
||||
url: z.string(),
|
||||
})
|
||||
),
|
||||
user: z.string(),
|
||||
}),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
export type HooksUnfurlReq = z.infer<typeof HooksUnfurlSchema>;
|
||||
|
||||
export const HooksSlackCommandSchema = z.object({
|
||||
body: z.object({
|
||||
token: z.string(),
|
||||
team_id: z.string(),
|
||||
user_id: z.string(),
|
||||
text: z.string().optional().default(""),
|
||||
}),
|
||||
});
|
||||
|
||||
export type HooksSlackCommandReq = z.infer<typeof HooksSlackCommandSchema>;
|
||||
|
||||
export const HooksInteractiveSchema = z.object({
|
||||
body: z.object({
|
||||
payload: z.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
export type HooksInteractiveReq = z.infer<typeof HooksInteractiveSchema>;
|
||||
Reference in New Issue
Block a user