Webhook Custom Template Overview

Service Type

A service refers to a third-party application service, typically based on an HTTP server. Currently, Leiga primarily supports the following service types: Leiga service, which is suitable for personalized customization and development by users.

Event Type

An event refers to information generated by the system itself or user operations that trigger events. Events include relevant business data and basic event information. Currently, Leiga supports the following events:

  • Work

    • Create Work

    • Update Work

    • Delete Work

  • Comment

    • Add Comment

    • Update Comment

    • Delete Comment

  • Attachment

    • Upload Attachment

    • Delete Attachment

  • Subtask

    • Add Subtask

    • Update Subtask

    • Delete Subtask

  • Linked Work

    • Add Linked Work

    • Delete Linked Work

  • Sprint

    • Create Sprint

    • Start / Restart Sprint

    • Complete Sprint

    • Delete Sprint

The data content of events varies depending on the type of event. Please refer to the following data structure: Webhook Custom Template Variables

Leiga Custom JSON Template:

Currently, the system does not support custom template configuration options in Leiga format. All messages will be sent using the following template:

{
    "type": 
${event.type.id},
    "date": $
{trigger.date},
    "tenant": 
${tenant},
    "trigger": $
{trigger},
    "data": {
        "issue": 
${issue},
        "comment": $
{comment},
        "attachment": 
${attachment},
        "subtask": $
{subtask},
        "relationIssue":${relationIssue}
        "sprint": ${sprint}
    }
}

Request data example:

{
    "date": 1676627206432,
    "data": {
        "issue": {
            "summary": "Webhook Customized Leiga Service Messages",
            "dueDate": 1676628000000,
            "description": "The primary service we currently offer is called Leiga Service.",
            "project": {
                "name": "Sample Project",
                "description": "Click here to explore a sample project and discover the key features of Leiga!",
                "id": 900
            },
            "updateTime": 1676627206432,
            "priority": {
                "optionKey": "Medium",
                "name": "Medium",
                "id": 1200
            },
            "type": {
                "code": "story",
                "name": "story",
                "id": 1100
            },
            "url": "https://ligai.cn/app/work",
            "number": 8,
            "createBy": {
                "phone": "12345678901",
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },
             "follows": [
                {
                  "id": 101,
                  "name": "Bob",
                  "phone": "",
                  "email": "bob.test@leiga.com"
                 },
                 { "id": 102,
                   "name": "Alex",
                   "phone": "",
                   "email": "Alex.test@gleiga.com"
                  }
             ],
            "estimatePoint": {
                "autoCalculateFlag": 0,
                "value": 8
            },
            "createTime": 1676627206432,
            "updateBy": {
                "phone": "12345678901",
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },

            "id": 100,
            "startDate": 1676595600000,
            "status": {
                "code": "story-todo",
                "name": "No-started",
                "id": 4,
                "category": {
                    "name": "Todo",
                    "id": 4
                }
            }
        }
    },
    "trigger": {
        "date": 1676627206432,
        "user": {
            "phone": "12345678901",
            "name": "Bob",
            "id": 101,
            "email": "bob.test@leiga.com"
        }
    },
    "type": "Issue.Create",
    "tenant": {
        "id": 1
    }
}

Leiga Service Description

  • Request Method: POST

  • Request Header

  • Request body data format: application/json; charset=utf-8. Default data format example:

{
    "date": 1675329348640,
    "data": {
        "issue": {
            "owner": {
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },
            "summary": "Webhook Custom Leiga Service Message",
            "dueDate": 1675332000000,
            "sprint": {
                "name": "Name of the Sprint",
                "id": 1400
            },
            "description": "The primary service we currently offer is called Leiga Service.",
            "project": {
                "name": "Sample Project",
                "description": "Click here to explore a sample project and discover the key features of Leiga!",
                "id": 900
            },
            "updateTime": 1675329348640,
            "priority": {
                "optionKey": "Highest",
                "name": "Highest",
                "id": 1200
            },
            "type": {
                "code": "story",
                "name": "Story",
                "id": 1100
            },
            "url": "https://ligai.cn/app/work",
            "number": 21,
            "createBy": {
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },
            "estimatePoint": {
                "autoCalculateFlag": 0,
                "value": 13
            },
            "createTime": 1675325728466,
            "updateBy": {
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },
            "assignee": {
                "name": "Bob",
                "id": 101,
                "email": "bob.test@leiga.com"
            },
            "follows": [{
                            "id": 101,
                            "name": "Bob",
                            "phone": "",
                            "email": "bob.test@leiga.com"
                    },
                    {
                            "id": 102,
                            "name": "Alex",
                            "phone": "", 
                            "email": "Alex.test@leiga.com"
                    }
            ],
            "id": 100,
            "startDate": 1675213200000,
            "status": {
                "code": "scrum-development",
                "name": "Developer",
                "id": 4,
                "category": {
                    "name": "In Progress",
                    "id": 3
                }
            }
        }
        ,"relationIssue": {
                "destineIssues": [
                                {
                                        "destinationProjectId": 225724408,
                                        "destinationIssueId": 276042168,
                                        "relationshipType": "CAUSES"
                                }
                        ],
                        "fromIssue": {
                                "actionType": "delete",
                                "fromIssueId": 276135673
                        }
        },
        "sprint":{
            "goal": "Example Sprint Goals",
            "assigneeName": "Bob",
            "endDate": 1712592000000,
            "name": "[Example] Name of the Sprint",
            "closed": 1,
            "started": 1,
            "assignee": 101,
            "id": 1400,
            "projectId": "900",
            "startDate": 1711382400000,
            "completeDate": 1711422314378,
            "status": 4
        }
    },
    "customFields": [
                {
                        "customFieldName": "Cause of defect",
                        "fieldCode": "customfield_50776203",
                        "fieldValue": [
                                {
                                        "name": "Code error",
                                        "value": 50776207
                                }
                        ]
                }
        ],
    
    "trigger": {
        "date": 1675329348640,
        "user": {
            "name": "Bob",
            "id": 101,
            "email": "bob.test@leiga.com"
        }
    },
    "type": "Issue.Update",
    "tenant": {
        "id": 1
    }
}
  • Response requirements after receiving a webhook:

After receiving an HTTP POST request, the application needs to respond to the request within 3 seconds with an HTTP 200 status code and the following JSON response body. Otherwise, this push will be considered a failure, and in the WebHooks-Send Records corresponding to the webhook, this request will be recorded as a failed request.

{
 "errcode": 0
 }
  • Timeout Description:

Connection timeout: 3 seconds, request timeout: 3 seconds, total: 6 seconds.

Appendix 1: Template Variables

Last updated