Triggering a preview build via a webhook


Is it possible to trigger a preview build via a webhook.


Hi! You can set up a build hook you can use to trigger a new deploy. Our Build & Deploy document has some more details. You’ll need to make sure you have a git repo linked to your site if you don’t see the option in your settings. Hope that helps!


Hi! I don’t think this fully answers the question.

The docs say we can trigger a branch deploy via webhook. (

The docs don’t mention triggering a deploy preview via webhook.

Our use case would be to run some CI steps in GitLab - testing, performance, etc., before starting Netlify’s build+deploy process.

I could wire this up for branches (using the webhook) but it doesn’t appear this is possible for merge request deploy previews, unless the docs are out of date.


Ah, right, you won’t be able to trigger a deploy preview using build hooks. You can only define what branch a build hook will trigger. However a deploy preview is essentially the same as a branch preview, just with a different context, so if you know that a branch has a PR, you can trigger a deploy for that branch and that would be the same as far as the content is concerned.

Did you have a particular usecase where you need to trigger a deploy preview specifically?

1 Like

My understanding is that a deploy preview is a preview of what the site would look like after the merge. So a branch build would only include the contents of that branch, the preview deploy would include the merged contents of the current branch and the target branch. Thus triggering a branch deploy wouldn’t be the same as a merge deploy. Is that understanding correct?

The use case - for both branch deploys and deploy previews - would be to run our GitLab pipeline (tests, etc) before actually doing the deploy.