Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create (or setup) Telegram Bot for GitHub Webhook Event Notifications #20

Closed
5 tasks
wopox1337 opened this issue Oct 22, 2024 · 1 comment
Closed
5 tasks
Assignees
Labels
Difficulty: 🟡 medium Task of medium difficulty requiring moderate effort. Priority: ⚠️ medium Medium priority tasks that should be addressed soon. Status: 🕹️ on hold Task temporarily on hold. Type: ⚙️ infrastructure Tasks for maintaining or improving system infrastructure.

Comments

@wopox1337
Copy link
Member

Overview

We need to develop a Telegram bot that will receive specific GitHub webhook events related to our organization’s repositories and send them as notifications in a designated Telegram chat. The bot should capture the following events:

  • New releases.
  • New commits.
  • New comments.
  • New discussions.

The bot should not send notifications when existing releases, comments (and etc.) are edited.

Currently, the project uses wopox1337/webhook for hosting the webhook handler on Deno Deploy, which is free. However, it lacks the ability to finely configure the required events without code intervention. Moreover, GitHub’s organization-level webhook settings do not provide granular control over which events are sent.

We are constrained by the fact that paid solutions are not an option for now due to the project's lack of financial backing. Therefore, we must rely on publicly accessible and free tools.

Requirements

  1. Telegram Bot Development:

    • The bot must send notifications about:
      • Creation of new releases.
      • New commits pushed to any repository.
      • New comments made on issues, pull requests, or discussions.
      • Creation of new discussions.
    • The bot must ignore notifications for updates to existing releases.
    • The bot should send messages to a specified Telegram chat (to thread).
  2. Webhook Configuration:

    • Implement a webhook handler capable of filtering out unwanted events.
    • Ensure the bot only processes the events specified above.
    • Use a free hosting solution (like Deno Deploy or similar) that allows us to customize event handling without paid services.
  3. Testing and Deployment:

    • Test the bot in a staging Telegram chat to ensure correct event handling.
    • Ensure the bot’s response time is adequate, and messages are properly formatted.
    • Deploy the bot using free, publicly accessible hosting solutions.

Tasks

  1. Set up a Telegram bot:

    • Create a new bot using the Telegram Bot API.
    • Set up a chat for receiving the event notifications.
  2. Develop a webhook handler:

    • Implement a webhook handler that listens for GitHub events.
    • Ensure that the handler filters the events to match the required events (releases, commits, comments, discussions).
    • Block notifications for any edits to existing releases.
  3. Host the webhook handler:

    • Choose a suitable free hosting platform (Deno Deploy or alternatives).
    • Deploy the webhook handler and link it to the Telegram bot.
  4. Configure GitHub Webhook:

    • Set up a GitHub webhook to send events to the deployed webhook handler.
    • Test the webhook to ensure that only the specified events trigger notifications in the Telegram chat.
  5. Testing and Debugging:

    • Test the webhook handler and bot to ensure they work as expected.
    • Debug any issues with event handling or incorrect notifications.
  6. Deploy the bot:

    • Once all testing is completed, deploy the bot in the main Telegram chat for the organization.

Acceptance Criteria

  • Telegram bot is created and sending notifications for new releases, commits, comments, and discussions.
  • The bot does not send notifications for edits to existing releases.
  • The webhook handler is deployed on a free hosting platform.
  • GitHub webhooks are correctly configured to send the required events.
  • The bot has been tested and deployed in the main Telegram chat.

Notes

  • The solution must be free of charge as paid solutions are currently not an option for this project.
  • Ensure that the bot’s notifications are clear and well-formatted for ease of use by the community.

Important

It's important to note that creating a Telegram bot from scratch might not be necessary. There could be existing solutions that meet our requirements or can be easily adapted to fit our needs. Exploring open-source GitHub webhook bots or pre-built Telegram bot frameworks could save development time and effort. Customizing an existing solution to handle specific GitHub events (releases, commits, comments, discussions) and deploying it on a free hosting platform might be a more efficient approach.

@wopox1337
Copy link
Member Author

@wopox1337 wopox1337 added Status: 🕹️ on hold Task temporarily on hold. Type: ⚙️ infrastructure Tasks for maintaining or improving system infrastructure. Difficulty: 🟡 medium Task of medium difficulty requiring moderate effort. Priority: ⚠️ medium Medium priority tasks that should be addressed soon. labels Nov 7, 2024
@wopox1337 wopox1337 moved this from Ready to Done in 🤝 Community & UX Initiatives Nov 7, 2024
@wopox1337 wopox1337 closed this as completed by moving to Done in 🤝 Community & UX Initiatives Nov 7, 2024
@wopox1337 wopox1337 self-assigned this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: 🟡 medium Task of medium difficulty requiring moderate effort. Priority: ⚠️ medium Medium priority tasks that should be addressed soon. Status: 🕹️ on hold Task temporarily on hold. Type: ⚙️ infrastructure Tasks for maintaining or improving system infrastructure.
Projects
Development

No branches or pull requests

1 participant