Code Monkey home page Code Monkey logo

gitlab-telegram-bot's Introduction

gitlab webhook telegram bot

Simple gitlab telegram bot that listen to gitlab webhooks and send each event to the authenticated chats

https://core.telegram.org/bots

Create a new bot https://core.telegram.org/bots#create-a-new-bot and then copy the token to the token file.

Requirements

Only work with python3

How to use

  1. Change the authmsg file with some secret keyworld
  2. Run the app.py in your server
  3. Create a webhook in your gitlab project that points to http://yourserver:10111/
  4. Talk to your bot and write only the keyworld
  5. You will receive each event in your repo

FAQ

Q. How can I stop receiving messages

R. Write "shutupbot" in your conversation and the bot won't talk to you anymore

Q. How can I enable the bot in group chats

R. Write /keyworld instead of keyworld

Interesting files

  • chats, the json with all the chats to send notifications
  • token, the bot token
  • offset, the last msg id received from telegram api

Docker

build

$ docker build -t bot .

run

$ docker run -d -p 10111:10111 --name bot -e AUTHMSG="XXX" -e TOKEN="XXX:XXX" bot

gitlab-telegram-bot's People

Contributors

cklos avatar danigm avatar derzunov avatar joseenrique avatar lockp111 avatar ozbek avatar patrickelectric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitlab-telegram-bot's Issues

Config Repository

How can I configure the repository in which I want to receive the events?

Pipeline Events not working

Thanks for this bot. It's amazing, however, I never receive updates about Pipeline Events. Everything else works fine.

Details:
gitlab 10.2.2 (selfhosted)

Error 500 when sending event to the server

I tried out your telegram bot with the latest gitlab version (10.1.0-ce.0) and it does not work. I get a Http 500 error in the logs:

23/10/2017 16:33:43 * Running on http://0.0.0.0:10111/ (Press CTRL+C to quit)
23/10/2017 16:56:44[2017-10-23 14:56:44,937] ERROR in app: Exception on / [POST]
23/10/2017 16:56:44Traceback (most recent call last):
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
23/10/2017 16:56:44 response = self.full_dispatch_request()
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
23/10/2017 16:56:44 rv = self.handle_user_exception(e)
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
23/10/2017 16:56:44 reraise(exc_type, exc_value, tb)
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
23/10/2017 16:56:44 raise value
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
23/10/2017 16:56:44 rv = self.dispatch_request()
23/10/2017 16:56:44 File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
23/10/2017 16:56:44 return self.view_functionsrule.endpoint
23/10/2017 16:56:44 File "./app.py", line 60, in webhook
23/10/2017 16:56:44 kind = data['obj_kind']
23/10/2017 16:56:44KeyError: 'obj_kind'
23/10/2017 16:56:44172.20.2.4 - - [23/Oct/2017 14:56:44] "POST / HTTP/1.1" 500 -

github

does this bot also work on github webhooks?

Thanks!

Issue event not working without assignees

Hi people.
If an issue created with no assignee the bot returns 500 error and can not send the appropriate message.
The issue originate from the app.py when it's looking for assignee

File "app.py", line 66, in webhook

msg = generateIssueMsg(data)

File "app.py", line 111, in generateIssueMsg

for assignee in data['assignees']:

KeyError: 'assignees'

172.17.0.1 - - [20/Apr/2021 05:58:52] "POST / HTTP/1.1" 500 -

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.