debian-mirror-gitlab/doc/user/project/integrations/webhook_events.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1798 lines
52 KiB
Markdown
Raw Normal View History

2021-11-18 22:05:49 +05:30
---
2022-11-25 23:54:43 +05:30
stage: Manage
2021-11-18 22:05:49 +05:30
group: Integrations
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-11-18 22:05:49 +05:30
---
# Webhook events **(FREE)**
You can configure a [webhook](webhooks.md) in your project that triggers when
an event occurs. The following events are supported.
2021-12-11 22:18:48 +05:30
Event type | Trigger
---------------------------------------------|-----------------------------------------------------------------------------
[Push event](#push-events) | A push is made to the repository.
[Tag event](#tag-events) | Tags are created or deleted in the repository.
[Issue event](#issue-events) | A new issue is created or an existing issue is updated, closed, or reopened.
[Comment event](#comment-events) | A new comment is made on commits, merge requests, issues, and code snippets.
[Merge request event](#merge-request-events) | A merge request is created, updated, merged, or closed, or a commit is added in the source branch.
[Wiki page event](#wiki-page-events) | A wiki page is created, updated, or deleted.
[Pipeline event](#pipeline-events) | A pipeline status changes.
[Job event](#job-events) | A job status changes.
[Deployment event](#deployment-events) | A deployment starts, succeeds, fails, or is canceled.
[Group member event](#group-member-events) | A user is added or removed from a group, or a user's access level or access expiration date changes.
[Subgroup event](#subgroup-events) | A subgroup is created or removed from a group.
[Feature flag event](#feature-flag-events) | A feature flag is turned on or off.
[Release event](#release-events) | A release is created or updated.
NOTE:
If an author has no public email listed in their
[GitLab profile](https://gitlab.com/-/profile), the `email` attribute in the
webhook payload displays a value of `[REDACTED]`.
2021-11-18 22:05:49 +05:30
## Push events
2021-12-11 22:18:48 +05:30
Push events are triggered when you push to the repository, except when:
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
- You push tags.
- A single push includes changes for more than three branches by default
(depending on the [`push_event_hooks_limit` setting](../../../api/settings.md#list-of-settings-that-can-be-accessed-via-api-calls)).
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
If you push more than 20 commits at once, the `commits`
attribute in the payload contains information about the newest 20 commits only.
Loading detailed commit data is expensive, so this restriction exists for performance reasons.
The `total_commits_count` attribute contains the actual number of commits.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
If you create and push a branch without any new commits, the
`commits` attribute in the payload is empty.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Push Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "push",
"event_name": "push",
"before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
"after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"ref": "refs/heads/master",
"checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"user_id": 4,
"user_name": "John Smith",
"user_username": "jsmith",
"user_email": "john@example.com",
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
"project_id": 15,
"project":{
"id": 15,
"name":"Diaspora",
"description":"",
"web_url":"http://example.com/mike/diaspora",
"avatar_url":null,
"git_ssh_url":"git@example.com:mike/diaspora.git",
"git_http_url":"http://example.com/mike/diaspora.git",
"namespace":"Mike",
"visibility_level":0,
"path_with_namespace":"mike/diaspora",
"default_branch":"master",
"homepage":"http://example.com/mike/diaspora",
"url":"git@example.com:mike/diaspora.git",
"ssh_url":"git@example.com:mike/diaspora.git",
"http_url":"http://example.com/mike/diaspora.git"
},
"repository":{
"name": "Diaspora",
"url": "git@example.com:mike/diaspora.git",
"description": "",
"homepage": "http://example.com/mike/diaspora",
"git_http_url":"http://example.com/mike/diaspora.git",
"git_ssh_url":"git@example.com:mike/diaspora.git",
"visibility_level":0
},
"commits": [
{
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"message": "Update Catalan translation to e38cb41.\n\nSee https://gitlab.com/gitlab-org/gitlab for more information",
"title": "Update Catalan translation to e38cb41.",
"timestamp": "2011-12-12T14:27:31+02:00",
"url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"author": {
"name": "Jordi Mallach",
"email": "jordi@softcatala.org"
},
"added": ["CHANGELOG"],
"modified": ["app/controller/application.rb"],
"removed": []
},
{
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"message": "fixed readme",
"title": "fixed readme",
"timestamp": "2012-01-03T23:36:29+02:00",
"url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"author": {
"name": "GitLab dev user",
"email": "gitlabdev@dv6700.(none)"
},
"added": ["CHANGELOG"],
"modified": ["app/controller/application.rb"],
"removed": []
}
],
"total_commits_count": 4
}
```
## Tag events
2021-12-11 22:18:48 +05:30
Tag events are triggered when you create or delete tags in the repository.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
This hook is not executed if a single push includes changes for more than three
tags by default (depending on the
[`push_event_hooks_limit` setting](../../../api/settings.md#list-of-settings-that-can-be-accessed-via-api-calls)).
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Tag Push Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "tag_push",
"event_name": "tag_push",
"before": "0000000000000000000000000000000000000000",
"after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
"ref": "refs/tags/v1.0.0",
"checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
"user_id": 1,
"user_name": "John Smith",
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
"project_id": 1,
"project":{
"id": 1,
"name":"Example",
"description":"",
"web_url":"http://example.com/jsmith/example",
"avatar_url":null,
"git_ssh_url":"git@example.com:jsmith/example.git",
"git_http_url":"http://example.com/jsmith/example.git",
"namespace":"Jsmith",
"visibility_level":0,
"path_with_namespace":"jsmith/example",
"default_branch":"master",
"homepage":"http://example.com/jsmith/example",
"url":"git@example.com:jsmith/example.git",
"ssh_url":"git@example.com:jsmith/example.git",
"http_url":"http://example.com/jsmith/example.git"
},
"repository":{
"name": "Example",
"url": "ssh://git@example.com/jsmith/example.git",
"description": "",
"homepage": "http://example.com/jsmith/example",
"git_http_url":"http://example.com/jsmith/example.git",
"git_ssh_url":"git@example.com:jsmith/example.git",
"visibility_level":0
},
"commits": [],
"total_commits_count": 0
}
```
## Issue events
2021-12-11 22:18:48 +05:30
Issue events are triggered when a new issue is created or
an existing issue is updated, closed, or reopened.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
The available values for `object_attributes.action` in the payload are:
2021-11-18 22:05:49 +05:30
- `open`
- `close`
- `reopen`
- `update`
2021-12-11 22:18:48 +05:30
The `assignee` and `assignee_id` keys are deprecated
and contain the first assignee only.
2022-05-07 20:08:51 +05:30
The `escalation_status` and `escalation_policy` fields are
2022-06-21 17:19:12 +05:30
only available for issue types which [support escalations](../../../operations/incident_management/paging.md#paging),
2022-05-07 20:08:51 +05:30
such as incidents.
2021-12-11 22:18:48 +05:30
Request header:
```plaintext
X-Gitlab-Event: Issue Hook
```
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "issue",
"event_type": "issue",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project": {
"id": 1,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlabhq/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"git_http_url":"http://example.com/gitlabhq/gitlab-test.git",
"namespace":"GitlabHQ",
"visibility_level":20,
"path_with_namespace":"gitlabhq/gitlab-test",
"default_branch":"master",
"ci_config_path": null,
"homepage":"http://example.com/gitlabhq/gitlab-test",
"url":"http://example.com/gitlabhq/gitlab-test.git",
"ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"http_url":"http://example.com/gitlabhq/gitlab-test.git"
},
"object_attributes": {
"id": 301,
"title": "New API: create/update/delete file",
"assignee_ids": [51],
"assignee_id": 51,
"author_id": 51,
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"updated_by_id": 1,
"last_edited_at": null,
"last_edited_by_id": null,
"relative_position": 0,
"description": "Create new API for manipulations with repository",
"milestone_id": null,
"state_id": 1,
"confidential": false,
"discussion_locked": true,
"due_date": null,
"moved_to_id": null,
"duplicated_to_id": null,
"time_estimate": 0,
"total_time_spent": 0,
"time_change": 0,
"human_total_time_spent": null,
"human_time_estimate": null,
"human_time_change": null,
"weight": null,
"iid": 23,
"url": "http://example.com/diaspora/issues/23",
"state": "opened",
"action": "open",
2022-05-07 20:08:51 +05:30
"severity": "high",
"escalation_status": "triggered",
"escalation_policy": {
"id": 18,
"name": "Engineering On-call"
},
2021-11-18 22:05:49 +05:30
"labels": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}]
},
"repository": {
"name": "Gitlab Test",
"url": "http://example.com/gitlabhq/gitlab-test.git",
"description": "Aut reprehenderit ut est.",
"homepage": "http://example.com/gitlabhq/gitlab-test"
},
"assignees": [{
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}],
"assignee": {
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
},
"labels": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}],
"changes": {
"updated_by_id": {
"previous": null,
"current": 1
},
"updated_at": {
"previous": "2017-09-15 16:50:55 UTC",
"current": "2017-09-15 16:52:00 UTC"
},
"labels": {
"previous": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}],
"current": [{
"id": 205,
"title": "Platform",
"color": "#123123",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "Platform related issues",
"type": "ProjectLabel",
"group_id": 41
}]
}
}
}
```
## Comment events
2021-12-11 22:18:48 +05:30
Comment events are triggered when a new comment is made on commits,
merge requests, issues, and code snippets.
The note data is stored in `object_attributes` (for example, `note` or `noteable_type`).
The payload includes information about the target of the comment. For example,
a comment on an issue includes specific issue information under the `issue` key.
The valid target types are:
2021-11-18 22:05:49 +05:30
- `commit`
- `merge_request`
- `issue`
- `snippet`
2021-12-11 22:18:48 +05:30
### Comment on a commit
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Note Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "note",
"event_type": "note",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project_id": 5,
"project":{
"id": 5,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlabhq/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"git_http_url":"http://example.com/gitlabhq/gitlab-test.git",
"namespace":"GitlabHQ",
"visibility_level":20,
"path_with_namespace":"gitlabhq/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlabhq/gitlab-test",
"url":"http://example.com/gitlabhq/gitlab-test.git",
"ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"http_url":"http://example.com/gitlabhq/gitlab-test.git"
},
"repository":{
"name": "Gitlab Test",
"url": "http://example.com/gitlab-org/gitlab-test.git",
"description": "Aut reprehenderit ut est.",
"homepage": "http://example.com/gitlab-org/gitlab-test"
},
"object_attributes": {
"id": 1243,
"note": "This is a commit comment. How does this work?",
"noteable_type": "Commit",
"author_id": 1,
"created_at": "2015-05-17 18:08:09 UTC",
"updated_at": "2015-05-17 18:08:09 UTC",
"project_id": 5,
"attachment":null,
"line_code": "bec9703f7a456cd2b4ab5fb3220ae016e3e394e3_0_1",
"commit_id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660",
"noteable_id": null,
"system": false,
"st_diff": {
"diff": "--- /dev/null\n+++ b/six\n@@ -0,0 +1 @@\n+Subproject commit 409f37c4f05865e4fb208c771485f211a22c4c2d\n",
"new_path": "six",
"old_path": "six",
"a_mode": "0",
"b_mode": "160000",
"new_file": true,
"renamed_file": false,
"deleted_file": false
},
"url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660#note_1243"
},
"commit": {
"id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660",
"message": "Add submodule\n\nSigned-off-by: Example User \u003cuser@example.com.com\u003e\n",
"timestamp": "2014-02-27T10:06:20+02:00",
"url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660",
"author": {
"name": "Example User",
"email": "user@example.com"
}
}
}
```
2021-12-11 22:18:48 +05:30
### Comment on a merge request
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Note Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "note",
"event_type": "note",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project_id": 5,
"project":{
"id": 5,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlab-org/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"git_http_url":"http://example.com/gitlab-org/gitlab-test.git",
"namespace":"Gitlab Org",
"visibility_level":10,
"path_with_namespace":"gitlab-org/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlab-org/gitlab-test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"http_url":"http://example.com/gitlab-org/gitlab-test.git"
},
"repository":{
"name": "Gitlab Test",
"url": "http://localhost/gitlab-org/gitlab-test.git",
"description": "Aut reprehenderit ut est.",
"homepage": "http://example.com/gitlab-org/gitlab-test"
},
"object_attributes": {
"id": 1244,
"note": "This MR needs work.",
"noteable_type": "MergeRequest",
"author_id": 1,
"created_at": "2015-05-17 18:21:36 UTC",
"updated_at": "2015-05-17 18:21:36 UTC",
"project_id": 5,
"attachment": null,
"line_code": null,
"commit_id": "",
"noteable_id": 7,
"system": false,
"st_diff": null,
"url": "http://example.com/gitlab-org/gitlab-test/merge_requests/1#note_1244"
},
"merge_request": {
"id": 7,
"target_branch": "markdown",
"source_branch": "master",
"source_project_id": 5,
"author_id": 8,
"assignee_id": 28,
"title": "Tempora et eos debitis quae laborum et.",
"created_at": "2015-03-01 20:12:53 UTC",
"updated_at": "2015-03-21 18:27:27 UTC",
"milestone_id": 11,
"state": "opened",
"merge_status": "cannot_be_merged",
"target_project_id": 5,
"iid": 1,
"description": "Et voluptas corrupti assumenda temporibus. Architecto cum animi eveniet amet asperiores. Vitae numquam voluptate est natus sit et ad id.",
"position": 0,
2022-06-21 17:19:12 +05:30
"labels": [
{
"id": 25,
"title": "Afterpod",
"color": "#3e8068",
"project_id": null,
"created_at": "2019-06-05T14:32:20.211Z",
"updated_at": "2019-06-05T14:32:20.211Z",
"template": false,
"description": null,
"type": "GroupLabel",
"group_id": 4
},
{
"id": 86,
"title": "Element",
"color": "#231afe",
"project_id": 4,
"created_at": "2019-06-05T14:32:20.637Z",
"updated_at": "2019-06-05T14:32:20.637Z",
"template": false,
"description": null,
"type": "ProjectLabel",
"group_id": null
}
],
2021-11-18 22:05:49 +05:30
"source":{
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlab-org/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"git_http_url":"http://example.com/gitlab-org/gitlab-test.git",
"namespace":"Gitlab Org",
"visibility_level":10,
"path_with_namespace":"gitlab-org/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlab-org/gitlab-test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"http_url":"http://example.com/gitlab-org/gitlab-test.git"
},
"target": {
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlab-org/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"git_http_url":"http://example.com/gitlab-org/gitlab-test.git",
"namespace":"Gitlab Org",
"visibility_level":10,
"path_with_namespace":"gitlab-org/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlab-org/gitlab-test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"http_url":"http://example.com/gitlab-org/gitlab-test.git"
},
"last_commit": {
"id": "562e173be03b8ff2efb05345d12df18815438a4b",
"message": "Merge branch 'another-branch' into 'master'\n\nCheck in this test\n",
"timestamp": "2015-04-08T21: 00:25-07:00",
"url": "http://example.com/gitlab-org/gitlab-test/commit/562e173be03b8ff2efb05345d12df18815438a4b",
"author": {
"name": "John Smith",
"email": "john@example.com"
}
},
"work_in_progress": false,
"assignee": {
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
}
}
```
2021-12-11 22:18:48 +05:30
### Comment on an issue
- The `assignee_id` field is deprecated and shows the first assignee only.
- The `event_type` is set to `confidential_note` for confidential issues.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Note Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "note",
"event_type": "note",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project_id": 5,
"project":{
"id": 5,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlab-org/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"git_http_url":"http://example.com/gitlab-org/gitlab-test.git",
"namespace":"Gitlab Org",
"visibility_level":10,
"path_with_namespace":"gitlab-org/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlab-org/gitlab-test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"http_url":"http://example.com/gitlab-org/gitlab-test.git"
},
"repository":{
"name":"diaspora",
"url":"git@example.com:mike/diaspora.git",
"description":"",
"homepage":"http://example.com/mike/diaspora"
},
"object_attributes": {
"id": 1241,
"note": "Hello world",
"noteable_type": "Issue",
"author_id": 1,
"created_at": "2015-05-17 17:06:40 UTC",
"updated_at": "2015-05-17 17:06:40 UTC",
"project_id": 5,
"attachment": null,
"line_code": null,
"commit_id": "",
"noteable_id": 92,
"system": false,
"st_diff": null,
"url": "http://example.com/gitlab-org/gitlab-test/issues/17#note_1241"
},
"issue": {
"id": 92,
"title": "test",
"assignee_ids": [],
"assignee_id": null,
"author_id": 1,
"project_id": 5,
"created_at": "2015-04-12 14:53:17 UTC",
"updated_at": "2015-04-26 08:28:42 UTC",
"position": 0,
"branch_name": null,
"description": "test",
"milestone_id": null,
"state": "closed",
"iid": 17,
"labels": [
{
"id": 25,
"title": "Afterpod",
"color": "#3e8068",
"project_id": null,
"created_at": "2019-06-05T14:32:20.211Z",
"updated_at": "2019-06-05T14:32:20.211Z",
"template": false,
"description": null,
"type": "GroupLabel",
"group_id": 4
},
{
"id": 86,
"title": "Element",
"color": "#231afe",
"project_id": 4,
"created_at": "2019-06-05T14:32:20.637Z",
"updated_at": "2019-06-05T14:32:20.637Z",
"template": false,
"description": null,
"type": "ProjectLabel",
"group_id": null
}
]
}
}
```
2021-12-11 22:18:48 +05:30
### Comment on a code snippet
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Note Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "note",
"event_type": "note",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project_id": 5,
"project":{
"id": 5,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlab-org/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"git_http_url":"http://example.com/gitlab-org/gitlab-test.git",
"namespace":"Gitlab Org",
"visibility_level":10,
"path_with_namespace":"gitlab-org/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlab-org/gitlab-test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"ssh_url":"git@example.com:gitlab-org/gitlab-test.git",
"http_url":"http://example.com/gitlab-org/gitlab-test.git"
},
"repository":{
"name":"Gitlab Test",
"url":"http://example.com/gitlab-org/gitlab-test.git",
"description":"Aut reprehenderit ut est.",
"homepage":"http://example.com/gitlab-org/gitlab-test"
},
"object_attributes": {
"id": 1245,
"note": "Is this snippet doing what it's supposed to be doing?",
"noteable_type": "Snippet",
"author_id": 1,
"created_at": "2015-05-17 18:35:50 UTC",
"updated_at": "2015-05-17 18:35:50 UTC",
"project_id": 5,
"attachment": null,
"line_code": null,
"commit_id": "",
"noteable_id": 53,
"system": false,
"st_diff": null,
"url": "http://example.com/gitlab-org/gitlab-test/snippets/53#note_1245"
},
"snippet": {
"id": 53,
"title": "test",
"content": "puts 'Hello world'",
"author_id": 1,
"project_id": 5,
"created_at": "2015-04-09 02:40:38 UTC",
"updated_at": "2015-04-09 02:40:38 UTC",
"file_name": "test.rb",
"expires_at": null,
"type": "ProjectSnippet",
"visibility_level": 0
}
}
```
## Merge request events
2021-12-11 22:18:48 +05:30
Merge request events are triggered when:
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
- A new merge request is created.
2022-05-07 20:08:51 +05:30
- An existing merge request is updated, approved (by all required approvers), unapproved, merged, or closed.
- An individual user adds or removes their approval to an existing merge request.
2021-12-11 22:18:48 +05:30
- A commit is added in the source branch.
2022-04-04 11:22:00 +05:30
- All threads are resolved on the merge request.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
The available values for `object_attributes.action` in the payload are:
2021-11-18 22:05:49 +05:30
- `open`
- `close`
- `reopen`
- `update`
- `approved`
- `unapproved`
2022-05-07 20:08:51 +05:30
- `approval`
- `unapproval`
2021-11-18 22:05:49 +05:30
- `merge`
2022-08-13 15:12:31 +05:30
The field `object_attributes.oldrev` is only available when there are actual code changes, like:
- New code is pushed.
- A [suggestion](../merge_requests/reviews/suggestions.md) is applied.
2021-12-11 22:18:48 +05:30
Request header:
```plaintext
X-Gitlab-Event: Merge Request Hook
```
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "merge_request",
"event_type": "merge_request",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon",
"email": "admin@example.com"
},
"project": {
"id": 1,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlabhq/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"git_http_url":"http://example.com/gitlabhq/gitlab-test.git",
"namespace":"GitlabHQ",
"visibility_level":20,
"path_with_namespace":"gitlabhq/gitlab-test",
"default_branch":"master",
"homepage":"http://example.com/gitlabhq/gitlab-test",
"url":"http://example.com/gitlabhq/gitlab-test.git",
"ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"http_url":"http://example.com/gitlabhq/gitlab-test.git"
},
"repository": {
"name": "Gitlab Test",
"url": "http://example.com/gitlabhq/gitlab-test.git",
"description": "Aut reprehenderit ut est.",
"homepage": "http://example.com/gitlabhq/gitlab-test"
},
"object_attributes": {
"id": 99,
2022-08-13 15:12:31 +05:30
"iid": 1,
2021-11-18 22:05:49 +05:30
"target_branch": "master",
"source_branch": "ms-viewport",
"source_project_id": 14,
"author_id": 51,
2022-08-27 11:52:29 +05:30
"assignee_ids": [6],
2021-11-18 22:05:49 +05:30
"assignee_id": 6,
2022-08-27 11:52:29 +05:30
"reviewer_ids": [6],
2021-11-18 22:05:49 +05:30
"title": "MS-Viewport",
"created_at": "2013-12-03T17:23:34Z",
"updated_at": "2013-12-03T17:23:34Z",
"milestone_id": null,
"state": "opened",
2022-04-04 11:22:00 +05:30
"blocking_discussions_resolved": true,
2022-08-13 15:12:31 +05:30
"work_in_progress": false,
"first_contribution": true,
2021-11-18 22:05:49 +05:30
"merge_status": "unchecked",
"target_project_id": 14,
"description": "",
2022-08-13 15:12:31 +05:30
"url": "http://example.com/diaspora/merge_requests/1",
2021-11-18 22:05:49 +05:30
"source": {
"name":"Awesome Project",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/awesome_space/awesome_project",
"avatar_url":null,
"git_ssh_url":"git@example.com:awesome_space/awesome_project.git",
"git_http_url":"http://example.com/awesome_space/awesome_project.git",
"namespace":"Awesome Space",
"visibility_level":20,
"path_with_namespace":"awesome_space/awesome_project",
"default_branch":"master",
"homepage":"http://example.com/awesome_space/awesome_project",
"url":"http://example.com/awesome_space/awesome_project.git",
"ssh_url":"git@example.com:awesome_space/awesome_project.git",
"http_url":"http://example.com/awesome_space/awesome_project.git"
},
"target": {
"name":"Awesome Project",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/awesome_space/awesome_project",
"avatar_url":null,
"git_ssh_url":"git@example.com:awesome_space/awesome_project.git",
"git_http_url":"http://example.com/awesome_space/awesome_project.git",
"namespace":"Awesome Space",
"visibility_level":20,
"path_with_namespace":"awesome_space/awesome_project",
"default_branch":"master",
"homepage":"http://example.com/awesome_space/awesome_project",
"url":"http://example.com/awesome_space/awesome_project.git",
"ssh_url":"git@example.com:awesome_space/awesome_project.git",
"http_url":"http://example.com/awesome_space/awesome_project.git"
},
"last_commit": {
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"message": "fixed readme",
"timestamp": "2012-01-03T23:36:29+02:00",
"url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"author": {
"name": "GitLab dev user",
"email": "gitlabdev@dv6700.(none)"
}
},
2022-08-13 15:12:31 +05:30
"labels": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}],
2022-08-27 11:52:29 +05:30
"action": "open"
2021-11-18 22:05:49 +05:30
},
"labels": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}],
"changes": {
"updated_by_id": {
"previous": null,
"current": 1
},
"updated_at": {
"previous": "2017-09-15 16:50:55 UTC",
"current":"2017-09-15 16:52:00 UTC"
},
"labels": {
"previous": [{
"id": 206,
"title": "API",
"color": "#ffffff",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "API related issues",
"type": "ProjectLabel",
"group_id": 41
}],
"current": [{
"id": 205,
"title": "Platform",
"color": "#123123",
"project_id": 14,
"created_at": "2013-12-03T17:15:43Z",
"updated_at": "2013-12-03T17:15:43Z",
"template": false,
"description": "Platform related issues",
"type": "ProjectLabel",
"group_id": 41
}]
}
2022-08-27 11:52:29 +05:30
},
"assignees": [
{
"id": 6,
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
],
"reviewers": [
{
"id": 6,
"name": "User1",
"username": "user1",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}
]
2021-11-18 22:05:49 +05:30
}
```
2022-08-13 15:12:31 +05:30
NOTE:
The fields `assignee_id`, and `state` are deprecated.
2021-12-11 22:18:48 +05:30
## Wiki page events
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Wiki page events are triggered when a wiki page is created, updated, or deleted.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Wiki Page Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "wiki_page",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"project": {
"id": 1,
"name": "awesome-project",
"description": "This is awesome",
"web_url": "http://example.com/root/awesome-project",
"avatar_url": null,
"git_ssh_url": "git@example.com:root/awesome-project.git",
"git_http_url": "http://example.com/root/awesome-project.git",
"namespace": "root",
"visibility_level": 0,
"path_with_namespace": "root/awesome-project",
"default_branch": "master",
"homepage": "http://example.com/root/awesome-project",
"url": "git@example.com:root/awesome-project.git",
"ssh_url": "git@example.com:root/awesome-project.git",
"http_url": "http://example.com/root/awesome-project.git"
},
"wiki": {
"web_url": "http://example.com/root/awesome-project/-/wikis/home",
"git_ssh_url": "git@example.com:root/awesome-project.wiki.git",
"git_http_url": "http://example.com/root/awesome-project.wiki.git",
"path_with_namespace": "root/awesome-project.wiki",
"default_branch": "master"
},
"object_attributes": {
"title": "Awesome",
"content": "awesome content goes here",
"format": "markdown",
"message": "adding an awesome page to the wiki",
"slug": "awesome",
"url": "http://example.com/root/awesome-project/-/wikis/awesome",
"action": "create"
}
}
```
## Pipeline events
2021-12-11 22:18:48 +05:30
Pipeline events are triggered when the status of a pipeline changes.
2021-11-18 22:05:49 +05:30
In [GitLab 13.9](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53159)
and later, the pipeline webhook returns only the latest jobs.
2022-07-23 23:45:48 +05:30
In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546)
and later, pipeline webhooks triggered by blocked users are not processed.
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Pipeline Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "pipeline",
"object_attributes":{
"id": 31,
2022-11-25 23:54:43 +05:30
"iid": 3,
2021-11-18 22:05:49 +05:30
"ref": "master",
"tag": false,
"sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
"before_sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
"source": "merge_request_event",
"status": "success",
"stages":[
"build",
"test",
"deploy"
],
"created_at": "2016-08-12 15:23:28 UTC",
"finished_at": "2016-08-12 15:26:29 UTC",
"duration": 63,
"variables": [
{
"key": "NESTOR_PROD_ENVIRONMENT",
"value": "us-west-1"
}
]
},
"merge_request": {
"id": 1,
"iid": 1,
"title": "Test",
"source_branch": "test",
"source_project_id": 1,
"target_branch": "master",
"target_project_id": 1,
"state": "opened",
"merge_status": "can_be_merged",
"url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1"
},
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "user_email@gitlab.com"
},
"project":{
"id": 1,
"name": "Gitlab Test",
"description": "Atque in sunt eos similique dolores voluptatem.",
"web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test",
"avatar_url": null,
"git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git",
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
"namespace": "Gitlab Org",
"visibility_level": 20,
"path_with_namespace": "gitlab-org/gitlab-test",
"default_branch": "master"
},
"commit":{
"id": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
"message": "test\n",
"timestamp": "2016-08-12T17:23:21+02:00",
"url": "http://example.com/gitlab-org/gitlab-test/commit/bcbb5ec396a2c0f828686f14fac9b80b780504f2",
"author":{
"name": "User",
"email": "user@gitlab.com"
}
},
2022-07-23 23:45:48 +05:30
"source_pipeline":{
"project":{
"id": 41,
"web_url": "https://gitlab.example.com/gitlab-org/upstream-project",
"path_with_namespace": "gitlab-org/upstream-project",
},
"pipeline_id": 30,
"job_id": 3401
},
2021-11-18 22:05:49 +05:30
"builds":[
{
"id": 380,
"stage": "deploy",
"name": "production",
"status": "skipped",
"created_at": "2016-08-12 15:23:28 UTC",
"started_at": null,
"finished_at": null,
2022-08-13 15:12:31 +05:30
"duration": null,
"queued_duration": null,
"failure_reason": null,
2021-11-18 22:05:49 +05:30
"when": "manual",
"manual": true,
"allow_failure": false,
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"runner": null,
"artifacts_file":{
"filename": null,
"size": null
},
"environment": {
"name": "production",
"action": "start",
"deployment_tier": "production"
}
},
{
"id": 377,
"stage": "test",
"name": "test-image",
"status": "success",
"created_at": "2016-08-12 15:23:28 UTC",
"started_at": "2016-08-12 15:26:12 UTC",
2022-08-13 15:12:31 +05:30
"finished_at": "2016-08-12 15:26:29 UTC",
"duration": 17.0,
"queued_duration": 196.0,
"failure_reason": null,
2021-11-18 22:05:49 +05:30
"when": "on_success",
"manual": false,
"allow_failure": false,
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"runner": {
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
"active": true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
"docker",
"shared-runner"
]
},
"artifacts_file":{
"filename": null,
"size": null
},
"environment": null
},
{
"id": 378,
"stage": "test",
"name": "test-build",
2022-08-13 15:12:31 +05:30
"status": "failed",
2021-11-18 22:05:49 +05:30
"created_at": "2016-08-12 15:23:28 UTC",
"started_at": "2016-08-12 15:26:12 UTC",
"finished_at": "2016-08-12 15:26:29 UTC",
2022-08-13 15:12:31 +05:30
"duration": 17.0,
"queued_duration": 196.0,
"failure_reason": "script_failure",
2021-11-18 22:05:49 +05:30
"when": "on_success",
"manual": false,
"allow_failure": false,
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"runner": {
"id":380987,
"description":"shared-runners-manager-6.gitlab.com",
"active":true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
"docker"
]
},
"artifacts_file":{
"filename": null,
"size": null
},
"environment": null
},
{
"id": 376,
"stage": "build",
"name": "build-image",
"status": "success",
"created_at": "2016-08-12 15:23:28 UTC",
"started_at": "2016-08-12 15:24:56 UTC",
"finished_at": "2016-08-12 15:25:26 UTC",
2022-08-13 15:12:31 +05:30
"duration": 17.0,
"queued_duration": 196.0,
"failure_reason": null,
2021-11-18 22:05:49 +05:30
"when": "on_success",
"manual": false,
"allow_failure": false,
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"runner": {
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
"active": true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
"docker"
]
},
"artifacts_file":{
"filename": null,
"size": null
},
"environment": null
},
{
"id": 379,
"stage": "deploy",
"name": "staging",
"status": "created",
"created_at": "2016-08-12 15:23:28 UTC",
"started_at": null,
"finished_at": null,
2022-08-13 15:12:31 +05:30
"duration": null,
"queued_duration": null,
"failure_reason": null,
2021-11-18 22:05:49 +05:30
"when": "on_success",
"manual": false,
"allow_failure": false,
"user":{
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
"email": "admin@example.com"
},
"runner": null,
"artifacts_file":{
"filename": null,
"size": null
},
"environment": {
"name": "staging",
"action": "start",
"deployment_tier": "staging"
}
}
]
}
```
## Job events
2021-12-11 22:18:48 +05:30
Job events are triggered when the status of a job changes.
The `commit.id` in the payload is the ID of the pipeline, not the ID of the commit.
2021-11-18 22:05:49 +05:30
2022-07-23 23:45:48 +05:30
In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546)
and later, job events triggered by blocked users are not processed.
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Job Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "build",
"ref": "gitlab-script-trigger",
"tag": false,
"before_sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
"sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
"build_id": 1977,
"build_name": "test",
"build_stage": "test",
"build_status": "created",
"build_created_at": "2021-02-23T02:41:37.886Z",
"build_started_at": null,
"build_finished_at": null,
"build_duration": null,
"build_allow_failure": false,
"build_failure_reason": "script_failure",
"pipeline_id": 2366,
"project_id": 380,
"project_name": "gitlab-org/gitlab-test",
"user": {
"id": 3,
"name": "User",
"email": "user@gitlab.com",
2022-05-07 20:08:51 +05:30
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon"
2021-11-18 22:05:49 +05:30
},
"commit": {
"id": 2366,
"sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
"message": "test\n",
"author_name": "User",
"author_email": "user@gitlab.com",
"status": "created",
"duration": null,
"started_at": null,
"finished_at": null
},
"repository": {
"name": "gitlab_test",
"description": "Atque in sunt eos similique dolores voluptatem.",
"homepage": "http://192.168.64.1:3005/gitlab-org/gitlab-test",
"git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git",
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
"visibility_level": 20
},
"runner": {
"active": true,
"runner_type": "project_type",
"is_shared": false,
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
"tags": [
"linux",
"docker"
]
},
"environment": null
}
```
## Deployment events
2021-12-11 22:18:48 +05:30
Deployment events are triggered when a deployment:
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
- Starts ([introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41214) in GitLab 13.5)
2021-11-18 22:05:49 +05:30
- Succeeds
- Fails
- Is cancelled
2021-12-11 22:18:48 +05:30
The `deployable_id` in the payload is the ID of the CI/CD job.
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Deployment Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "deployment",
"status": "success",
"status_changed_at":"2021-04-28 21:50:00 +0200",
"deployment_id": 15,
"deployable_id": 796,
"deployable_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/jobs/796",
"environment": "staging",
"project": {
"id": 30,
"name": "test-deployment-webhooks",
"description": "",
"web_url": "http://10.126.0.2:3000/root/test-deployment-webhooks",
"avatar_url": null,
"git_ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git",
"git_http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git",
"namespace": "Administrator",
"visibility_level": 0,
"path_with_namespace": "root/test-deployment-webhooks",
"default_branch": "master",
"ci_config_path": "",
"homepage": "http://10.126.0.2:3000/root/test-deployment-webhooks",
"url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git",
"ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git",
"http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git"
},
"short_sha": "279484c0",
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"email": "admin@example.com"
},
"user_url": "http://10.126.0.2:3000/root",
"commit_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468",
"commit_title": "Add new file"
}
```
## Group member events **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/260347) in GitLab 13.7.
Member events are triggered when:
2021-12-11 22:18:48 +05:30
- A user is added as a group member.
- The access level of a user changes.
- The expiration date for user access is updated.
- A user is removed from the group.
2021-11-18 22:05:49 +05:30
### Add member to group
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Member Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"created_at": "2020-12-11T04:57:22Z",
"updated_at": "2020-12-11T04:57:22Z",
"group_name": "webhook-test",
"group_path": "webhook-test",
"group_id": 100,
"user_username": "test_user",
"user_name": "Test User",
"user_email": "testuser@webhooktest.com",
"user_id": 64,
"group_access": "Guest",
"group_plan": null,
"expires_at": "2020-12-14T00:00:00Z",
"event_name": "user_add_to_group"
}
```
### Update member access level or expiration date
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Member Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"created_at": "2020-12-11T04:57:22Z",
"updated_at": "2020-12-12T08:48:19Z",
"group_name": "webhook-test",
"group_path": "webhook-test",
"group_id": 100,
"user_username": "test_user",
"user_name": "Test User",
"user_email": "testuser@webhooktest.com",
"user_id": 64,
"group_access": "Developer",
"group_plan": null,
"expires_at": "2020-12-20T00:00:00Z",
"event_name": "user_update_for_group"
}
```
### Remove member from group
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Member Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"created_at": "2020-12-11T04:57:22Z",
"updated_at": "2020-12-12T08:52:34Z",
"group_name": "webhook-test",
"group_path": "webhook-test",
"group_id": 100,
"user_username": "test_user",
"user_name": "Test User",
"user_email": "testuser@webhooktest.com",
"user_id": 64,
"group_access": "Guest",
"group_plan": null,
"expires_at": "2020-12-14T00:00:00Z",
"event_name": "user_remove_from_group"
}
```
## Subgroup events **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/260419) in GitLab 13.9.
Subgroup events are triggered when:
2021-12-11 22:18:48 +05:30
- A [subgroup is created in a group](#create-a-subgroup-in-a-group).
- A [subgroup is removed from a group](#remove-a-subgroup-from-a-group).
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
### Create a subgroup in a group
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Subgroup Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"created_at": "2021-01-20T09:40:12Z",
"updated_at": "2021-01-20T09:40:12Z",
"event_name": "subgroup_create",
"name": "subgroup1",
"path": "subgroup1",
"full_path": "group1/subgroup1",
"group_id": 10,
"parent_group_id": 7,
"parent_name": "group1",
"parent_path": "group1",
"parent_full_path": "group1"
}
```
2021-12-11 22:18:48 +05:30
### Remove a subgroup from a group
2021-11-18 22:05:49 +05:30
2022-08-27 11:52:29 +05:30
This webhook is not triggered when a [subgroup is transferred to a new parent group](../../group/manage.md#transfer-a-group).
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Subgroup Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"created_at": "2021-01-20T09:40:12Z",
"updated_at": "2021-01-20T09:40:12Z",
"event_name": "subgroup_destroy",
"name": "subgroup1",
"path": "subgroup1",
"full_path": "group1/subgroup1",
"group_id": 10,
"parent_group_id": 7,
"parent_name": "group1",
"parent_path": "group1",
"parent_full_path": "group1"
}
```
2021-12-11 22:18:48 +05:30
## Feature flag events
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Feature flag events are triggered when a feature flag is turned on or off.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Feature Flag Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"object_kind": "feature_flag",
"project": {
"id": 1,
"name":"Gitlab Test",
"description":"Aut reprehenderit ut est.",
"web_url":"http://example.com/gitlabhq/gitlab-test",
"avatar_url":null,
"git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"git_http_url":"http://example.com/gitlabhq/gitlab-test.git",
"namespace":"GitlabHQ",
"visibility_level":20,
"path_with_namespace":"gitlabhq/gitlab-test",
"default_branch":"master",
"ci_config_path": null,
"homepage":"http://example.com/gitlabhq/gitlab-test",
"url":"http://example.com/gitlabhq/gitlab-test.git",
"ssh_url":"git@example.com:gitlabhq/gitlab-test.git",
"http_url":"http://example.com/gitlabhq/gitlab-test.git"
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"email": "admin@example.com"
},
"user_url": "http://example.com/root",
"object_attributes": {
"id": 6,
"name": "test-feature-flag",
"description": "test-feature-flag-description",
"active": true
}
}
```
## Release events
2021-12-11 22:18:48 +05:30
Release events are triggered when a release is created or updated.
2021-11-18 22:05:49 +05:30
2021-12-11 22:18:48 +05:30
The available values for `object_attributes.action` in the payload are:
- `create`
- `update`
Request header:
2021-11-18 22:05:49 +05:30
```plaintext
X-Gitlab-Event: Release Hook
```
2021-12-11 22:18:48 +05:30
Payload example:
2021-11-18 22:05:49 +05:30
```json
{
"id": 1,
"created_at": "2020-11-02 12:55:12 UTC",
2022-07-23 23:45:48 +05:30
"description": "v1.1 has been released",
2021-11-18 22:05:49 +05:30
"name": "v1.1",
"released_at": "2020-11-02 12:55:12 UTC",
"tag": "v1.1",
"object_kind": "release",
"project": {
"id": 2,
"name": "release-webhook-example",
"description": "",
"web_url": "https://example.com/gitlab-org/release-webhook-example",
"avatar_url": null,
"git_ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git",
"git_http_url": "https://example.com/gitlab-org/release-webhook-example.git",
"namespace": "Gitlab",
"visibility_level": 0,
"path_with_namespace": "gitlab-org/release-webhook-example",
"default_branch": "master",
"ci_config_path": null,
"homepage": "https://example.com/gitlab-org/release-webhook-example",
"url": "ssh://git@example.com/gitlab-org/release-webhook-example.git",
"ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git",
"http_url": "https://example.com/gitlab-org/release-webhook-example.git"
},
"url": "https://example.com/gitlab-org/release-webhook-example/-/releases/v1.1",
"action": "create",
"assets": {
"count": 5,
"links": [
{
"id": 1,
"external": true,
"link_type": "other",
"name": "Changelog",
"url": "https://example.net/changelog"
}
],
"sources": [
{
"format": "zip",
"url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.zip"
},
{
"format": "tar.gz",
"url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.gz"
},
{
"format": "tar.bz2",
"url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.bz2"
},
{
"format": "tar",
"url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar"
}
]
},
"commit": {
"id": "ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8",
"message": "Release v1.1",
"title": "Release v1.1",
"timestamp": "2020-10-31T14:58:32+11:00",
"url": "https://example.com/gitlab-org/release-webhook-example/-/commit/ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8",
"author": {
"name": "Example User",
"email": "user@example.com"
}
}
}
```