[Rocket.Chat] Use Rocket.Chat Incoming WebHook to receive message from external thirdparty system
Webhooks
Rocket.Chat keep the workflow going by centralizing all your tools and touchpoints in one platform. Made for teamcollaboration, DevOps and customer engagement.
Rocket.Chat supports WebHooks to integrate tools and services you like into the platform. WebHooks are simple event-notifications via HTTP POST. This way any application implementing a WebHook is able to POST a message to a Rocket.Chat instance and much more.
With Scripts you can point any WebHook to Rocket.Chat and process the request to print customized messages, define the username and avatar of the user of the message and change the channel where the message will be posted or you can cancel the request to prevent undesired messages.
Available integrations:
-
Incoming WebHook → Let an external service send a request to Rocket.Chat to be processed.
-
Outgoing WebHook → Let Rocket.Chat trigger and optionally send a request to an external service and process the response.
By default the WebHooks is designed to post a message only. The message is part of a JSON structure, which has the same format as described in the API documentation on how to “Post a chat message”.
If you would like more power and control over various features of Rocket.Chat, aside from sending and receiving messages, take a look at Rocket.Chat Apps.
Incoming WebHook
Go to your Admin Panel -> Integrations -> Incoming, create a New Integration and select Incoming WebHook.
Configuration
These are required attributes:
-
Enabled
Enable or disable the webhook.
-
Name
You should name it to easily manage your integrations.
-
Post to Channel
Messages that are sent to the Incoming WebHook will be posted here.
Start with @ for user or # for channel. Eg: @john or #general
-
Post as
Choose the username that this integration will post as.
The user must already exist.
You will get the Example payload and Curl example to check webhook work after save it.
FAQs
Invalid href value provided
1 | curl -X POST -H 'Content-Type: application/json' --data '{"text":"Example message","attachments":[{"title":"Rocket.Chat","title_link":"https://rocketchat.examples.cloudolife.com/","text":"Rocket.Chat, the best open source chat","image_url":"/images/integration-attachment-example.png","color":"#764FA5"}]}' https://rocketchat.examples.cloudolife.com/hooks/SCmiSiecyBSTt8xab/LsWiaaPv8LvcYnydsb6QcNAdybfiY2X59icdcKrRWKs2GhKn |
After analysis error and retry, it turn out the image_url must be the valid and complete url. You can insert https://rocketchat.examples.cloudolife.com into image_url, such as:
1 | "image_url":"https://rocketchat.examples.cloudolife.com/images/integration-attachment-example.png","color":"#764FA5" |
Try it.
1 | curl -X POST -H 'Content-Type: application/json' --data '{"text":"Example message","attachments":[{"title":"Rocket.Chat","title_link":"https://rocket.chat","text":"Rocket.Chat, the best open source chat","image_url":"https://rocketchat.examples.cloudolife.com/images/integration-attachment-example.png","color":"#764FA5"}]}' https://rocketchat.examples.cloudolife.com/hooks/SCmiSiecyBSTt8xab/LsWiaaPv8LvcYnydsb6QcNAdybfiY2X59icdcKrRWKs2GhKn |
References
[2] Rocket.Chat - The Ultimate Communication Platform - https://rocket.chat/