Overview

Ticket House can receive webhook notifications from Jenkins to track build status on tickets. When a build starts, succeeds, or fails, Jenkins sends a webhook to Ticket House, which updates the ticket with the build result and a link to the Jenkins build.

Setting Up the Webhook

Add a webhook step to your Jenkinsfile that posts build status to your Ticket House server. The webhook URL follows this pattern:

https://your-server.example.com/api/projects/<slug>/webhooks/ci

Example Jenkinsfile

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'npm install && npm run build'
            }
        }
        stage('Test') {
            steps {
                sh 'npm test'
            }
        }
    }
    post {
        success {
            sh """
                curl -X POST \\
                  https://your-server.example.com/api/projects/my-app/webhooks/ci \\
                  -H 'Content-Type: application/json' \\
                  -d '{
                    "ticketId": "${env.BRANCH_NAME}",
                    "status": "success",
                    "buildUrl": "${env.BUILD_URL}"
                  }'
            """
        }
        failure {
            sh """
                curl -X POST \\
                  https://your-server.example.com/api/projects/my-app/webhooks/ci \\
                  -H 'Content-Type: application/json' \\
                  -d '{
                    "ticketId": "${env.BRANCH_NAME}",
                    "status": "failure",
                    "buildUrl": "${env.BUILD_URL}"
                  }'
            """
        }
    }
}

Webhook Payload

Field Description
ticketId The ticket ID or branch name to associate the build with
status Build result: pending, success, or failure
buildUrl URL to the Jenkins build page

Ticket House matches the ticketId field to a ticket by looking for the ticket ID pattern in the branch name (e.g., ma-5-fix-login matches ticket MA-5).