A Gatsby Builds webhook lets you programmatically trigger builds of your Gatsby projects. By registering this webhook with the Optimizely Graph webhook endpoint, you can automate builds whenever specific events occur, such as content updates or changes to your data source. You can then test the content modification using Optimizely Content Management System (CMS).
To create a Gatsby Builds webhook:
Go to the Gatsby Site Settings > Webhook in the Gatsby Cloud dashboard.
Copy the Builds Webhook URL. (You will need it in the next step.)
- Use the Optimizely Graph webhook API endpoint
POST https://cg.optimizely.com/api/webhooksto register the webhook.
- Make a POST request to the Optimizely Graph webhook API endpoint.
- Set the necessary parameters in the request payload, including the URL endpoint of your Gatsby Builds Webhook obtained earlier, along with any additional configurations required by the Optimizely Graph webhook API.
- Send the request and wait for a response from the Optimizely Graph webhook API.
- Upon successful registration, the API will respond with the details of the registered webhook, including its unique identifier.
Access the CMS Dashboard for your project.
Make changes to a content item that should trigger the Gatsby build process. For example, update the content or change metadata.
Save the changes in the CMS Dashboard. This triggers a webhook event and notifies the Optimizely Graph webhook endpoint.
Monitor the logs or any relevant output to ensure that the webhook event was received and processed successfully.
Verify that the Gatsby build process starts and completes without errors in the Gatsby Cloud dashboard.
Make sure that you handle any potential errors or exceptions during the webhook event processing and build process. Also, see the documentation for Gatsby Builds webhooks, the Optimizely Graph webhook API, and Optimizely CMS for information on monitoring and troubleshooting.
Updated 3 months ago