Functions
Overview
Functions are backend serverless workloads that run on Contentful’s infrastructure and are enabled through the App Framework. They are a key feature of the Contentful Serverless App Platform, designed to simplify app development, enhance automation, and reduce the dependency on external infrastructure.
Functions allow you to run custom code on the Contentful platform, augmenting parts of the GraphQL and Content Management API. They power custom apps and automate repeatable tasks, which reduces app development time, and lowers long-term maintenance costs of customizing the Contentful platform.
NOTE: Functions are only available for Premium plans and Partners.
Types of Functions to extend Contentful:
App Event functions: These functions allow custom backend logic to be executed within the App Framework, ideal for various integrations and custom workflows.
App Action functions: These functions provide apps an easy way to expose generic capabilities to their own frontends as well as to other apps.
Functions on delivery (GraphQL): These functions are specifically designed to run in the path of GraphQL delivery requests, enabling dynamic content manipulations and real-time data integrations. See Custom external references and Native external references for more information.
Use Cases
App Event functions
Integration with third-party services, complex workflow automation.
Allows apps to react to events in Contentful by filtering, transforming, or handling app events.
Replaces the need for a customer to build and support a backend service that would otherwise support these tasks.
App Action functions
Performing tasks often in response to a user interacting with some UI component in an app.
These tasks might include: custom backend business logic, Content Management API (CMA) interaction, or interaction with external systems.
Replaces the need for a customer to build and support a public API endpoint that would otherwise support these tasks.
Functions on delivery (GraphQL)
Real-time data integrations with:
Product Catalogs, E-commerce systems, Translation systems, Legacy CMS systems, Digital Asset Management platforms
Any other API
Content Enrichment: Enhance your content with additional information, metadata, or related data fetched from external sources to provide richer context.
Inline external media: Include images from third-party systems inline to reduce network requests.
Dynamic routing: Route your content requests to different sources or destinations based on conditions, enabling dynamic content delivery logic.
At a glance
Feature | Purpose | Execution context |
App Event functions | Custom backend logic and integrations | AppEvents / App Framework |
App Action functions | Custom backend logic and integrations | AppActions / App Framework |
Functions on delivery | Dynamic content integrations | GraphQL delivery path |
For more information and to get started, see our Developer Documentation for Functions.
View our Example Apps and Function Templates on GitHub.
Feedback
To share your feedback, fill in this form.