Skip to content

AlexPokatilov/Harbor-Telegram-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harbor-Telegram-Bot

Build Lint CodeQL Released

Harbor event notifications for Telegram.

Release 2.3.0

Getting started

Pre-requirements

  • Harbor v2.0 - v2.7
  • Harbor ChartMuseum Extension
  • Create Telegram Bot with BotFather
  • Get Bot API Token
  • Get your ChatID (example):
    • public: https:/t.me/MY_CHAT
    • private: -2233445566778
  • Add your bot to chanel or group with admin rules (messages access).

Optional

  • TopidID (message_thread_id):

    • Default or General Topic: 0

    • To test with topics:

      ```bash:
      curl -X GET 'https://api.telegram.org/bot<bot-api-token>/sendMessage?chat_id=<chat-id>&message_thread_id=<chat-topic-id>&text=HelloTopic!'
      ```
      

Install

  1. To start Bot, run the following command with your variables in terminal:

    docker run -it -p 441:441
        --name harbor-telegram-bot
        -e CHAT_ID=<chat-id>
        -e BOT_TOKEN=<bot-api-token>
        -e TOPIC_ID=<topic-id>
        alexpokatilov/harbor-telegram-bot:2.3.0

    Set -e DEBUG=true, if you want to see all logs with raw format.

  2. Configure your Harbor http webhook

  3. Check your bot. Send POST request to http://<hostname>:441/webhook-bot

  4. Bot message example:

    • Docker Image (ARTIFACT)

      🐳 New image pushed by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Repository: test-webhook/debian
      • Tag: latest
      
      🐳 Artifact pulled by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Access: public
      • Repository: test-webhook/debian
      • Tag: latest
      
      ❗️ Attention!
      🐳 Artifact removed by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Repository: test-webhook/debian
      • Tag: latest
      
    • Helm Chart (CHART)

      ☸️ New chart version uploaded by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Chart: test-webhook/debian
      • Version: latest
      
      ☸️ Chart pulled by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Access: public
      • Chart: debian
      • Version: 0.1.0
      
      ❗️ Attention!
      ☸️ Chart removed by: admin
      • Host: hub.harbor.com
      • Project: test-webhook
      • Chart: test-webhook/debian
      • Version: latest
      
    • Alert (QUOTA)

      🚨 Alert!!! Project quota has been exceed!!!
      • Project: test-webhook
      
      ⚠️ Warning!! Quota usage reach 85%!!
      • Project: test-webhook
      

Links

Development

Json Payload Format

Ref links