Skip to content

toniktoo/Sentry-Mattermost-Adapter

Repository files navigation

Sentry to Mattermost Adapter

Sentry Mattermost Express.js TypeScript License

A small application built in TypeScript for integrating Sentry with Mattermost. This adapter reformats Sentry event messages to be compatible with Mattermost webhooks, enabling smooth, automated notifications and updates from Sentry to your Mattermost chats.

Table of Contents

Problem Statement

  • Sentry does not provide direct integration with Mattermost.
  • Mattermost webhooks do not support the payload format sent by Sentry.

Solution Overview

This adapter serves as an intermediary service to solve the above issues:

  1. The adapter receives an event from Sentry.
  2. It converts the message to a format compatible with Mattermost.
  3. It sends the formatted message to a specified Mattermost channel using a webhook.

Technologies Used

  • TypeScript
  • Express
  • Winston
  • Axios

Installation

To get started, clone the repository and install dependencies.

git clone https://github.com/your-username/adapter-mattermost-sentry.git
cd adapter-mattermost-sentry
npm install

Usage

Configuration

  1. Set up environment variables by creating a .env file in the root directory:
    PORT=4045
    URL_WEBHOOK=https://mattermost.example.com/hooks/your-webhook-url
    
  2. Adjust PORT and URL_WEBHOOK as necessary.

Development

For local development:

npm run dev

This will start the server using nodemon on the specified port in ./src/app.ts.

Production Deployment

  1. Install pm2 globally for process management:
    npm install pm2 -g
  2. Start the application in production mode:
    npm run start

To view running processes managed by pm2:

pm2 list

Logging

Logs are stored in the ./logs directory after the application starts.

  • all.log - Contains all log messages.
  • error.log - Contains only error messages.

Contributing

We welcome contributions! Here’s how you can help:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix:
    git checkout -b feature-name
  3. Make your changes and commit them with descriptive messages.
  4. Push to your branch:
    git push origin feature-name
  5. Open a pull request and describe your changes.

Please ensure your code follows existing patterns and includes necessary tests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published