46

I've read that GitLab is capable of sending messages to other servers via "web hooks" but I can't find where one would create one.

Can someone point me in the right direction?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
leech
  • 8,293
  • 7
  • 62
  • 78

5 Answers5

70

All the answers I've found in official documentation and on Stack Overflow for finding web hooks are incorrect. The admin area > hooks page does NOT contain web hooks. It contains system hooks, which fire when you create/delete projects and users and things like that. This is not what you want.

To find your web hooks, go to the specific project > settings > web hooks (on sidebar in GitLab 6.1.0) page. These will fire on post-receive for the project in question. You can use a service like RequestBin to see what the payload looks like and to ensure you're firing these off correctly for debugging purposes.

Jamey
  • 4,420
  • 2
  • 24
  • 20
  • 7
    A more accurate answer than mine. +1. This should be the accepted answer. – VonC Sep 19 '13 at 18:52
  • 1
    Thanks for the answer Jamey. There is official documentation on GitLab web and server hooks in the application itself: http://demo.gitlab.com/help/web_hooks and http://demo.gitlab.com/help/system_hooks. The login credentials for the demo server are listed on http://demo.gitlab.com/. – Sytse Sijbrandij Feb 06 '14 at 10:16
  • That's great! It still doesn't tell you *where* to find the web hooks, though. That's the issue that @leech and I were experiencing a while back. – Jamey Feb 06 '14 at 17:49
  • 3
    The system hooks are still web hooks, they're just web hooks for system events instead of repository events. – Michael Mior Mar 06 '14 at 21:29
  • is this only possible through the site or can webhooks be created with the api? – bumpkin Jun 16 '14 at 18:31
  • Webhooks are activated and "configured" through the website. But backend implementation documentation is [GItlab Webhooks doc](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/web_hooks/web_hooks.md) – MensSana May 09 '16 at 14:10
  • There is also a nice wiki here: [Gitlab Webhooks wiki](https://kanboard.net/plugin/gitlab-webhook) – MensSana May 09 '16 at 14:12
  • This answer is obsolete, please refer to @derwiwie 's answer – IceFire Oct 03 '19 at 10:47
30

With version 8.16.1, I found the web hooks under

specific project > settings > integrations

enter image description here

derwiwie
  • 875
  • 10
  • 16
6

For group level hooks:

visit: https://gitlab.com/groups/<yourgroup>/hooks

For group project level hooks:

visit: https://gitlab.com/yourgroup/yourproject/hooks

Blair Anderson
  • 19,463
  • 8
  • 77
  • 114
4

You can see an example of GitLab system hook, with a web_hook.rb creation in this GitHub project.

In gitlab, as admin, go to "Hooks" tab, create hook as: http://your.ip.goes.here:8000

or change the port on line 175 of the script.

For web hooks, see Jamey's more accurate answer.

You can inspect the result of a webhook with a service like RequestBin.
Another example of webhook interpretation: this question.

Be aware though that a few issues remain with gitlab webhook:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

I recommend using GitLabForm - configuration as code tool for GitLab - to configure webhooks with code like this:

project_settings:
  my_group/my_project:
    hooks:
      hooks:
      'http://127.0.0.1:5000/hooks/my-hook-endpoint':
        push_events: false # this is set to true by GitLab API by default
        merge_requests_events: true
        token: some_secret_auth_token

Disclosure: I wrote this tool and my company open-sourced it.

Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68