Rocket.Chat Version: 0.50.1
Running Instances: 1
DB Replicaset OpLog:
Node Version: v4.7.1
Hello,
I am relatively new to Rocket.Chat, but playing around with it for some weeks. Month ago, I wrote a outgoing webhook integraton for Slack. Now I want to integrate it into rocket.chat, but it didn't worked. After analyzing I found out, that the body of the POST is completely empty:
body: {},
route: Route { path: '/', stack: [ [Object] ], methods: { post: true } } }
Instead the body should have the following form:
body: { message_id: 'XXXXXXXXX', token: 'XXXXXXXXXX', channel_id: 'GENERAL', channel_name: 'general', timestamp: Wed Feb 08 2017 01:37:48 GMT+0000 (UTC), user_id: 'XXXXX', user_name: 'XXXXX', text: 'MyText', bot: false, trigger_word: 'MyWord' }
Please help. :)
Oh man. I found my issue. My Nodejs REST-Client was not able to decode. I added the JSON support by following code into my nodejs rest app. This seems to be the difference between Slack and Rocket.Chat. Slack requires bodyParser.urlencoded
.
var bodyParser = require('body-parser')
app.use( bodyParser.json() ); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
Shouldn't rocketchat be slack API compatible? If that is the goal, then this should be an issue.
Most helpful comment
Oh man. I found my issue. My Nodejs REST-Client was not able to decode. I added the JSON support by following code into my nodejs rest app. This seems to be the difference between Slack and Rocket.Chat. Slack requires
bodyParser.urlencoded
.