Contentful

Contentful is a powerful and flexible management system enabling users to create, manage, and publish content across multiple platforms. It provides a range of features such as versioning, custom apps, and asset management, allowing you to streamline your content creation process. Its highly extendable nature, Contentful offers an ecosystem of apps and integrations to meet all your requirements.

Integrating Constructor API using Contentful's webhook capabilities is a seamless process. It provides webhook templates and transformations that you can easily customize to suit your specific needs.

Check out the official documentation to learn more about Contentful's webhook feature.

Indexing content into Constructor

The goal here is to set up an automation for each major lifecycle event in Contentful, so that those changes are reflected into Constructor via webhooks. Once you're finished, your setup should look something like this:

Data structure

Please note that the data structure shown below heavily varies according to your template structure in Contentful.

Automations will probably be slightly different, as you'll need to map your data correctly depending on which fields you use.

Authentication

In each webhook, you'll want to configure the authentication to properly send the API requests:

Please refer to Authentication for more details on how to configure your header.

Creating / updating entries

Whenever entries are created or update in Contentful, we'll reflect this data into Constructor using the Create or replace items endpoint.

Triggers

URL configuration

  • Method: PATCH
  • URL: https://ac.cnstrc.com/v2/items?key=YOUR_INDEX&section=YOUR_INDEX_SECTION&on_missing=CREATE

Payload

You can use this template as a starting point for the HTTP request inside your automation:

{
  "items": [
    {
      "id": "{ /payload/sys/id }",
      "name": "{ /payload/fields/internalName/en-US }",
      "data": {
        "active": true,
        "keywords": [],
        "url": "https://example.com",
        "description": "{ /payload/fields/headline/en-US }",
        "body": "{ /payload/fields/bodyText/en-US }",
        "image_url": null
      }
    }
  ]
}
📘

Please note that data.body is just a metadata example above, and you'll want to map the fields you have available in your template here.

Deleting entries

Whenever an entry is deleted in Contentful, we'll delete it in Constructor using the Delete Items endpoint.

Triggers

URL configuration

  • Method: DELETE
  • URL: https://ac.cnstrc.com/v2/items?key=YOUR_INDEX&section=YOUR_INDEX_SECTION

Payload

Finally, you can use this template as a starting point for the HTTP request inside your automation:

{
  "items": [
    {
      "id": "{ /payload/sys/id }"
    }
  ]
}