Skip to content

VitaDairy/vtd-sentry-telegram-webhook

 
 

Repository files navigation

Sentry Telegram Webhook

Table of Contents

  1. Requirements
  2. Installation
  3. Environment variables
  4. Custom Integrations Configuration
  5. Running the app (normal)
  6. Running the app with docker (Recommended)
  7. License

Description: Webhook for Sentry which allows sending notification via Telegram messenger.

  • Github Repository: HERE.

  • Docker Hub: HERE.

  • The result will look like this:

Sentry Telegram Webhook Result

Requirements

  • Nodejs 18+ (recommend: 20+)

Installation

$ npm install

Environment variables

Name Is Require Type Note Value
LANGUAGE Yes string The language of message when send vi,en
TELEGRAM_BOT_TOKEN Yes string The token from @BotFather telegram check HERE for see how to get this.
TELEGRAM_GROUP_ID Yes number The id of your telegram group. You can use telegram API for check that through Postman. Check HERE for more detail. Normally, that start with -100...
TELEGRAM_TOPIC_ID No number The id of you topic if you enable Topics in group setting.
SENTRY_INTEGRATION_TOKEN Yes string The token that geneate by sentry. Check HERE for more detail.
SENTRY_ORGANIZATION_SLUG Yes string The organization slug in your sentry organization setting

Custom Integrations Configuration

  • Create the new integrations check HERE for more detail.

  • After you create the new integration then you need config some parts like below image

Note: <your-server-here.domain> is your webhooks server. If you are running locally. You can use Ngrok for generate this.

sentry internal integration config detail

  • And permission, that allow you trigger to you webhook.

sentry internal integration config permission

Running the app (normal)

  1. Clone .env.template file

    cp .env.template .env
  2. Edit .env file with your value.

    LANGUAGE=en
    TELEGRAM_BOT_TOKEN=<get from bot father>
    TELEGRAM_GROUP_ID=<your telegram group id or telegram channel id>
    TELEGRAM_TOPIC_ID=<not require - your telegram topic (when enable Topics in group setting)>
    SENTRY_INTEGRATION_TOKEN=<token in Custom Integrations in Sentry Setting>
    SENTRY_ORGANIZATION_SLUG=<your Sentry org slug>
  3. Run with npm

    # development
    $ npm run start
    
    # watch mode
    $ npm run start:dev
    
    # production mode
    $ npm run start:prod

Running the app with docker (Recommended)

Note: You don't need run npm install and setup nodejs.

  1. Run direct from docker hub: (don't need clone the repository)
  • Docker run - run direct with this command:

    docker run \
      -v /tmp/sentry-telegram-hook/logs:/code/logs \
      -p 3000:3000 \
      -e LANGUAGE=en \
      -e TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> \ #get from bot father 
      -e TELEGRAM_GROUP_ID=<TELEGRAM_GROUP_ID> \ #your telegram group id or telegram channel id 
      -e TELEGRAM_TOPIC_ID=<TELEGRAM_TOPIC_ID> \ #not require - your telegram topic when enable Topics in group setting 
      -e SENTRY_INTEGRATION_TOKEN=<SENTRY_INTEGRATION_TOKEN> \ #token in Custom Integrations in Sentry Setting 
      -e SENTRY_ORGANIZATION_SLUG=<SENTRY_ORGANIZATION_SLUG> \ #your Sentry org slug
      tuanngocptn/sentry-telegram-webhook:latest 
  • Docker compose - create the compose file with below information. More details HERE.

    Note: If you would like to use Gihub Container Registry (ghcr) instead of Docker hub. Please following THIS before run below docker compose

    services:
      app:
        # Docker hub package
        image: tuanngocptn/sentry-telegram-webhook:latest
        # Github container registry (ghcr)
        # image: ghcr.io/tuanngocptn/sentry-telegram-webhook:latest
        environment:
          - LANGUAGE=en
          - TELEGRAM_BOT_TOKEN=<get from bot father>
          - TELEGRAM_GROUP_ID=<your telegram group id or telegram channel id>
          - TELEGRAM_TOPIC_ID=<not require - your telegram topic (when enable Topics in group setting)>
          - SENTRY_INTEGRATION_TOKEN=<token in Custom Integrations in Sentry Setting>
          - SENTRY_ORGANIZATION_SLUG=<your Sentry org slug>
        ports:
          - 3000:3000
        volumes:
          - ./logs:/code/logs
  1. For running locally (debug):
  • Clone docker-compose-template.yml

    cp docker-compose-template.yml docker-compose.yml
  • Edit environment variables:

    environment:
      - LANGUAGE=en
      - TELEGRAM_BOT_TOKEN=<get from bot father>
      - TELEGRAM_GROUP_ID=<your telegram group id or telegram channel id>
      - TELEGRAM_TOPIC_ID=<not require - your telegram topic (when enable Topics in group setting)>
      - SENTRY_INTEGRATION_TOKEN=<token in Custom Integrations in Sentry Setting>
      - SENTRY_ORGANIZATION_SLUG=<your Sentry org slug>
  • Run with docker:

    docker compose up
  1. For running production (release):
  • Clone docker-compose-prod-template.yml

    cp docker-compose-prod-template.yml docker-compose.yml
  • Edit environment variables:

    environment:
      - LANGUAGE=en
      - TELEGRAM_BOT_TOKEN=<get from bot father>
      - TELEGRAM_GROUP_ID=<your telegram group id or telegram channel id>
      - TELEGRAM_TOPIC_ID=<not require - your telegram topic (when enable Topics in group setting)>
      - SENTRY_INTEGRATION_TOKEN=<token in Custom Integrations in Sentry Setting>
      - SENTRY_ORGANIZATION_SLUG=<your Sentry org slug>
  • Run with docker:

    docker compose up

License

Nest is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.6%
  • JavaScript 7.6%
  • Dockerfile 1.8%