HomeDev guideRecipesAPI ReferenceGraphQL
Dev guideUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Use case: Gatsby deployment

Lets you automate Gatsby builds based on content changes, providing a streamlined development workflow.

Create a Gatsby builds webhook

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:

  1. Go to the Gatsby Site Settings > Webhook in the Gatsby Cloud dashboard.

  2. Copy the Builds Webhook URL. (You will need it in the next step.)


Register the webhook with Optimizely Graph

  1. Use the Optimizely Graph webhook API endpoint POST https://cg.optimizely.com/api/webhooks to register the webhook.
  2. Make a POST request to the Optimizely Graph webhook API endpoint.
  3. 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.
  4. Send the request and wait for a response from the Optimizely Graph webhook API.
  5. Upon successful registration, the API will respond with the details of the registered webhook, including its unique identifier.

Test content modification with CMS

  1. Access the CMS Dashboard for your project.

  2. Make changes to a content item that should trigger the Gatsby build process. For example, update the content or change metadata.

  3. Save the changes in the CMS Dashboard. This triggers a webhook event and notifies the Optimizely Graph webhook endpoint.

  4. Monitor the logs or any relevant output to ensure that the webhook event was received and processed successfully.

  5. 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.