Return deploy ID for build hooks

We use build hooks to trigger deploys from our CMS apps. We have a monitor feature in the CMS that tracks the status of the deploys by polling the API.

It would be great if we could get the deploy ID returned from the build hook POST to enable more granular, reliable tracking of the deploys.

Currently during our polling process we are looking for the current running deploy. While this somewhat works, it does feel a bit frail. Having the exact ID returned for the build hook would be ideal.


Hi, @jasonfine. What kind of flexibility do you have in the CMS regarding triggering builds?

I ask because the most direct solution that I know of would be to make the API call directly (instead of the webhook) and the parse the deploy id from the API call’s JSON response.

For example, you can trigger a build using the Netlify CLI tool. This tool is designed to be installed and used in third-party systems and services (GitHub Actions, third-party CI/CD systems, custom build scripts, etc.).

If you are able to do so, installing the Netlify CLI tool on the CMS system and then triggering build using it instead would allow you to get the deploy id when triggering the build.

Note: I am not suggesting making manual deploys using the CLI tool.

Instead, I’m suggesting using the CLI tool to trigger deploys. This is an example of using the CLI to call the API to trigger a build and deploy at Netlify:

NETLIFY_AUTH_TOKEN="TOKEN HERE" netlify api createSiteDeploy --data '{ "site_id": "SITE ID HERE"}'

That will trigger a deploy at Netlify and the JSON output it generates will have the deploy id as the first key/value pair (in additional to a wealth of other metadata).

That all said, I don’t know if your CMS will allow for this or not.

We can also enter a feature request for the webhook to return this information but I cannot say when (or even if) that will occur. This is why I’m looking for workarounds.

Hi Luke, thanks for the reply! The CMS are Rails apps running in a Docker environment, so we can really do anything we want with them. It sounds like in this case we’d install the Netlify CLI tool and just run commands on it from within the Rails app.

Sounds like this could work! thanks again.