Building Slack integration

This commit is contained in:
KS Jannette
2026-08-02 06:13:01 -04:00
parent dae256f6c6
commit b607ee9121
16 changed files with 2351 additions and 8 deletions

View File

@@ -3,7 +3,8 @@ import type {
ProviderSlug,
SignatureScheme,
} from '../types/integration.js';
import { normalizeLinear, normalizeRest } from './normalizers.js';
import { normalizeLinear, normalizeRest, normalizeSlack } from './normalizers.js';
import { enrichSlackDelivery } from '../services/slack.service.js';
export type ChallengeResponse = { status: number; body: unknown };
@@ -22,6 +23,15 @@ export type ProviderConfig = {
* infrastructure; the payload mapping belongs to the integration itself.
*/
normalize?: (payload: unknown) => NormalizedDelivery;
/**
* Runs after the ack, inside the retry queue, so it may make network calls.
* Receives the raw payload because some providers deliver a reference rather
* than content: a Slack reaction names a message without including its text.
*/
enrich?: (
delivery: NormalizedDelivery,
payload: unknown
) => Promise<NormalizedDelivery>;
oauth?: {
authorizeUrl: string;
tokenUrl: string;
@@ -63,6 +73,8 @@ export const providers: Record<ProviderSlug, ProviderConfig> = {
timestampHeader: 'x-slack-request-timestamp',
secretEnvVar: 'SLACK_SIGNING_SECRET',
challenge: slackChallenge,
normalize: normalizeSlack,
enrich: enrichSlackDelivery,
oauth: {
authorizeUrl: 'https://slack.com/oauth/v2/authorize',
tokenUrl: 'https://slack.com/api/oauth.v2.access',