Rocket.chat: Outgoing Webhook sends empty body

Created on 8 Feb 2017  路  2Comments  路  Source: RocketChat/Rocket.Chat

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. :)

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.

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
})); 

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sta-szek picture sta-szek  路  3Comments

amayer5125 picture amayer5125  路  3Comments

antn89 picture antn89  路  3Comments

Buzzele picture Buzzele  路  3Comments

Kiran-Rao picture Kiran-Rao  路  3Comments