Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Contentful

Contentful

Headless CMS: list spaces, content types and entries, read one entry, and create, update and publish entries.

8 actions API key 5 read3 write Calls api.contentful.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "contentful" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Create entrywritecontentful.create_entryCreate a new draft entry of a content type with an auto-generated id. Fields are keyed by field id, then locale. The entry is not published until you publish it.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
content_type_idstringRequiredId of the content type, e.g. blogPost
fieldsobjectRequiredField values keyed by field id then locale, e.g. {"title": {"en-US": "Hello"}}
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.create_entry",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>",
    "content_type_id": "<content_type_id>",
    "fields": {}
  },
});
Get entryreadcontentful.get_entryGet one entry with all its fields (keyed by locale) and its version, content type and timestamps.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
entry_idstringRequiredEntry id
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.get_entry",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>",
    "entry_id": "<entry_id>"
  },
});
Get spacereadcontentful.get_spaceGet one Contentful space's name, id and version.
InputTypeDescription
space_idstringRequiredSpace id
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.get_space",
  input: {
    "space_id": "<space_id>"
  },
});
List content typesreadcontentful.list_content_typesList the content types (models) of a space environment: id and name. Needed to filter entries by type.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
limitintegerOptionalMaximum results
skipintegerOptionalResults to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.list_content_types",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>"
  },
});
List entriesreadcontentful.list_entriesList entries of a space environment, optionally only one content type or a full-text query. Fields are keyed by locale.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
content_typestringOptionalContent type id to filter by
querystringOptionalFull-text search
limitintegerOptionalMaximum results
skipintegerOptionalResults to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.list_entries",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>"
  },
});
List spacesreadcontentful.list_spacesList the Contentful spaces the token can access: id and name. Space ids are needed for entries.
InputTypeDescription
limitintegerOptionalMaximum spaces
skipintegerOptionalSpaces to skip
querystringOptionalExact space id or partial name
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.list_spaces",
  input: {},
});
Publish entrywritecontentful.publish_entryPublish an entry so it appears in the delivery API. Needs the entry's current version.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
entry_idstringRequiredEntry id
versionintegerRequiredThe entry's current version (sys.version)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.publish_entry",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>",
    "entry_id": "<entry_id>",
    "version": 1
  },
});
Update entrywritecontentful.update_entryReplace an entry's fields. Send ALL fields you want to keep, since the body is the entry's full field set (read it with get entry first). Needs the entry's current version to guard against concurrent edits.
InputTypeDescription
space_idstringRequiredSpace id
environment_idstringRequiredEnvironment id, usually master
entry_idstringRequiredEntry id
versionintegerRequiredThe entry's current version (sys.version from get entry)
fieldsobjectRequiredAll field values keyed by field id then locale
TypeScript
await setu.execute({
  userId: "user_1",
  action: "contentful.update_entry",
  input: {
    "space_id": "<space_id>",
    "environment_id": "<environment_id>",
    "entry_id": "<entry_id>",
    "version": 1,
    "fields": {}
  },
});