Webhook event list

Prev Next

Available in Classic and VPC

The following events can be registered in webhooks:

Note
  • When you select an event type, all sub-actions are detected.
  • You cannot select individual sub-actions within an event type.
Caution

When a new branch is created, only "create" events occur, and "push" events do not occur.

Event type Description Sub-action Reference for how to run action
push One or more commits pushed to the repository.
  • commit: Commit.
Using Git client
pull_request Operated pull request
  • opened: Triggered when a pull request is created.
  • closed: Triggered when a pull request is closed.
  • merged: Triggered when a pull request is merged.
  • edited: Triggered when a pull request is edited.
  • updated_head: Triggered when the HEAD of the pull request from branch changes.
Managing a repository - Using pull request
create Created branch or tag.
  • created: Creation.
Managing a repository - Managing branches
delete Deleted branch or tag.
  • deleted: Deletion.
Managing a repository - Managing branches
meta Deleted webhook. N/A Using a webhook - Deleting a webhook
repository Changed repository attribute.
  • edited: Triggered when repository description or File Safer usage attributes are changed.
Managing a repository - Changing repository settings
file_safer Completed File Safer malware scan.
  • done: Triggered when File Safer scan is completed.
File Safer malware scan
file_lock (LFS) File lock used
  • create: Triggered when LFS file lock is used.
  • delete: Triggered when LFS file unlock is used.
File lock

Configuring webhook payload

Webhook payload refers to the actual data forwarded when a webhook is called.

Caution
  • If the payload data size exceeds 65,535 bytes, the webhook call will fail.
  • When Content Type is set to application/x-www-form-urlencoded, the entire payload data is transferred as the value for the "payload" key in the request body.

Webhook payload format

The webhook payload is structured as follows.
event key section varies depending on the event type, while version, repository, sender, and timestamp have a consistent format.

{
    "version": <Webhook version>,
    "repository": {
        "id": <Repository ID>,
        "name": <Repository name>,
        "description": <Repository description>,
        "ssh_url": <Repository git ssh address>,
        "https_url": <Repository git https address>,
        "portaladdr": <Repository portal address>
        "created_at": <Creation date>,
        "owner": <Creator>
    },
    "sender": <Sender information>,
    "event": {
        "type": <Event type>
        "payload": <Event information>
    },
    "timestamp": <Time information>
}
Key Type Description Note
version string SourceCommit webhook version The latest webhook version is "v1."
repository.id number Repository ID value
repository.name string Repository name
repository.description string Repository description
repository.ssh_url string Repository git ssh address
repository.https_url string Repository git https address
repository.portaladdr string Repository portal address
repository.created_at number Repository creation date timestamp
repository.owner string User who created the repository
sender object Sender information See Sender information format.
event.type string Event type See Webhook events.
event.payload object Event information See Event details.
timestamp number Webhook call time unix timestamp

Sender information format

The sender information format is as follows:

  • When an event occurs using https git address

    {
        "mbrNo": <member-no>,
        "user_id": <user-id>,
        "id_no" : <id-No>
    }
    
  • When an event occurs using ssh git address

    {
        "mbrNo": <member-no>,
        "type": "Tenant" | "SubAccount",
        "user_id" : <user-id> // Provided only in case of subaccount
    }
    
  • When using the file_safer event

    {
      "mbrNo": <member-no>,
      "type": "system",
    }
    
Key Type Description Note
mbrNo string Customer number
id_no string Customer identification value
user_id string User ID

Complete payload example

Below is an example when event.type=create.

{
    "version": "v1",
    "repository": {
        "id": 123456,
        "name": "test-name",
        "description": "test-description",
        "ssh_url": "ssh://devtools.ncloud.com/test/test-repo.git",
        "https_url": "https://devtools.ncloud.com/test/test-repo.git",
        "portaladdr": "https://devtools.ncloud.com/test/test-repo",
        "created_at": 1662524215000,
        "owner": "test@sample.com"
    },
    "sender": {
        "mbrNo": "123456789",
        "id_no": "aaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee",
        "user_id": "test-user"
    },
    "timestamp": 1663208183206,
    "event": {
        "type": "create",
        "payload": {
            "ref": "refs/heads/<branch name>",
            "type": "branch",
            "name": <branch-name>,
            "action": "created",
            "before": "0000000000000000000000000000000000000000",
            "after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
            "sender": {
                "protocol": "https",
                "user_id": <user id>,
                "id_no": <id-no>
            },
            "head_commit": [
                {
                    "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                    "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                    "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                    "timestamp": "1655899275",
                    "author": {
                        "author_name": <author name>
                    },
                    "committer": {
                        "committer_name": <committer name>
                    },
                    "commit_message": <commit message>
                }
            ]
        }
    }
}

Individual event details

Event format in webhook payloads varies depending on the event type.

Details and example of push event details

{
    "type": "push",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "action": "commit",
        "before": "c3b67b4527cb196da2195082794cca1643aa7bba",
        "after":  "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {   
                "hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
                "tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
                "parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
                "timestamp": "1655899919",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ],
        "commits": [
            {   
                "hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
                "tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
                "parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
                "timestamp": "1655899919",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
Key Type Description Note
type string Event type "push"
payload.ref string push target ref information
payload.action string Sub-action "commit"
payload.before string Previous sha value
payload.after string Following sha value
payload.sender object Sender information
  • When using ssh git address
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account]" or "user_id"
  • When using https git address
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array Head commit of pushed commits
payload.head_commit[*].hash_id string hash_id of commit
payload.head_commit[*].tree_id string tree_id of commit
payload.head_commit[*].parent_hash_id string parent_hash_id of commit
payload.head_commit[*].timestamp string timestamp of commit
payload.head_commit[*].author.author_name string author_name of commit
payload.head_commit[*].committer.committer_name string committer_name of commit
payload.commits array List of pushed commits The most recent commit starts at index 0.
payload.commits[*].commit_message string commit_message of commit
payload.commits[*].hash_id string hash_id of commit
payload.commits[*].tree_id string tree_id of commit
payload.commits[*].parent_hash_id string parent_hash_id of commit
payload.commits[*].timestamp string timestamp of commit
payload.commits[*].author.author_name string author_name of commit
payload.commits[*].committer.committer_name string committer_name of commit
payload.commits[*].commit_message string commit_message of commit

create event details and example

{
    "type": "create",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "type": "branch",
        "name": <branch-name>,
        "action": "created",
        "before": "0000000000000000000000000000000000000000",
        "after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {
                "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                "timestamp": "1655899275",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
Key Type Description Note
type string Event type "create"
payload.ref string push target ref information
payload.type string Creation target type "branch" or "tag"
payload.action string Sub-action "created"
payload.before string Previous sha value
payload.after string Following sha value
payload.sender object Sender information
  • When using ssh git address
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account] or user_id""
  • When using https git address
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array Head commit of pushed commits
payload.head_commit[*].hash_id string hash_id of commit
payload.head_commit[*].tree_id string tree_id of commit
payload.head_commit[*].parent_hash_id string parent_hash_id of commit
payload.head_commit[*].timestamp string timestamp of commit
payload.head_commit[*].author.author_name string author_name of commit
payload.head_commit[*].committer.committer_name string committer_name of commit

delete event details and example

{
    "type": "delete",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "type": "branch",
        "name": <branch-name>,
        "action": "deleted",
        "before": "68ed6fc3e2cdf74af0fa1b3591ff593d1e28a4cb",
        "after": "0000000000000000000000000000000000000000",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {
                "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                "timestamp": "1655899275",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
Key Type Description Note
type string Event type "delete"
payload.ref string push target ref information
payload.type string Creation target type "branch" or "tag"
payload.action string Sub-action "deleted"
payload.before string Previous sha value
payload.after string Following sha value
payload.sender object Sender information
  • When using ssh git address
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account] or user_id""
  • When using https git address
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array Head commit of pushed commits
payload.head_commit[*].hash_id string hash_id of commit
payload.head_commit[*].tree_id string tree_id of commit
payload.head_commit[*].parent_hash_id string parent_hash_id of commit
payload.head_commit[*].timestamp string timestamp of commit
payload.head_commit[*].author.author_name string author_name of commit
payload.head_commit[*].committer.committer_name string committer_name of commit

pull_request event details and example

{
    "type": "pull_request",
    "payload": {
        "action": "opened" | "closed" | "merged" | "edited" | "updated_head",
        "pull_request_number": 10,
        "pull_request_title": <pull request name>,
        "pull_request_description": <pull request description>,
        "auto_merge_enable": true,
        "from": {
            "branch": "sub",
            "sha": <sha>
        },
        "to": {
            "branch": "master",
            "sha": <sha>
        },
        "sender": {
            "user_id": <user id>
        },
    }
}
Key Type Description Note
type string Event type "pull_request"
payload.action string Sub-action
  • opened: When a new pull request is created.
  • closed: When a pull request is closed.
  • merged: When a pull request is merged.
  • edited: When the title or description of a pull request is edited.
  • updated_head: When a push occurs to the from branch of a pull request.
payload.pull_request_number number Pull request number
payload.pull_request_title string Pull request title
payload.pull_request_description. string Pull request description
payload.auto_merge_enable boolean Whether the pull request can be merged without conflicts. Provided only when payload.action is "opened" or "updated_head"
from.branch string Name of the from branch
from.sha string sha value of the from branch
to.branch string Name of the to branch
to.sha string sha value of the to branch
sender.user_id string User id value

meta event details and example

{
    "type": "meta",
    "payload": {
        "webhook": {
            "id": <webhook id>,
            "name": <webhook name>
        }
    }
}
Key Type Description Note
type string Event type "meta"
payload.webhook.id number webhook id value
payload.webhook.name string webhook name

repository event details and example

{
    "type": "repository",
    "payload": {
        "action": "edited",
        "sender": {
            "user_id": <user id>
        },
        "before": {
            "description": "before description",
            "file_safer": true
        },
        "after": {
            "description": "after description",
            "file_safer": false
        }
    }
}
Key Type Description Note
type string Event type "repository"
payload.action string Sub-action "edited"
payload.sender.user_id string User ID
payload.before.description string Repository description before edit
payload.before.file_safer boolean Whether File Safer is enabled before edit
payload.after.description string Repository description after edit
payload.after.file_safer boolean Whether File Safer is enabled after edit

file_safer event details and example

{
    "type": "file_safer",
    "payload": {
        "target_hash": "123456117f77a541bdcb68d36234dbb317c7f1f7",
        "action": "done",
        "total_file_count": 1,
        "infected_file_count": 0,
        "request_date": "2022-09-14T11:24:28.000Z",
        "complete_date": "2022-09-14T11:24:40.000Z"
    }
}
Key Type Description Note
type string Event type "file_safer"
payload.target_hash string Target hash value
payload.action string Sub-action done
payload.total_file_count number Total number of scanned files
payload.infected_file_count number Total number of malicious files
payload.request_date string Scan request timestamp
payload.complete_date string Scan completion timestamp

file_lock event details and example

{
    "type": "file_lock",
    "payload": {
        "action": "create",
        "sender": {
            "user_id": <user id>
        },
        "path": "file.txt",
        "locked_time": "2022-01-01 00:00:00.00",
        "unlocked_time": "2022-01-01 00:00:00.00"
    }
}
Key Type Description Note
type string Event type "file_lock"
payload.action string Sub-action
  • create: When a file is locked.
  • delete: When a file is unlocked.
payload.sender.user_id string User id
path string File path
locked_time string Lock timestamp Provided only when payload.action is create.
unlocked_time string Unlock timestamp Provided only when payload.action is delete.