Skip to content

Commit

Permalink
Merge pull request #2352 from intuit/slack-channel
Browse files Browse the repository at this point in the history
allow channel to be passed to slack plugin
  • Loading branch information
hipstersmoothie committed Apr 19, 2023
2 parents 27e79d7 + a599a1d commit e8724de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/slack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ const basePluginOptions = t.partial({
iconEmoji: t.string,
});

const urlPluginOptions = t.intersection([
t.partial({
/** Channels to post */
channel: t.string,
}),
basePluginOptions,
]);

const appPluginOptions = t.intersection([
t.interface({
/** Marks we are gonna use app auth */
Expand All @@ -225,7 +233,7 @@ const appPluginOptions = t.intersection([
basePluginOptions,
]);

const pluginOptions = t.union([basePluginOptions, appPluginOptions]);
const pluginOptions = t.union([urlPluginOptions, appPluginOptions]);

export type ISlackPluginOptions = t.TypeOf<typeof pluginOptions>;

Expand Down Expand Up @@ -450,6 +458,7 @@ export default class SlackPlugin implements IPlugin {
link_names: true,
// If not in app auth only one message is constructed
blocks: messages[0],
channel: this.options.channel,
}),
headers: { "Content-Type": "application/json" },
agent,
Expand Down

0 comments on commit e8724de

Please sign in to comment.