-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Request Signing with Slack Signing Secret #1406
Conversation
Hi there-- I tried this in my code and the req.rawBody comes out as empty? Is this just me? nothing gets passed into it in the stream basically... |
Yes, You will have to add the following snippet just after you create var webserver = express();
webserver.use(function(req, res, next) {
req.rawBody = '';
req.on('data', function(chunk) {
req.rawBody += chunk;
});
next();
}); |
Thats what I did but for some reason my system must hate me.... |
my bad-- I put it in the wrong place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please make these docs changes in the new official docs repo, github.com/howdyai/botkit-docs
@@ -1488,6 +1488,15 @@ function Botkit(configuration) { | |||
botkit.config.port = port; | |||
|
|||
botkit.webserver = express(); | |||
botkit.webserver.use(function(req, res, next) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this same change to the slack starter kit? github.com/howdyai/botkit-starter-slack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
This is first cut.
Biggest caveat in the current approach is control of webserver. HMAC signature needs raw request body. So far the only way to do with express is via a middleware. That needs to be added before usual
handleWebhookPayload
.PS: You will have to add the following snippet just after you create
webserver
in your code.