Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Rollbar Rocketchat integration #2088

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions guides/administrator-guides/integrations/rollbar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Rollbar

Add Rollbar notifications via a new WebHook in Rocket.Chat This script works for the Rollbar.com

1. In Rocket.Chat go to "Administration"->"Integrations" and create "New Integration"
2. Choose Incoming WebHook
3. Follow all instructions like Enable, give it a name, link to channel etc. Bonus: add [https://avatars.io/twitter/rollbar/medium](https://avatars.io/twitter/rollbar/medium) as Avatar URL
4. Set "Enable Script" to true and enter the javascript in the "Script" box
5. Press Save changes and copy the _Webhook URL_ \(added just below the script box\)
6. Go to your Rollbar project, ie. [https://rollbar.com/](https://rollbar.com/)< organization >/< project >/settings/notifications/webhook/ and enable the "WebHook" integration. It's in the project "settings" under Integrations and then Notifications. A WebHook integration is added there when enabled.
7. Add a new webhook by pasting the Rocket.Chat url you've copied in step 5 in the "URLs" textarea \(1 URL per line\) and press the Enable Webhook Integration button
8. Test the webhook with the "Send Test Notification" button in Rollbar, a Test Results box should appear below, with more info \(success or failure\)

Paste this in javascript in the "Script" textarea on Rocket.Chat WebHook settings

```javascript
class Script {

process_incoming_request({ request }) {
// console is a global helper to improve debug
console.log(request.content);

return {
content: {
text: "(" + request.content.event_name + ") \n*" + request.content.data.item.title + "* \n*Environment:* "+ request.content.data.item.environment,
}
};

return {
error: {
success: false,
message: 'Error example'
}
};
}
}
```

Use the console.log\(request.content\) line to debug the json content, posted by Rollbar.