New feature: Build a telegram bot for "remote" repo injection #185

Open
opened 2026-10-27 12:09:57 +01:00 by adam · 5 comments
Owner

Hey,

upfront, its already done, just need to cleanup a bit.

But what is it, it is a telegram bot which can be connected to Gitea Mirror to receive your github urls from a private chat or a group (thats how we are using it right now)

You can send a message in the group, the bot will detect the links and asks if you want to add the Repo/Orga to your watchlist and sync right away.
You can confirm directly from within the bot.

Need probably until weekend and can make it opensource then.

Cheers
Floh

Hey, upfront, its already done, just need to cleanup a bit. But what is it, it is a telegram bot which can be connected to Gitea Mirror to receive your github urls from a private chat or a group (thats how we are using it right now) You can send a message in the group, the bot will detect the links and asks if you want to add the Repo/Orga to your watchlist and sync right away. You can confirm directly from within the bot. Need probably until weekend and can make it opensource then. Cheers Floh <!-- github-sync-id:5983571572 -->
Author
Owner

Nice, thanks @MajMcCloud . Quick question: is the bot using the API endpoints Gitea Mirror has now? With an API key you can add a repo (POST /api/sync/repository), add an org (POST /api/sync/organization) and start a sync (POST /api/job/mirror-repo). See docs/API.md for the details.

Nice, thanks @MajMcCloud . Quick question: is the bot using the API endpoints Gitea Mirror has now? With an API key you can add a repo (`POST /api/sync/repository`), add an org (`POST /api/sync/organization`) and start a sync (`POST /api/job/mirror-repo`). See docs/API.md for the details. <!-- github-comment-id:6356783384 -->
Author
Owner

@arunavo4

Hey,
yes indeed it uses only existing APIs, no need to extend anything.

The only thing, where probably an issue exists is around organizations. I had to check again but one endpoint gives me a 404, even if it stands in the documentation.

I'll get back on that matter then.

Cheers

@arunavo4 Hey, yes indeed it uses only existing APIs, no need to extend anything. The only thing, where probably an issue exists is around organizations. I had to check again but one endpoint gives me a 404, even if it stands in the documentation. I'll get back on that matter then. Cheers <!-- github-comment-id:6361414398 -->
Author
Owner

Thanks @MajMcCloud. I went through the flow with an API key and fixed a few rough spots in v3.45.0:

  • a wrong path or method (for example GET /api/organizations; the list is GET /api/github/organizations) returned an HTML 404 page, now it's a JSON error naming the method and path
  • POST /api/sync/organization gives a 404 for a user account, since a user isn't an org; the message says so now
  • POST /api/job/mirror-org takes the organization.id from the add call, not the org name, and a name gets a 404
  • role is optional now, and a 409 for something already tracked includes its id

Also send Content-Type: application/json on every POST, even without a body, or you get a 403. If your 404 was something else, send me the endpoint, the body and the response.

Thanks @MajMcCloud. I went through the flow with an API key and fixed a few rough spots in v3.45.0: - a wrong path or method (for example `GET /api/organizations`; the list is `GET /api/github/organizations`) returned an HTML 404 page, now it's a JSON error naming the method and path - `POST /api/sync/organization` gives a 404 for a user account, since a user isn't an org; the message says so now - `POST /api/job/mirror-org` takes the `organization.id` from the add call, not the org name, and a name gets a 404 - `role` is optional now, and a 409 for something already tracked includes its id Also send `Content-Type: application/json` on every POST, even without a body, or you get a 403. If your 404 was something else, send me the endpoint, the body and the response. <!-- github-comment-id:6366530706 -->
Author
Owner

@arunavo4 yay!
Thanks for having a look, helps me save time 😬

I'll have a look at them again and get back with an update later.

@arunavo4 yay! Thanks for having a look, helps me save time 😬 I'll have a look at them again and get back with an update later. <!-- github-comment-id:6371416055 -->
Author
Owner

@arunavo4

There you go: https://github.com/MajMcCloud/GiteaMirrorBot

I will publish some releases and an install manual later. For now you just need to install .NET 10 ASP.NET Core package via apt-get on linux, windows should be available by default.

Set your settings via the appsettings.json (within the app directory) and run the ./GiteaMirrorBot app

For now, it does work only within a group, and one group per application settings only.
It does have a webkook endpoint as well (you see during start) for sending you notifications from inside.

Maybe let the issue open, so I can give further feedback on that matter.

@arunavo4 There you go: https://github.com/MajMcCloud/GiteaMirrorBot I will publish some releases and an install manual later. For now you just need to install .NET 10 ASP.NET Core package via apt-get on linux, windows should be available by default. Set your settings via the appsettings.json (within the app directory) and run the ./GiteaMirrorBot app For now, it does work only within a group, and one group per application settings only. It does have a webkook endpoint as well (you see during start) for sending you notifications from inside. Maybe let the issue open, so I can give further feedback on that matter. <!-- github-comment-id:6440003066 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/gitea-mirror#185