DEV Community


Triggering a deploy in Netlify automatically when updating content in Strapi.

cwraytech profile image Christopher Wray Originally published at ・2 min read

I still need to write an article about hosting my portfolio. It is hosted for free. That article is coming, I promise!

But, in the meantime, I was so blown away with how easy it is to automatically deploy a static website in Netlify + Strapi that I had to share.

Netlify offers a feature called "Build hooks".

These are unique URLs that you can configure for your application to trigger deployments automatically whenever a post request is made to that endpoint.

And with Strapi, build hooks are incredibly easy to integrate.

First, go to the Netlify Deployment Settings in your project, and find the area for Build hooks.

There, you will have an option to create a new build hook. Give it a memorable name, and click save.

Adding a build hook in Netlify

Then, copy the URL that is configured for that build hook.

Once that is done, You will want to add the build hook as a webhook in the Strapi Admin panel.

You can do this by going to "Settings > Webhooks" within Strapi.

Once you are in the Webhooks panel, add a new webhook for the URL that you just configured in Netlify.

Strapi webhook panel

You will want to add the appropriate URL and configure the settings to your liking.

Paste the URL that you copied from Netlify into the URL field, give the webhook a memorable name, and choose the appropriate settings for when you want to publish your changes automatically!

Isn't that cool?

Once you save your changes, go ahead and try updating some content on your site and see the wonder!

Discussion (4)

Editor guide
pratamatama profile image
Furukawa Fukka

Hi there, nice post!

By the way, I still learning about Jamstack and get confused with how it should work. Is it necessary to put the strapi app on a hosting? Or just running it on a localhost with that hook will be enough? I'm trying to get full static.

cwraytech profile image
Christopher Wray Author

Running it locally should work just fine too!

hahuaz profile image

hi, it's great that you sharing all the processes.

josefinferrada profile image
josefin ferrada rivas

hi, is it just add the webhook url of netlify? what about the headers? . It doesn't work for me, it doesn't update immediately when adding in strapi cms :(