mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-22 03:56:49 +03:00
22 lines
611 B
JavaScript
22 lines
611 B
JavaScript
import * as Environment from "~/node_common/environment";
|
|
import * as Strings from "~/common/strings";
|
|
import * as Logging from "~/common/logging";
|
|
|
|
import { IncomingWebhook } from "@slack/webhook";
|
|
|
|
// NOTE(jim): #fil-slate-social
|
|
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) {
|
|
Logging.error("SLACK_MESSAGE_FAILURE", message);
|
|
}
|
|
};
|