Skip to content
netwolfuk edited this page Apr 14, 2018 · 4 revisions

Since 1.1 Alpha16

It's possible to add custom headers to a webhook request by adding a <headers> element to the plugin-settings.xml file.

An example configuration:

      <headers>
        <header name="my-header-showing-build-name" value="${buildName}" />
      </headers>

Note: if you simply want to add a Basic Auth or Bearer auth header, it is easier to just configure Authentication in the UI inside the Extra Config tab when editing or creating a webhook.

The following shows the headers element in context:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
  <webhooks enabled="true">
    <webhook url="http://localhost:58001/200" enabled="true" format="JSON">
      <states>
        <state type="buildStarted" enabled="true" />
        <state type="changesLoaded" enabled="true" />
        <state type="beforeBuildFinish" enabled="true" />
        <state type="buildFinished" enabled="true" />
        <state type="buildBroken" enabled="false" />
        <state type="buildInterrupted" enabled="true" />
        <state type="buildSuccessful" enabled="true" />
        <state type="buildFixed" enabled="false" />
        <state type="buildFailed" enabled="true" />
        <state type="responsibilityChanged" enabled="true" />
      </states>
      <headers>
        <header name="my-header-showing-build-name" value="${buildName}" />
      </headers>
    </webhook>
  </webhooks>
</settings>