Entries
The Entries component in Nappai acts as a bridge to your Strapi Content Management System (CMS). It allows you to fetch specific items or lists of content (such as blog posts, products, or news articles) directly from your Strapi instance into your automation workflow.
Instead of manually navigating your CMS, you can use this component to automatically retrieve data based on specific criteria, such as a unique ID or content type. This is particularly useful for displaying dynamic content on a website, syncing data between systems, or generating reports.
How it Works
This component functions as an automated connector to the Strapi API. Here is a simple breakdown of the process:
- Authentication: The component connects to your Strapi server using credentials you have previously saved. It uses either a username/password combination or a secure API token to verify your identity and grant access to the data.
- Query Construction: You define what data you need by specifying the Content Type (e.g., “articles”) and optionally filtering by a specific Entry ID or applying additional filters via the Item field.
- Data Retrieval: The component sends a request to Strapi. Strapi then returns the requested data (usually in JSON format) back to your Nappai workflow.
- Handling Results: The data is passed to the next steps in your workflow. If an error occurs (such as a bad connection or incorrect ID), the component captures the error message so you can troubleshoot it.
Connection & Credentials
This component requires configuring a credential in the Nappai panel before interacting with the external service:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Strapi CMS and fill in the required fields (Base URL and API Token).
- In your workflow, select the saved credential in the Credential input field of this node.
Note: Do not enter your password or token directly into the component inputs. Always use the Credential field to select a pre-configured security profile. This keeps your data safe and makes it easier to update your credentials in one place if they change.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Operation: Select the specific action or mode you wish to perform. Currently, this dropdown determines how the component processes the request.
- Content Type: Select the model that defines the structure of the content you want to retrieve (e.g., “products”, “blog-posts”).
- Item: Enter the content body or specific filter criteria for the entry.
- Entry ID: Enter the Strapi entry unique identifier if you want to retrieve a single, specific item.
- Top: Set the maximum amount of entries to retrieve from Strapi (useful for limiting results).
- Username: Enter the Username associated with a Strapi account if not using a token-based credential.
- Password: Enter the Secret password from Strapi account if not using a token-based credential.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Operation: Select the specific action or mode you wish to perform. Currently, this dropdown determines how the component processes the request.
- Visible in: All operations
-
Content Type: Select the model that defines the structure of the content you want to retrieve (e.g., “products”, “blog-posts”). This is essential for telling Strapi which collection of data to look at.
- Visible in: All operations
-
Item: Enter the content body or specific filter criteria for the entry. This allows for advanced filtering beyond just ID or type.
- Visible in: All operations
-
Entry ID: Enter the Strapi entry unique identifier if you want to retrieve a single, specific item. Use this if you only need details for one post or product.
- Visible in: All operations
-
Top: Set the maximum amount of entries to retrieve from Strapi. Use this to limit the number of results returned, which helps improve performance.
- Visible in: All operations
-
Username: Enter the Username associated with a Strapi account if you are using basic authentication instead of an API token.
- Visible in: All operations
-
Password: Enter the Secret password from Strapi account if you are using basic authentication instead of an API token.
- Visible in: All operations
Outputs
The component produces the following output for use in subsequent steps of your workflow:
- Data: The retrieved content entries from Strapi. This is typically a list of objects containing the fields defined in your Strapi content type (e.g., title, description, author, images). If you retrieved a single entry by ID, this will be an object representing that specific item. If no data is found, this may be empty or null.
Output Data Example (JSON)
json { “id”: 1, “title”: “Introduction to Automation”, “slug”: “intro-to-automation”, “content”: “This is the body text of the article…”, “author”: { “id”: 5, “name”: “Jane Doe” }, “published_at”: “2023-10-27T10:00:00.000Z”, “category”: “Technology” }
Connectivity
This component is designed to output structured data (Data) that is typically connected to:
- AI Analysis Nodes: Sending the retrieved content to an LLM for summarization, translation, or sentiment analysis.
- Data Formatting Nodes: Transforming the raw JSON data into a specific format for display (e.g., HTML for a website or CSV for a report).
- Database/CRM Nodes: Updating or creating records in other systems based on the Strapi data.
It is best used after a credential is configured and before any data processing or display nodes.
Usage Example
Scenario: Displaying Recent Blog Posts on a Website
- Configure Credential: First, go to Nappai’s Credentials section and create a Strapi CMS credential using your Strapi Base URL and API Token.
- Add Component: Drag the Entries component into your workflow.
- Select Credential: In the Credential field, select the Strapi credential you just created.
- Define Content: Set Content Type to “articles”.
- Limit Results: Set Top to
5to get only the 5 most recent posts. - Connect to Display: Connect the Data output of this component to a “Loop” component or a “Render HTML” component to display the title and body of each article on your dashboard or website.
Tips and Best Practices
- Use Credentials for Security: Always use the Credential input field. Never type your API Token or Password directly into the input fields to keep your account secure.
- Use Entry ID for Specifics: If you know the exact ID of the item you need, use the Entry ID field. This is faster and more efficient than filtering a whole list.
- Limit Results with Top: If you are fetching a large collection (like all products), always use the Top field to limit the number of items returned. This prevents your workflow from timing out or becoming too slow.
- Check Content Types: Ensure the Content Type name matches exactly what is defined in your Strapi admin panel (e.g., it might be “blog-posts” or just “posts”).
Security Considerations
- Credential Management: Your API Token or Password is sensitive information. Ensure your Nappai credentials are stored securely and only shared with authorized team members.
- Access Control: Strapi credentials should have the minimum necessary permissions (Read-only access is often sufficient for automation workflows). Avoid using Administrator tokens unless absolutely necessary.
- HTTPS: Ensure your Strapi Base URL uses HTTPS to encrypt the data transfer between Nappai and your CMS.