|
@@ -9,6 +9,7 @@ const urljoin = require('url-join');
|
|
|
|
|
|
|
|
module.exports = function(crowi) {
|
|
module.exports = function(crowi) {
|
|
|
const Slack = require('slack-node');
|
|
const Slack = require('slack-node');
|
|
|
|
|
+ const { WebClient } = require('@slack/web-api');
|
|
|
const { configManager } = crowi;
|
|
const { configManager } = crowi;
|
|
|
|
|
|
|
|
const slack = {};
|
|
const slack = {};
|
|
@@ -30,12 +31,12 @@ module.exports = function(crowi) {
|
|
|
|
|
|
|
|
const postWithWebApi = function(messageObj) {
|
|
const postWithWebApi = function(messageObj) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
- const client = new Slack(configManager.getConfig('notification', 'slack:token'));
|
|
|
|
|
|
|
+ const client = new WebClient(configManager.getConfig('notification', 'slack:token'));
|
|
|
// stringify attachments
|
|
// stringify attachments
|
|
|
if (messageObj.attachments != null) {
|
|
if (messageObj.attachments != null) {
|
|
|
messageObj.attachments = JSON.stringify(messageObj.attachments);
|
|
messageObj.attachments = JSON.stringify(messageObj.attachments);
|
|
|
}
|
|
}
|
|
|
- client.api('chat.postMessage', messageObj, (err, res) => {
|
|
|
|
|
|
|
+ client.chat.postMessage(messageObj, (err, res) => {
|
|
|
if (err) {
|
|
if (err) {
|
|
|
debug('Post error', err, res);
|
|
debug('Post error', err, res);
|
|
|
debug('Sent data to slack is:', messageObj);
|
|
debug('Sent data to slack is:', messageObj);
|