n8n-nodes-base
Version:
Base nodes of n8n
258 lines (253 loc) • 8.35 kB
text/typescript
/**
* Slack Node - Version 2
* Discriminator: resource=message, operation=post
*/
interface Credentials {
slackApi: CredentialReference;
slackOAuth2Api: CredentialReference;
}
export type SlackV2MessagePostParams = {
resource: 'message';
operation: 'post';
authentication?: 'accessToken' | 'oAuth2' | Expression<string>;
/**
* Send Message To
*/
select?: 'channel' | 'user' | Expression<string>;
/**
* The Slack channel to send to
* @displayOptions.show { select: ["channel"] }
* @default {"mode":"list","value":""}
*/
channelId?: { __rl: true; mode: 'list' | 'id' | 'name' | 'url'; value: string; cachedResultName?: string };
/**
* User
* @displayOptions.show { select: ["user"] }
* @default {"mode":"list","value":""}
*/
user?: { __rl: true; mode: 'list' | 'id' | 'username'; value: string; cachedResultName?: string };
/**
* Whether to send a simple text message, or use Slack’s Blocks UI builder for more sophisticated messages that include form fields, sections and more
* @default text
*/
messageType?: 'text' | 'block' | 'attachment' | Expression<string>;
/**
* The message text to post. Supports <a href="https://api.slack.com/reference/surfaces/formatting">markdown</a> by default - this can be disabled in "Options".
* @displayOptions.show { messageType: ["text"] }
*/
text?: string | Expression<string> | PlaceholderValue;
/**
* Enter the JSON output from Slack's visual Block Kit Builder here. You can then use expressions to add variable content to your blocks. To create blocks, use <a target='_blank' href='https://app.slack.com/block-kit-builder'>Slack's Block Kit Builder</a>
* @hint To create blocks, use <a target='_blank' href='https://app.slack.com/block-kit-builder'>Slack's Block Kit Builder</a>
* @displayOptions.show { messageType: ["block"] }
*/
blocksUi?: string | Expression<string> | PlaceholderValue;
/**
* Attachments
* @displayOptions.show { messageType: ["attachment"] }
* @default {}
*/
attachments?: {
/** Required plain-text summary of the attachment
*/
fallback?: string | Expression<string> | PlaceholderValue;
/** Text
*/
text?: string | Expression<string> | PlaceholderValue;
/** Title
*/
title?: string | Expression<string> | PlaceholderValue;
/** Title Link
*/
title_link?: string | Expression<string> | PlaceholderValue;
/** Color of the line left of text
* @default #ff0000
*/
color?: string | Expression<string>;
/** Text which appears before the message block
*/
pretext?: string | Expression<string> | PlaceholderValue;
/** Name that should appear
*/
author_name?: string | Expression<string> | PlaceholderValue;
/** Author Link
*/
author_link?: string | Expression<string> | PlaceholderValue;
/** Icon which should appear for the user
*/
author_icon?: string | Expression<string> | PlaceholderValue;
/** Image URL
*/
image_url?: string | Expression<string> | PlaceholderValue;
/** Thumbnail URL
*/
thumb_url?: string | Expression<string> | PlaceholderValue;
/** Text of footer to add
*/
footer?: string | Expression<string> | PlaceholderValue;
/** Icon which should appear next to footer
*/
footer_icon?: string | Expression<string> | PlaceholderValue;
/** Timestamp of the message to post
* @default 0
*/
ts?: number | Expression<number>;
/** Fields to add to message
* @default {}
*/
fields?: {
/** Item
*/
item?: Array<{
/** Title
*/
title?: string | Expression<string> | PlaceholderValue;
/** Value
*/
value?: string | Expression<string> | PlaceholderValue;
/** Whether items can be displayed next to each other
* @default true
*/
short?: boolean | Expression<boolean>;
}>;
};
};
/**
* Other options to set
* @default {}
*/
otherOptions?: {
/** Whether to append a link to this workflow at the end of the message. This is helpful if you have many workflows sending Slack messages.
* @default true
*/
includeLinkToWorkflow?: boolean | Expression<boolean>;
/** Set an image or an emoji as the Profile Photo (avatar) of the bot sending the message. Will not be used if sending message as a user.
* @default {"imageValues":[{"profilePhotoType":""}]}
*/
botProfile?: {
/** Add Bot Profile Photo
*/
imageValues?: {
/** Profile Photo Type
*/
profilePhotoType?: 'image' | 'emoji' | Expression<string>;
/** Only used if sending message as a bot. Use emoji codes like +1, not an actual emoji like 👍. <a target="_blank" href=" https://www.webfx.com/tools/emoji-cheat-sheet/">List of common emoji codes</a>
* @displayOptions.show { profilePhotoType: ["emoji"] }
*/
icon_emoji?: string | Expression<string> | PlaceholderValue;
/** Only used if sending message as a bot
* @displayOptions.show { profilePhotoType: ["image"] }
*/
icon_url?: string | Expression<string> | PlaceholderValue;
};
};
/** Whether to turn @users and #channels in message text into clickable links
* @default false
*/
link_names?: boolean | Expression<boolean>;
/** Provide another message's Timestamp value to make this message a reply
* @default {}
*/
thread_ts?: {
/** Reply to a Message
*/
replyValues?: {
/** Message timestamps are included in output data of Slack nodes, abbreviated to ts
*/
thread_ts?: number | Expression<number>;
/** Whether the reply should be made visible to everyone in the channel or conversation
* @default false
*/
reply_broadcast?: boolean | Expression<boolean>;
};
};
/** Whether to use Slack Markdown to format the message
* @default true
*/
mrkdwn?: boolean | Expression<boolean>;
/** Whether to enable unfurling of primarily text-based content
* @default false
*/
unfurl_links?: boolean | Expression<boolean>;
/** Whether to disable unfurling of media content
* @default true
*/
unfurl_media?: boolean | Expression<boolean>;
/** Whether to send a temporary, ephemeral message
* @displayOptions.show { /select: ["channel"] }
* @default {}
*/
ephemeral?: {
/** Send as Ephemeral Message
*/
ephemeralValues?: {
/** User to Send
* @default {"mode":"list","value":""}
*/
user?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/** Whether to send a temporary, ephemeral message
* @default true
*/
ephemeral?: boolean | Expression<boolean>;
};
};
/** Whether to send a temporary, ephemeral message
* @displayOptions.show { /select: ["user"] }
* @default true
*/
ephemeral?: boolean | Expression<boolean>;
/** The message will be sent from this username (i.e. as if this individual sent the message). Add chat:write.customize scope on Slack API
* @displayOptions.show { /authentication: ["accessToken"] }
*/
sendAsUser?: string | Expression<string> | PlaceholderValue;
};
};
export type SlackV2MessagePostOutput = {
channel?: string;
message?: {
app_id?: string;
blocks?: Array<{
block_id?: string;
elements?: Array<{
elements?: Array<{
style?: {
italic?: boolean;
};
text?: string;
type?: string;
url?: string;
}>;
type?: string;
}>;
type?: string;
}>;
bot_id?: string;
bot_profile?: {
app_id?: string;
deleted?: boolean;
icons?: {
image_36?: string;
image_48?: string;
image_72?: string;
};
id?: string;
name?: string;
team_id?: string;
updated?: number;
};
team?: string;
text?: string;
ts?: string;
type?: string;
user?: string;
};
message_timestamp?: string;
ok?: boolean;
};
export type SlackV2MessagePostNode = {
type: 'n8n-nodes-base.slack';
version: 2;
credentials?: Credentials;
config: NodeConfig<SlackV2MessagePostParams>;
output?: Items<SlackV2MessagePostOutput>;
};