Like many other Version Control Systems, Git has a way to fire off custom scripts when certain important actions occur. There are two groups of these hooks: client-side and server-side. Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits. You can use these hooks for all sorts of reasons.
There are two methods to get messages and informations from your bot:
/getUpdates function wich is documented pretty straight forward in the spectific section of the documentation
Next: The webhook function which is a bit more complex and often causes issues.
The difference basically is that you use the first alternative to pull changes and react to them and the second one acts more like a push method, by sending a json document.