mirror of
https://github.com/Dannecron/hello-slack-bot.git
synced 2025-12-25 16:12:34 +03:00
13 lines
300 B
JavaScript
13 lines
300 B
JavaScript
module.exports = function (req, res, next) {
|
|
var userName = req.body.user_name;
|
|
var botPayload = {
|
|
text : 'Hello, ' + userName + '!'
|
|
};
|
|
|
|
// avoid infinite loop
|
|
if (userName !== 'slackbot') {
|
|
return res.status(200).json(botPayload);
|
|
} else {
|
|
return res.status(200).end();
|
|
}
|
|
} |