Actions15
Overview
This node operation creates a new Block in DatoCMS. Blocks are modular content pieces that can be reused and nested within other content structures in DatoCMS. This node is useful when you want to programmatically generate or manage modular blocks as part of your content workflows.
Typical use cases include:
- Automating the creation of reusable content blocks for websites or apps.
- Dynamically generating structured content components based on external data.
- Integrating DatoCMS block creation into larger automation pipelines.
For example, you might create a "Testimonial" block with fields like author name, photo, and quote, then insert it into pages dynamically.
Properties
| Name | Meaning |
|---|---|
| Block Type | The type of block to create. You can select from a searchable list of available block types or specify a block type ID directly. |
| Fields | The fields to set for the new block. You can define field values manually or map them automatically from input data. This includes all fields defined for the selected block type. |
Output
The node outputs an array with one item per input item processed. Each output item contains a json property representing the created block record object as returned by the DatoCMS API client helper function. This JSON includes all the fields and their values for the newly created block.
No binary data output is produced by this operation.
Dependencies
- Requires an API authentication token credential for DatoCMS with appropriate permissions to create blocks.
- Uses the official DatoCMS Node.js CMA (Content Management API) client library.
- The node expects the user to have configured the DatoCMS API credentials in n8n beforehand.
Troubleshooting
- Missing or invalid Block Type: If no block type is selected or the ID is invalid, the node will throw an error. Ensure you select a valid block type from the list or provide a correct ID.
- Field validation errors: If required fields are missing or field values do not conform to expected formats (e.g., JSON fields), the API may reject the creation request. Double-check field mappings and formats.
- API permission errors: Insufficient API permissions will cause failures. Verify that the API token has rights to create blocks.
- JSON parsing issues: For fields expecting JSON or arrays, improper string formatting can cause errors. The node attempts to parse and stringify such fields but malformed input may still fail.