mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-21 08:01:33 +03:00
20 lines
547 B
JavaScript
20 lines
547 B
JavaScript
import * as Environment from "~/node_common/environment";
|
|
import * as Strings from "~/common/strings";
|
|
|
|
import { IncomingWebhook } from "@slack/webhook";
|
|
|
|
const url = `https://hooks.slack.com/services/${Environment.SOCIAL_SLACK_WEBHOOK_KEY}`;
|
|
const webhook = new IncomingWebhook(url);
|
|
|
|
export const sendSlackMessage = (message) => {
|
|
if (Strings.isEmpty(Environment.SOCIAL_SLACK_WEBHOOK_KEY)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
webhook.send({ text: message });
|
|
} catch (e) {
|
|
console.log({ decorator: "SLACK_MESSAGE_FAILURE", message });
|
|
}
|
|
};
|