RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.16k stars 10.38k forks source link

Incoming Webhook - Choosing Channel/User outside rocket? #10855

Open nv1t opened 6 years ago

nv1t commented 6 years ago

As far as i can see, the incoming webhooks are specified to a channel, or user on the rocket.chat side (this is forced behaviour). Is there any type of configuration, where i can let a client, which uses this hook, choose the channel/user to post to?

I tried using the method from different closed issues: #2705

The other method would be using the REST-API directly, which means i have to setup a custom user and use a normal authentication scheme in my application and use 2 calls for each message. Quite some overhead.

Currently running: 0.58.4 with commit 60fa18c32efaf0113035082475d60ef9050aaf3c

klainte commented 6 years ago

Hi, Edit: nevermind, it's possible (version 0.65.2), just had typo in my request. Working example: curl -X POST --show-error --data-urlencode 'payload= { "username": "user", "channel": "#random", "text": "Sample text" }' <webhook_url>

josep112 commented 5 years ago

Hi, I was able to send text and in case I want to send image as it would be?

TBG-FR commented 3 years ago

The documentation page explains that you can, at least for channels

A valid Rocket.Chat message can contain a text field that is the body of the message. When you redirect the message to a channel other than the one indicated by the Webhook token, you can specify a channel field, which accepts room id or, if prefixed with "#" or "@", channel name or user.