|
@@ -273,14 +273,11 @@ module.exports = (crowi) => {
|
|
|
router.post('/test-notification-to-slack-work-space', async(req, res) => {
|
|
router.post('/test-notification-to-slack-work-space', async(req, res) => {
|
|
|
const slackBotToken = crowi.configManager.getConfig('crowi', 'slackbot:token');
|
|
const slackBotToken = crowi.configManager.getConfig('crowi', 'slackbot:token');
|
|
|
|
|
|
|
|
- if (slackBotToken === null) {
|
|
|
|
|
- // i18n
|
|
|
|
|
- return 'Bot User OAuth Token is not setup.';
|
|
|
|
|
|
|
+ if (slackBotToken != null) {
|
|
|
|
|
+ this.client = new WebClient(slackBotToken, { logLevel: LogLevel.DEBUG });
|
|
|
|
|
+ logger.debug('SlackBot: setup is done');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.client = new WebClient(slackBotToken, { logLevel: LogLevel.DEBUG });
|
|
|
|
|
- logger.debug('SlackBot: setup is done');
|
|
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
this.client.chat.postMessage({
|
|
this.client.chat.postMessage({
|
|
|
channel: '#general',
|
|
channel: '#general',
|
|
@@ -293,9 +290,10 @@ module.exports = (crowi) => {
|
|
|
return res.apiv3({ message });
|
|
return res.apiv3({ message });
|
|
|
}
|
|
}
|
|
|
catch (error) {
|
|
catch (error) {
|
|
|
- const msg = 'Error occured in testing to notify slack work space';
|
|
|
|
|
|
|
+ console.log(error);
|
|
|
|
|
+ // const msg = 'Error occured in testing to notify slack work space';
|
|
|
logger.error('Error', error);
|
|
logger.error('Error', error);
|
|
|
- return res.apiv3Err(new ErrorV3(msg, 'test-notify-slack-work-space-failed'), 500);
|
|
|
|
|
|
|
+ return res.apiv3Err(new ErrorV3(error, 'test-notify-slack-work-space-failed'), 500);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|