@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
52 lines (51 loc) • 1.33 kB
TypeScript
import { DebugLogLevel } from '..';
export interface SlackMessage {
username?: string;
channel?: string;
icon_url?: string;
icon_emoji?: string;
text: string;
level?: DebugLogLevel;
attachments?: SlackMessageAttachment[];
/**
* Keys-values will be rendered as MessageAttachment with Fields
*/
kv?: Record<string, any>;
}
export interface SlackAttachmentField {
title: string;
value: string;
short?: boolean;
}
export interface SlackMessageAttachment {
fallback?: string;
color?: 'good' | 'warning' | 'danger' | string;
pretext?: string;
author_name?: string;
author_link?: string;
author_icon?: string;
title?: string;
title_link?: string;
text?: string;
fields?: SlackAttachmentField[];
image_url?: string;
thumb_url?: string;
footer?: string;
footer_icon?: string;
ts?: number;
callback_id?: string;
mrkdwn_in?: ('pretext' | 'text' | 'fields')[];
}
export interface SlackSharedServiceCfg {
/**
* Undefined means slack is disabled.
*/
webhookUrl?: string;
defaults?: Partial<SlackMessage>;
/**
* Override channel when msg.level is set.
* key: DebugLogLevel
* value: channel name to send message to
*/
channelByLevel?: Record<string, string | undefined>;
}