Using webhooks


Bamboo webhooks allow you to send selected real-time information about Bamboo to third-party application. For example, display Bamboo build status in your team's chatroom, or signal an alarm in case a plan fails. 

By default, Bamboo comes with two webhook templates that you can use:

  • Build webhook

    Show me the template...

    Method: POST

    Payload:

    {
      "uuid": "${bamboo.webhook.uuid}",
      "timestamp": "${bamboo.webhook.timestamp}",
      "notification": "${bamboo.webhook.notification.description}",
      "webhook": {
        "webhookTemplatedId": "${bamboo.webhook.template.id}",
        "webhookTemplatedName": "${bamboo.webhook.template.name}"
      },
      "build": {
        "buildResultKey": "${bamboo.buildResultKey}",
        "status": "${bamboo.buildState}",
        "buildPlanName": "${bamboo.buildPlanName}",
        "startedAt": "${bamboo.date.started}",
        "finishedAt": "${bamboo.date.finished}",
        "triggerReason": "${bamboo.trigger.reason}",
        "triggerSentence": "${bamboo.trigger.name.for.sentence}"
      }
    }

    Headers:

    content-type:application/json
  • Deployment webhook

    Show me the template...

    Method: POST

    Payload:

    {
      "uuid" : "${bamboo.webhook.uuid}",
      "timestamp" : "${bamboo.webhook.timestamp}",
      "notification" : "${bamboo.webhook.notification.description}",
      "webhook" : {
        "webhookTemplatedId" : "${bamboo.webhook.template.id}",
        "webhookTemplatedName" : "${bamboo.webhook.template.name}"
      },
      "deployment" : {
        "deploymentResultId" : "${bamboo.deploy.result.id}",
        "status" : "${bamboo.buildState}",
        "deploymentProjectId" : "${bamboo.deploy.project.id}",
        "environmentId" : "${bamboo.deploy.environment.id}",
        "environmentName": "${bamboo.deploy.environment.name}",
        "deploymentVersionId" : "${bamboo.deploy.version.id}",
        "deploymentVersionName" : "${bamboo.deploy.version.name}",
    
        "startedAt" : "${bamboo.date.started}",
        "finishedAt" : "${bamboo.date.finished}",
        "agentId" : "${bamboo.agentId}",
    
        "triggerReason" : "${bamboo.trigger.reason}",
        "triggerSentence" : "${bamboo.trigger.name.for.sentence}"
      }
    }

    Headers:

    content-type:application/json

You can modify the existing templates to suit your needs, or create your own templates, which can later be defined as notifications. 

If you're using webhooks in your deployments, you can check their status in the deployment details screen. Once you click on the webhook details, you will see a table with all webhooks responses related to the current deployment. If you can't see the table, it means that no webhooks have been sent. 
The table is visible for all users who can see build results. The table contains basic information about webhook response: its status code, status, URL, event name, template name, send and receive time. Plan administrator has permissions to view webhook details: response header and body. If any secret variables are used URL, body or header, they will be hidden.

Before you begin

Only Bamboo administrators can add, edit, and delete webhook tamplates. 

To create a webhook teplate:
  1. Go to  > Communication.
  2. From the left-hand side menu, select Webhook templates
  3.  Click Add template.
  4. Provide details the following details for your new webhook template:
    • Name

    • Http Method

    • Payload 

    • Headers

      You can use Bamboo variables when editing webhook payload and headers.

  5. Click Add

Your webhook template is ready to use. You can define it as a notification type in your plan and jobs configuration, see Configuring notifications for a plan and its jobs

To edit a webhook teplate:
  1. Go to  > Communication
  2. From the left-hand side menu, select Webhook templates
  3. Next to the webhook template you want to change, click the Edit button.
  4. Make you changes to the webhook template.
  5. Click Save.
To delete a webhook template:
  1. Go to  > Communication
  2. From the left-hand side menu, select Webhook templates
  3. Next to the webhook template you want to delete, click the Delete button.


Last modified on Nov 13, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.