Format for POST request for notify webhook?

steps:
  - command: "tests.sh"

notify:
  - webhook: "https://webhook.site/32raf257-168b-5aca-9067-3b410g78c23a"

Hi, the above example is from the documentation. My requirement is that I need to POST a JSON object like

{
  username: "Mathew",
  branch: "FEAT-1234"
}

to a Slack plugin that provides a webhook URL. How can I perform such an operation using tests.sh?

Hi @mdmathewdc ,

Would you be able to clarify more how you intend to use the Webhook URL of the slack plugin?

As for Buildkite webhooks, this feature allows you to monitor and respond to events with your organisation. The payload contents depend on the event type. You can read more here Webhooks | Buildkite Documentation.

Cheers,
Lizette

Hi Lizette,

When a build is unblocked I want to POST a json object like

{
  username: "Mathew",
  branch: "FEAT-1234"
}

to a URL. How do I use that in combination with the notify property of BuildKite?
eg:

steps:
  - command: "tests.sh"

notify:
  - webhook: "https://webhook.site/32raf257-168b-5aca-9067-3b410g78c23a"

How can I send a custom JSON object to that particular web hook URL?

Hi @mdmathewdc ,

You wouldn’t be able to customise the content of the Webhook Notification’s payload request body. However, you will be able to retrieve enough information depending on the event you are registering for.

To do this, you can setup a Webhook Notification Service from your Organisation Settings->Notification Service->Webhook (Click on Add). Provide your Webhook URL and select the build Events that you are interested in. Then save the Webhook Settings.

You will be able to see a Request Log at the bottom of the page. It will have a view of all the request payloads sent.

Hope this helps!

Cheers,
Lizette