- Print
- DarkLight
- PDF
Sentry
- Print
- DarkLight
- PDF
Add Sentry notifications via a new WebHook in Rocket.Chat This script works for the sentry.com and self-hosted versions.
Follow all instructions for creating an incoming webhook.
Login to your project on Sentry and go to Settings > Developer Settings > Create New Integration > Internal Integration > Next.
Give your integration a name, copy the webhook URL generated, and paste it into the Webhook URL field.
Turn on Alert Action Rule. This is important so that your incoming webhook URL is notified when there is an event on Sentry.
Enter appropriate values for the Permissions section and select the types of events to notify your incoming webhook.
Click Save Changes.
Clone Sentry's example project and follow the instructions in the repository to run the backend and frontend to test and trigger different event types.
The script below gets different attributes of a Sentry event and sends it as a message to your configured channel when creating the webhook.
class Script {
process_incoming_request({request}) {
// console is a global helper to improve debug
// console.log(request.content);
return {
content: {
text: "Error in project *" + request.content.project + "\n*Message:* " +
request.content.message + "\n*Culprit:* " + request.content.culprit
}
};
}
}
Use the console.log(request.content)
line to debug the JSON content posted by Sentry.