Most Contentful customers have extremely efficient workflows, enabling talented people to do their best work. They’re using Contentful as a Swiss Army knife to integrate with their favorite external tools and services.
From experience with hundreds of customers, we’ve identified five of the most useful workflows, with Contentful webhooks that make the process streamlined and easy. So easy, that hardly any code needs to be written for setup.
1. Rebuilding static sites
Static sites are the most basic type of web content, with no server-side functionality. They consist a series of HTML files, each reflecting a page of the website. Static architecture is cheap, easy to scale and has the advantage of being secure. The disadvantage –– and it’s a big one –– is that websites built this way need to be updated and rebuilt every time an editor publishes a new piece of content. It’s a process that is vulnerable to mistakes. If set up incorrectly, the process of refreshing the website can take a long time, and it’s at risk of being derailed by a single typo.
The best way to solve this issue is granular control over the rebuilding and updating of your website. There needs to be a way to refresh just a small section without risking downtime to your whole digital offering. For example, if an editor wanted to publish a simple footer entry, it’s ineffective to rebuild the whole page. You also don’t want to set up a cronjob to check for changes every 10–20 minutes and eat up server resources. You need to be able to trigger a rebuild immediately, so changes are instantaneous.
Contentful’s solution to this workflow issue is using a webhook to pull in a continuous deployment tool such as Netlify, which only takes a few minutes to set up, to automatically run build commands and deploy the result in minutes. It gives teams the ability to fine-tune rebuilds and directly respond to editorial actions such as publishing or un-publishing content. It also goes beyond rebuilding page elements and allows a rebuild according to the entry type or content type.
It’s the best way to continuously update a static site, and we would go so far as to say it’s the foundation to a static site workflow.
2. Automatically test the changes
Deployment pipelines help developers minimize waste — both in code and time. Instead of shipping big chunks of code, developers adopt the practice of implementing small changes that are pushed to version control repositories regularly. More and more commercial teams are adopting a continuous integration/continuous delivery (CI/CD) pipeline. The pipeline enables modern development teams to ship changes quickly without sacrificing the quality of applications.
Developers want to treat content structure changes just like any other part of the software they are building. They need changes to be automatic. Ideally, the moment a developer is finished making changes to a file, the test suite picks it up, runs the tests and sends an alert if it picked up any bugs in the code.
Contentful connects with extensible CI/CD automation tools such as Travis CI, Circle CI and Jenkins. They trigger a test suite of applications to run and perform a scripted sequence of tests on the updated content. You can also specify the type of environment the entry should come from, the type of entities, and specific actions. For example, a user might only want to look up entries from development environments, or only run the tests when updating the content model, while ignoring changes to individual entries.
3. Keep the team up to date
Notifications are alerts triggered by status changes inside Contentful. Notification workflows fulfill a simple function: they help editorial teams keep track of their content. It gives the editorial teams insight into what they’re publishing, when they're publishing it and who is making the changes. Teams building cutting-edge websites often rely on a collection of specialized tools to manage and export inventory levels, merchandise prices, customer details and product descriptions.
Webhooks can provide a straightforward notification pipeline to track changes, keep a record of an event or drive follow-up actions. As long as data is being created or modified, the webhook will keep you updated in real time through HTTP callbacks.
Editorial teams can keep using their favorite tools too. Contentful provides an out-of-the-box Jira webhook template, and templates for Slack, even templates for email and Asana can be easily built. In the instance of Jira, you can set it up so that every time you add specific tags, your team will get a notification.
4. Automate repetitive tasks
There is a lot of hype around serverless architecture and using functions to replace old-fashioned backends. Serverless architecture/cloud functions enable developers to run any snippet of code in the cloud without worrying about the underlying infrastructure required to execute that code.
The main business benefit with serverless functions is reduced complexity; you only need to write the snippet of code without worrying about how to run it. This is great for front-end developers as they get to do things independently of administrators or backend developers.
You can use serverless functions to do any range of things — just pick out annoying or repetitive tasks and automate them. Contentful customers use this approach to add watermarks, uploading images and more. Teams also use serverless functions to convert videos for mobile platforms, generating tags and ensuring the editorial team sticks to brand guidelines set by the marketing team.
5. Ensure accurate search results
Dedicated search services such as Algolia give website owners full control over what used to be a challenging activity –– search. Publishing high volumes of content makes it difficult to keep search results accurate. Changes should happen in real time, without relying on cronjobs that might produce inaccurate results for a few minutes at a time.
Luckily, webhook triggers make it easier to set up services like Algolia and Elasticsearch. Algolia provides fast and scalable APIs with easy-to-use search UI widgets. It works by integrating with a database and acts as a direct integration pipeline to content. It adds newly published entries to the index and removes unpublished ones. It also enables users to specify what type of entries should be indexed by the search engine. For example, partial entries like footers don’t need to be indexed.
If you want to implement similar workflows, but want to stick with a favorite vendor or tool, don’t worry. Our included templates offer an easy starting point and can be repurposed for other services with a few minor tweaks. Our collection already includes webhook templates for Algolia and Elasticsearch, but you could also channel your content to services like Swiftype or Solr.
It’s simple to use the existing templates as a starting point to build a webhook connector to a search index, delivery pipeline, static site and more. A good place to be inspired is our apps marketplace created and curated by the Contentful team.
It doesn't end there. We plan to grow the marketplace by opening it up to certified Contentful partners and trusted customers. We’re always on the lookout for new ways to extend Contentful, so once you build something, make sure to us know by sending a tweet (@contentful) to our friendly developer relations team.