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

Use case: Gatsby deployment

Example use cane of automating Gatsby builds based on content changes, providing a streamlined development workflow.

A Gatsby Build Webhook lets you programmatically trigger builds of your Gatsby projects. Registering this webhook with the Optimizely Graph endpoint lets you automate builds whenever specific events occur, such as content updates or changes to your data source. You can then test the content modification using the Optimizely Content Management System (CMS).

Create a Gatsby Build Webhook

To create a Gatsby Build Webhook:

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

  2. Copy the Builds Webhook URL. (You will need it in the following register the webhook section).

    Gatsby

Register the webhook with Optimizely Graph

  1. Use a tool or library of your choice (such as cURL, Postman, or an HTTP client library) to make a POST request to https://cg.optimizely.com/api/webhooks to register the webhooks.
  2. Set the necessary parameters in the request payload, including the URL endpoint of your Gatsby Builds Webhook obtained in the previous section and any additional configurations required by the Optimizely Graph webhook API.
  3. Send the request and await a response from the Optimizely Graph webhook API.
  4. After registration, the API will respond with the details of the registered webhook, including its unique identifier.

Test content modification with CMS

To test the integration between the Gatsby Build Webhook and the Optimizely Graph webhook API using the Optimizely CMS Dashboard:

  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 relevant output to ensure the webhook event is received and processed.

  5. Verify that the Gatsby build process starts and completes without errors in the Gatsby Cloud dashboard.

Ensure you handle potential errors or exceptions during the webhook event processing and build process. Also, see the documentation for Gatsby Build Webhooks, the Optimizely Graph webhook API, and Optimizely CMS for information on monitoring and troubleshooting.