This topic explains how to use the integration between LaunchDarkly and Contentful. The integration connects LaunchDarkly feature flagging with Contentful’s content management platform so that content editors and developers can manage experiments and flag-based content directly inside Contentful.
You can use the integration to:
This integration lets you map Contentful entries to LaunchDarkly variation values so you can control which content displays to each audience. Editors create and map flags in Contentful, while developers evaluate flags using LaunchDarkly SDKs and render the mapped content at runtime.
The Contentful app adds a custom Entry Editor and Sidebar extension. These extensions let you:
The integration writes only the data required to map flags to entries. All flag targeting rules and environments remain managed in LaunchDarkly.
To use the integration, you must have:
createFlag and viewProject actions, which allow the integration to create and read feature flags.You can create or manage API access tokens on the Authorization page. To learn more, read API access tokens.
Use this JSON policy to create a custom role for the Contentful integration. It grants only the permissions required to create and view flags and projects:
Install and configure the integration to connect Contentful to your LaunchDarkly project and environment.
To install the LaunchDarkly app in Contentful:
Contentful encrypts your API key and uses it only during requests.
The configuration screen includes an option that automatically applies “Entry Editor” settings. After configuration, confirm the following:
LaunchDarkly Feature Flag content type.You can also add the Sidebar to other content types that you plan to use for variation content. The Sidebar shows which entries are linked to LaunchDarkly flags.
To add the Sidebar:
Do not add the sidebar to the LaunchDarkly feature flag content model. The sidebar exists to display content entries that may be linked to a LaunchDarkly feature flag, not to modify the feature flag model itself.
The Entry Editor provides two workflows for connecting Contentful entries to LaunchDarkly feature flags:
To create a new feature flag inside Contentful:
LaunchDarkly Feature Flag content type.After you create the flag, a confirmation card appears with links to view the flag in LaunchDarkly or continue mapping content.
To map Contentful entries to an existing LaunchDarkly flag:
The mapping order matches the variation order defined in LaunchDarkly.
The integration stores the following fields on each LaunchDarkly feature flag entry:
The meta field exists so applications can perform stable lookups even if the variation order changes. Boolean flags resolve to true or false as the first two variations.
These examples show how to evaluate feature flags and retrieve mapped content in an application.
This example shows how an application identifies the active variation and selects the Contentful entry associated with that variation. The integration depends on the variation order defined in LaunchDarkly.
This example shows how an application uses the meta field to look up the entry identifier for the active variation. The variation values become the keys for retrieving mapped content.
The integration maintains strict access controls and data handling practices. It:
The integration does not allow editing of existing flags or variations. All targeting rules must be managed in LaunchDarkly.
If you encounter issues with the LaunchDarkly Contentful integration, try these common solutions.
If the LaunchDarkly section does not appear in the Entry Editor:
If flags are missing when mapping content:
createFlag and viewProject actions.If mapped content does not appear as expected:
If the integration cannot connect or displays an invalid API key message: