apps/gateway/src/services/providers/notifications.ts
Metadata
- Purpose: Gateway service module implementing business logic or integrations.
- Domain:
applications - Language:
ts - Bytes: 1594
- Lines: 61
- Content hash (short):
b95d86f9 - Source (start): apps/gateway/src/services/providers/notifications.ts:1
- Source (end): apps/gateway/src/services/providers/notifications.ts:61
Indexed Symbols
sendNotificationTest(line 17, function) - Implements send notification test for service-layer operations.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { env } from "../../config/env.js";
import { resolveSecretValue } from "../runtime-config.js";
type NotificationTestInput = {
workspaceId: string;
channel: "slack" | "email" | "teams";
target: string;
message?: string;
};
const channelEndpointEnvMap = {
slack: "SLACK_WEBHOOK_URL",
email: "EMAIL_TEST_ENDPOINT",
teams: "TEAMS_WEBHOOK_URL"
} as const;
export async function sendNotificationTest(input: NotificationTestInput): Promise<{ channel: string; delivered: boolean; details?: unknown }> {
const endpointEnv = channelEndpointEnvMap[input.channel];
const endpoint = await resolveSecretValue({
scopeType: "workspace",
workspaceId: input.workspaceId,
key: endpointEnv,
fallbackEnv: endpointEnv
});