What Is a Generic Webhook's Data Structure?

Information sent by a generic webhook is delivered with a POST request that has the application/json content-type, and the UTF-8 character set, in a Message object.

These are the Message object's fields:

Field Description

apiVersion

Version of the API that changes when the payload format of the request changes

messageId

Unique identifier of the message

timestamp

Timestamp of the message when it was generated

testEvent

Set to true if this event is generated by the Test button

projectId

Unique identifier of the project

events

List of events delivered by the message

Each event delivered by the message follows a common structure. These are its fields:

Field Description

eventId

Type of the event (ISSUE/PUSH/BUILD/REVIEW/ACTIVITY)

projectId

Unique identifier of the project

timestamp

Timestamp of the event

data

Data specific to the type of the event

The structure of data of each event type is described in the following sections.

ISSUE Event

The ISSUE event contains these fields:

Field Description

type

Type of the activity (CREATED - issue is created, COMMENTED - comment added, UPDATED - fields changed)

date

Timestamp of the activity

description

Description of the change

task

Description of the issue after the change

id

Issue ID

version

Change version

url

URL of the issue

title

Title of the issue

type

Type of the issue (Defect, Feature, or Task)

resolution

Resolution of the issue. The value is null if the issue isn’t resolved, otherwise, it’s set to one of the issue resolution values such as FIXED, DUPLICATE, and WORKSFORME.

reporter

User who reported the issue

asignee

User to whom the issue is assigned

comment

Content of the added comment, available if the activity type is COMMENTED

fieldUpdates

List of changed fields, available if the activity type is UPDATED

name

Field name

oldValue

Value before the change

newValue

Value after the change

Here's a JSON payload example for an issue create event:

   {
    "apiVersion": "1.0",
    "messageId": "04abc282-a44e-4c23-ba53-15b519d30066",
    "projectId": "qa-dev_example-project",
    "testEvent": false,
    "timestamp": 1417810876408,
    "events": [
        {
            "eventId": "ISSUE",
            "projectId": "example-project",
            "timestamp": 1417810876,
            "data": {
                "activities": [
                    {
                        "type": "CREATED",
                        "date": 1417810875820,
                        "description": "",
                        "author": {
                            "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                            "loginName": "alex.admin",
                            "realName": "Alex Admin"
                        },
                        "issue": {
                            "id": 2,
                            "resolution": null,
                            "title": "Test Issue",
                            "type": "Feature",
                            "url": "http://test-server/#projects/example-project/task/2",
                            "version": "1417810875834",
                            "reporter": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Admin"
                            }
                        }
                    }
                ]
            }
        }
    ]
   }

Here's a JSON payload example for an issue update event:

   {
    "apiVersion": "1.0",
    "messageId": "ccce183e-097d-4668-a07b-cf762108716e",
    "projectId": "qa-dev_example-project",
    "testEvent": false,
    "timestamp": 1417811058243,
    "events": [
        {
            "eventId": "ISSUE",
            "projectId": "example-project",
            "timestamp": 1417811058
            "data": {
                "activities": [
                    {
                        "type": "UPDATED"
                        "date": 1417811057698,
                        "description": "Assign to alex.admin\nset Resolution to FIXED\nset Status to RESOLVED\n",
                        "author": {
                            "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                            "loginName": "alex.admin",
                            "realName": "Alex Admin"
                        },
                        "issue": {
                            "id": 2,
                            "resolution": "FIXED",
                            "title": "Test Issue",
                            "type": "Feature",
                            "url": "http://test-server/#projects/example-project/task/2",
                            "version": "1417811057698",
                            "asignee": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Admin"
                            },
                            "reporter": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Admin"
                            }
                        },
                        "fieldUpdates": [
                            {
                                "name": "assigned_to",
                                "newValue": "alex.admin",
                                "oldValue": ""
                            },
                            {
                                "name": "resolution",
                                "newValue": "FIXED",
                                "oldValue": ""
                            },
                            {
                                "name": "bug_status",
                                "newValue": "RESOLVED",
                                "oldValue": "UNCONFIRMED"
                            }
                        ]
                    },
                    {
                        "type": "COMMENTED"
                        "date": 1417811057929,
                        "description": "Feature is implemented",
                        "author": {
                            "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                            "loginName": "alex.admin",
                            "realName": "Alex Admin"
                        },
                        "comment": {
                            "author": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Admin"
                            },
                            "date": 1417811057929,
                            "text": "Feature is implemented",
                            "type": "UNKNOWN"
                        },
                        "task": {
                            "id": 2,
                            "resolution": "FIXED",
                            "title": "Test Issue",
                            "type": "Feature",
                            "url": "http://test-server/#projects/qa-dev_example-project/task/2",
                            "version": "1417811057698",
                            "asignee": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Alex Admin"
                            },
                            "reporter": {
                                "gravatarHash": "8940829abebbc5d8d84e37af7161fd31",
                                "loginName": "alex.admin",
                                "realName": "Alex Admin"
                            }
                        }
                    }
                ]
            }
        }
    ]
  }

PUSH Event

The PUSH event contains these fields:

Field Description

refName

Updated references

commits

Commits of the Push event

sha

Commit identifier

comment

Comment in the commit

author

Author of the commit

date

Timestamp of the commit

parents

List of commit parent identifiers

repository

Name of the repository to which the commit was pushed

Here's a JSON payload example for a Git Push event:

  {
    "apiVersion": "1.0",
    "messageId": "c3378be6-6be5-4191-9b20-1fb5d429bfce",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1417810424512,
    "events": [
        {
            "eventId": "GIT_PUSH",
            "projectId": "example-project",
            "timestamp": 1417810424,
            "data": {
                "refName": "refs/heads/main",
                "commits": [
                    {
                        "sha": "32e03bc46a3a42eeab5dd25144a90c5b4f0b2e11",
                        "repository": "example-project.git",
                        "date": 1417810387000,
                        "comment": "file1.txt deleted, file3.txt created\n",
                        "author": {
                            "email": "alex.admin@example.com",
                            "firstName": "Alex",
                            "lastName": "Admin",
                            "username": "alex.admin"
                        },
                        "parents": [
                            "1106e8c81cb49e71024e9017235f89dc3983d4ee"
                        ]
                    },
                    {
                        "sha": "1106e8c81cb49e71024e9017235f89dc3983d4ee",
                        "repository": "example-project.git",
                        "date": 1417810290000,
                        "comment": "file2.txt updated\n",
                        "author": {
                            "email": "alex.admin@example.com",
                            "firstName": "Alex",
                            "lastName": "Admin",
                            "username": "alex.admin"
                        },
                        "parents": [
                            "8dab56fb6ba6dd0fc0d0aa8c7ce4f01d77fa0835"
                        ]
                    }
                ]
            }
        }
    ]
  }

BUILD Event

The BUILD event contains these fields:

Field Description

jobName

Name of the job

timestamp

Build timestamp

number

Build number

url

Build URL

result

Build result (SUCCESS/UNSTABLE/FAILURE/NOT_BUILT/ABORTED)

duration

Build duration

fileName

Name of the artifact

relativePath

Path relative to the job workspace

url

URL of the artifact

Here's a JSON payload example for a Build event:

  {
   "apiVersion":"1.0",
   "messageId":"4a253425-4598-4838-a4b5-aac30d0b9710",
   "timestamp":1417795613257,
   "testEvent":true,
   "projectId":"test-project",
   "events":[
      {
         "eventId":"BUILD",
         "projectId":"test-project",
         "timestamp":1417795613256,
         "data":{
            "jobName":"example-job",
            "details":{
               "timestamp":1417795590256,
               "number":16,
               "url":"http://server/test-dev/s2/test-project/hudson/job/test-project.example-job/16/",
               "result":"SUCCESS",
               "duration":36905,
               "artifacts":[
                  {
                     "fileName":"sample-1.0-SNAPSHOT.jar",
                     "relativePath":"sample-project/target/sample-1.0-SNAPSHOT.jar",
                     "url":"http://server/test-dev/s2/test-project/hudson/job/test-project.example-job/16/artifact/sample-project/target/sample-1.0-SNAPSHOT.jar"
                  }
               ]
            }
         }
      }
   ]
  }

REVIEW Event

The REVIEW event represents changes in merge requests and contains these fields:

Field Description

review

Description of the merge request

id

Unique ID of the merge request

title

Title of the merge request

created

Timestamp of the merge request creation

modified

Timestamp of the merge request last modification

reporter

Profile of the user who created the merge request

repository

Name of the Git repository

reviewBranch

Name of the review branch

targetBranch

Name of the target branch

user

Profile of the user who performed the action

action

Merge request action

These are the merge request actions:

  • CREATED: Merge request is created

  • COMMIT: New commits are pushed to the review branch

  • MERGED: Review branch is merged into the target branch

    The MERGED action is created if the review branch is merged via the Merge button in the web user interface. If the review branch is merged from a Git client (such as the Git command line interface), no action is generated.

  • REVIEWED: Reviewer approves or rejects a merge request

  • COMMENTED: A comment is added to the merge request

  • CLOSED: Merge request is closed

commits

List of commits added to the merge request

The commits field is generated for the COMMIT action. These fields are also generated for the commits action:

  • author: Author of the commit

  • message: Commit message

  • sha: SHA-1 checksum hash of the commit

text

Text of the comment

The text field is generated for the COMMENTED action.

comment

Comment of the rejected or approved review action

The comment field is generated for the REVIEWED action.

result

Result of the merge (FAST_FORWARD, FAST_FORWARD_SQUASHED, ALREADY_UP_TO_DATE, FAILED, MERGED, MERGED_SQUASHED, MERGED_SQUASHED_NOT_COMMITTED, CONFLICTING, ABORTED, MERGED_NOT_COMMITTED, NOT_SUPPORTED, CHECKOUT_CONFLICT)

The result field is generated for the MERGED action.

status

Status of the merge request (APPROVED, REJECTED, COMPLETED, CANCELLED)

The status field is generated for the REVIEWED and the CLOSED action.

Here's a JSON payload example for a REVIEW event.

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "action": "CREATED",
                "review": {
                    "created": 1431944319181,
                    "id": 6,
                    "modified": 1431944319635,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Alex Admin",
                        "username": "alex.admin"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Bug Fix"
                },
                "user": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                }
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1431944327
        }
    ],
    "messageId": "08758261-e4e7-4c8f-b9fe-7b74f715803f",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1431944329923
}


{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "action": "COMMIT",
                "commits": [
                    {
                        "author": "alex.admin",
                        "message": "fix version #3\n",
                        "sha": "8fd1d2a53a181aa7015e7535b6f64295c432eca7"
                    },
                    {
                        "author": "alex.admin",
                        "message": "fix version #2\n",
                        "sha": "ff2bdf91d0fb6fb664315879ec38acc0931beeb6"
                    }
                ],
                "review": {
                    "created": 1431944319181,
                    "id": 6,
                    "modified": 1431944340209,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Alex Admin",
                        "username": "alex.admin"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Bug Fix"
                },
                "user": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                }
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1431944353
        }
    ],
    "messageId": "5de98d08-49cd-4a19-86b5-d89757f75a1d",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1431944355646
}

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "user": {
                    "email": "clara.coder@example.com",
                    "firstName": "Clara",
                    "lastName": "Coder",
                    "username": "clara"
                },
                "review": {
                    "created": 1436521285722,
                    "id": 23,
                    "modified": 1438246154916,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Admin",
                        "username": "alex"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Some Review"
                },
                "action": "REVIEWED",
                "status": "REJECTED",
                "comment": "rejected the request because ...",
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1438246163
        }
    ],
    "messageId": "f0a75815-3470-4dc4-be82-975935152ed3",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1438246165924
}

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "action": "COMMENTED",
                "review": {
                    "created": 1431944319181,
                    "id": 6,
                    "modified": 1431944478701,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Alex Admin",
                        "username": "alex.admin"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Bug Fix"
                },
                "text": "General comment",
                "user": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                }
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1431945965
        }
    ],
    "messageId": "d2a36692-dae6-44d4-a112-7a615b524cc3",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1431945967166
}

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "action": "MERGED",
                "result": "FAST_FORWARD",
                "review": {
                    "created": 1431944319181,
                    "id": 6,
                    "modified": 1431944478701,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Alex Admin",
                        "username": "alex.admin"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Bug Fix"
                },
                "user": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                }
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1431945438
        }
    ],
    "messageId": "b06d5581-d38a-4972-9c80-dc1455547776",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1431945440287
}

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "action": "CLOSED",
                "review": {
                    "created": 1431944319181,
                    "id": 6,
                    "modified": 1431945453967,
                    "reporter": {
                        "email": "alex.admin@example.com",
                        "firstName": "Alex",
                        "lastName": "Alex Admin",
                        "username": "alex.admin"
                    },
                    "repository": "example-project.git",
                    "reviewBranch": "bug_branch",
                    "targetBranch": "main",
                    "title": "Bug Fix"
                },
                "status": "COMPLETED",
                "user": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                }
            },
            "eventId": "REVIEW",
            "projectId": "example-project",
            "timestamp": 1431945459
        }
    ],
    "messageId": "b434f6d2-b5c7-4c0a-bab2-3e6614025865",
    "projectId": "example-project",
    "testEvent": false,
    "timestamp": 1431945453967
}
  

ACTIVITY Event

The ACTIVITY event contains these fields:

Field Description

author

Profile of the user whose action produced the activity

The value is null for system activities.

name

Name of the activity

properties

Description of the activity, or the object whose fields depends on the name field.

These activities are supported:

  • BUILD: Triggered when a build in the integrated Hudson server ends.

  • DEPLOYMENT: Triggered when the application is deployed, undeployed, started, or stopped using Deploy page in the web user interface.

  • MEMBER: Triggered when a user is added, removed, or role is updated.

  • REVIEW: Triggered when a merge request is created, closed, or updated.

  • RSS: Triggered when a new article is acquired from a registered feed.

  • SCM_COMMIT: Triggered when a commit is pushed to a project repository.

  • SCM_REPO: Triggered when a project repository is added or removed.

  • TASK: Triggered when an issue is created or updated.

  • WIKI: Triggered when a wiki page is created or updated.

Here's a JSON payload example for an Activity event:

{
    "apiVersion": "1.0",
    "events": [
        {
            "data": {
                "author": {
                    "email": "alex.admin@example.com",
                    "firstName": "Alex",
                    "lastName": "Alex Admin",
                    "username": "alex.admin"
                },
                "name": "WIKI",
                "properties": {
                    "page": "New Page Title",
                    "type": "CREATED"
                }
            },
            "eventId": "ACTIVITY",
            "projectId": "example-project",
            "timestamp": 1432035029
        }
    ],
    "messageId": "45066d85-5a5c-4647-9a6c-43fc8e99481a",
    "projectId": "qa-dev_test-rss",
    "testEvent": false,
    "timestamp": 1432035031418
}