Skip to main content
Skip table of contents

Trigger Custom Webhooks

You can use Webhooks to send web requests to any external systems (ex : Jira, Confluence, Bamboo, Jenkins, Gitlab, etc.) in response to changes performed in Golive or in Jira.

For example, you may want to automatically trigger a deployment job:

  • when the deployed version of an environment is updated in Golive

  • when the status of an environment is changed

  • when a new issue is linked to an Environment

  • ...

Using Webhooks means that your external tools do not have to periodically poll Jira (via the REST API) to determine whether a change has occurred in Golive.

Create a new Webhook

Open Automations page and create a new Automation of type "Webhook" to start configuration of a new webhook:

Configure the Endpoint

In order to call an external HTTP system, you have to configure its endpoint and how it should be called:

  • Type of Request (POST, GET, PUT, DELETE,...)

  • URL to send the request to

  • Headers (opt): useful to send authentication information, token, ... required by your target system (ex: basic authentication)

Default Payloads (body)

Golive sends standard JSON payloads as body of POST, UPDATE and PUT requests. Example of payload sent when "Environment Updated" event is triggered:

JSON
{
  "timestamp": 1616408079845,
  "event": "environment:updated",
  "environment": {
    "id": 11,
    "application": {
      "id": 21,
      "name": "AppTest",
      "deploymentAttributes": []
    },
    "category": {
      "id": 31,
      "name": "CategoryTest",
      "order": 1
    },
    "environmentPermissionScheme": {
      "id": 41,
      "name": "PermSchemeTest",
      "global": false
    },
    "status": {
      "id": 51,
      "name": "Up",
      "description": "StatusDescription",
      "color": "BLUE",
      "order": 1
    },
    "url": "http://fakeurl",
    "urlHtml": "<a href=\"http://fakeurl\" target=\"_blank\">http://fakeurl</a>",
    "deployment": {
      "deploymentId": 1,
      "id": 1,
      "versionName": "VersionName",
      "versionId": "123",
      "deployedTime": 1616408079845,
      "categoryId": 31,
      "categoryName": "CategoryTest",
      "applicationId": 21,
      "applicationName": "AppTest",
      "endTime": 1616408079845,
      "duration": 1000,
      "buildNumber": "123",
      "description": "DeployedDescription",
      "attributes": {
        "Parameter": "ParameterValue"
      }
    },
    "attributes": {
      "Data Backup": "Data Backup Value",
      "Owner": "OwnerValue"
    }
  },
  "user": {
    "self": "https://jira-staging.apwide.com/rest/api/2/user?username=admin",
    "name": "admin",
    "key": "admin",
    "emailAddress": "david@apwide.com",
    "avatarUrls": {
      "48x48": "https://jira-staging.apwide.com/secure/useravatar?ownerId=admin&avatarId=10741",
      "24x24": "https://jira-staging.apwide.com/secure/useravatar?size=small&ownerId=admin&avatarId=10741",
      "16x16": "https://jira-staging.apwide.com/secure/useravatar?size=xsmall&ownerId=admin&avatarId=10741",
      "32x32": "https://jira-staging.apwide.com/secure/useravatar?size=medium&ownerId=admin&avatarId=10741"
    },
    "displayName": "Thomas Anderson",
    "active": true,
    "timeZone": "Europe/Zurich"
  },
  "environmentChanges": [
    {
      "fieldType": "URL",
      "field": "URL",
      "from": "http://fake.mycompany.com",
      "fromString": "http://fake.mycompany.com",
      "to": "http://fake.new.mycompany.com",
      "toString": "http://fake.new.mycompany.com"
    },
    {
      "fieldType": "Owner",
      "field": "Owner",
      "from": "John Smith",
      "fromString": "John Smith",
      "to": "Jane Doe",
      "toString": "Jane Doe"
    }
  ]
}

Custom Payloads (body)

Enable Custom Payload toggle to completely customize your payload to fit the format required by your external system. It can be any type of XML, TXT, CSV, YAML, JSON,... or other proprietary formats.

Thanks to the embedded editor, you can insert dynamic content into your payloads using expressions, conditions and loops (Pebble Templates), for example:

JSON
{
    execution: "{{timestamp}}",
    event: "{{webhookEvent}}",
    environmentName: "{{environment.application.name}} {{environment.category.name}}",
    
{% if environment.status is not null %}
     status: "{{environment.status.name}}",
    {% endif %}
    {% if environment.deployment is not null %}
     status: "{{environment.deployment.versionName}}",
    {% endif %}
     attributes: [
    {% for attribute in environment.attributes %}
      "{{attribute.key}}": "{{attribute.value}}"
    {% endfor %}


    ]
}

Test your Webhooks

You can inspect and debug the payloads, requests, responses,... accessing the execution logs in Automations Page as described here. It will greatly help you to understand what may be changed to fix integration issues.

There are also free and very useful online tools available to help you test/configure your Webhooks. One of them is :

https://requestbin.com/

It will generate a unique URL you can use to configure your Webhooks. You can then easily visualize what has been sent by Jira accessing this unique URL with your browser.

Example:

Example: trigger a Jenkins Job

Learn how it is easy to trigger Jenkins jobs using Golive Webhooks:

https://narenchejara.medium.com/trigger-jenkins-job-remotely-using-jenkins-api-20973618a493

Use our Golive Jenkins Shared Lib to call back the Golive REST API in order to update back your environments from your Jenkins pipelines

Jira Webhooks (legacy)

We recommend using Golive Automations for creating your Webhooks, as you get much more flexibility than using Jira webhooks.

Learn more about Jira Webhooks in the Atlassian Documentation: https://confluence.atlassian.com/adminjiraserver/managing-webhooks-938846912.html

Environment Webhook Events

The following Environment Events are available to create new WebHooks in Jira :

  • Environment Created (a new environment has been created)

  • Environment Edited (an existing environment has been edited)

  • Environment Deleted (an environment has been deleted)

  • Version Deployed (the deployed version of an environment has been changed)

  • Status Updated (the status of an environment has been changed)

  • Issue Associated (an issue has been associated to an environment)

  • Issue Dissociated (an issue has been dissociated to an environment)

Select which event(s) you want to associate to your webhook at the bottom of the Webhooks Jira admin page:

Environment Webhook URL Variables

You can append variables to the webhook URL when creating or updating a webhook. The variables are listed below:

JSON
${environment.id}
${environment.application}
${environment.category}
${environment.deployedVersion}
${environment.status}
${issue.key} (available for Issue Associated and Issue Dissociated)

You can use these variables to dynamically insert the value of the current environment (or issue that fired the event) into the webhook URL when it is triggered.

Note that Jira 7.x helps you selecting the variable you can use to configure your Webhook URL:

Environment Webhook Response Examples

When triggered, Environment Webhook Events post JSON response.

Environment Created response example

JSON
{
    "timestamp": 1477302280447,
    "webhookEvent": "environment:created",
    "environment": 
    {
        "id": 3,
        "url": "",
        "urlHtml": "",
        "customProperties": 
        [
            {
                "id": 1,
                "key": "PROPERTY_1",
                "name": "Description",
                "description": "General information about the environment, purpose of the environment,...",
                "active": true,
                "value": "",
                "valueHtml": ""
            },

            {
                "id": 2,
                "key": "PROPERTY_2",
                "name": "Details",
                "description": "Detailed information about the environment (ex : link on admin console, administrator,...)",
                "active": true,
                "value": "",
                "valueHtml": ""
            }
        ],

        "application": 
        {
            "id": 1,
            "name": "eCommerce"
        },

        "category": 
        {
            "id": 1,
            "name": "Dev 1"
        },

        "environmentPermissionScheme": 
        {
            "id": 1,
            "name": "Default EnvironmentPermission Scheme"
        }
    },

    "user": 
    {
        "self": "http://localhost:2990/jira/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "emailAddress": "admin@admin.com",
        "avatarUrls": 
        {
            "48x48": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=48",
            "24x24": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=24",
            "16x16": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=16",
            "32x32": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=32"
        },

        "displayName": "admin",
        "active": true,
        "timeZone": "Europe/Zurich"
    }
}

Issue Associated response example

JSON
{
    "timestamp": 1477302500095,
    "webhookEvent": "environment:env_customfield_value_added",
    "environment": 
    {
        "id": 1,
        "url": "https://preprod-your-company.com/shop",
        "urlHtml": "<a href=\"https://preprod-your-company.com/shop\" target=\"_blank\">https://preprod-your-comp..</a>",
        "customProperties": 
        [
            {
                "id": 1,
                "key": "PROPERTY_1",
                "name": "Description",
                "description": "General information about the environment, purpose of the environment,...",
                "active": true,
                "value": "PreProd Corporate Shop\nContact:deployment-team@your-company.com\nCalendar:https://preprod-calendar.your-company.com\nCMS access:https://preprod-your-company.com/admin-console",
                "valueHtml": "PreProd Corporate Shop\nContact:\n<a href=\"mailto:deployment-team@your-company.com\">deployment-team@your-comp..</a>\nCalendar:\n<a href=\"https://preprod-calendar.your-company.com\" target=\"_blank\">https://preprod-calendar...</a>\nCMS access:\n<a href=\"https://preprod-your-company.com/admin-console\" target=\"_blank\">https://preprod-your-comp..</a>"
            },

            {
                "id": 2,
                "key": "PROPERTY_2",
                "name": "Details",
                "description": "Detailed information about the environment (ex : link on admin console, administrator,...)",
                "active": true,
                "value": "DB:Oracle 11.x\nLoadbalanced (4 nodes)\nCDN enabled (Akamai)\nData Refreshed every night",
                "valueHtml": "DB:Oracle 11.x\nLoadbalanced (4 nodes)\nCDN enabled (Akamai)\nData Refreshed every night"
            }
        ],

        "application": 
        {
            "id": 1,
            "name": "eCommerce"
        },

        "category": 
        {
            "id": 12,
            "name": "PreProd"
        },

        "environmentPermissionScheme": 
        {
            "id": 1,
            "name": "Default EnvironmentPermission Scheme"
        }
    },

    "environmentCustomFieldChange": 
    {
        "field": "Detected In",
        "fieldtype": "custom",
        "from": null,
        "fromString": null,
        "to": "1",
        "toString": "eCommerce PreProd"
    },

    "issueId": 10000,
    "issueKey": "TEST-1",
    "issueType": "Bug",
    "issueSummary": "Checkout is Broken",
    "issueStatus": "To Do",
    "user": 
    {
        "self": "http://localhost:2990/jira/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "emailAddress": "admin@admin.com",
        "avatarUrls": 
        {
            "48x48": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=48",
            "24x24": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=24",
            "16x16": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=16",
            "32x32": "http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028?d=mm&amp;s=32"
        },

        "displayName": "admin",
        "active": true,
        "timeZone": "Europe/Zurich"
    }
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.