Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outgoing Webhook sends empty body #5946

Closed
sscholl opened this issue Feb 8, 2017 · 2 comments
Closed

Outgoing Webhook sends empty body #5946

sscholl opened this issue Feb 8, 2017 · 2 comments

Comments

@sscholl
Copy link
Contributor

sscholl commented Feb 8, 2017

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

@sscholl
Copy link
Contributor Author

sscholl commented Feb 8, 2017

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

@sscholl sscholl closed this as completed Feb 8, 2017
@m2rt
Copy link

m2rt commented Aug 14, 2017

Shouldn't rocketchat be slack API compatible? If that is the goal, then this should be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants