Netlify/js-client API method createSiteBuildHook(): Not able to set 'title' and 'branch'

Hello all,

I’m trying to create a build hook through the API, using netlify/js-client,
from a Node.js console script.

I’m calling netlify.createSiteBuildHook() and its successfully creating the

try {
        result = await netlify.createSiteBuildHook({
            site_id: 'SITE_ID',
            title: 'Build from function',
            branch: 'master'
    } catch (e) {

However, title and branch parameters seem to be ignored, as the hook in the
UI is created with empty name and branch.
Also, in the response, both fields are returned null.

This is the intercepted payload of the request and response:

"scope": "",
  "method": "POST",
  "path": "/api/v1/sites/SITE_ID/build_hooks",
  "body": "",
  "status": 201,
  "response": {
    "title": null,
    "branch": null,
    "url": "",
    "created_at": "2019-09-25T19:12:01.829Z",
    "id": "5d8bbc018b502a88aa760ed0",
    "site_id": "SITE_ID",
    "msg": "POST to trigger a build"

Is this a possible bug or am I calling the method the wrong way?


I can’t speak to writing code directly against that client, or whether that is a bug, but you can take a look at how our API does it when you create one using the guidance here:

If that doesn’t seem to match the client, then yup, I’d file a bug against the js-client for our tools team to take a look at!

Thanks @fool.

I’ll investigate further and open the issue, in case it’s a bug.

Thanks @ramigs . Opening an issue is the best way to get that fixed if there is a bug.

I’ve figured this out.

There’s no issue, it was a misunderstanding on my part regarding how the client
expects to receive path parameters vs body parameters.

This is the correct version of the code:

result = await netlify.createSiteBuildHook({
			site_id : siteId,
			body    : {
				title  : title,
				branch : branch

Working as expected. Thanks!