Lectful Central icon

Lectful Central

Interact with the Lectful Central API for admin operations

Overview

The "Apply AI Template" operation in the BuilderX AI Integration resource allows users to apply an AI-generated template to create a new page within a specified tenant environment. This operation sends a configuration of widgets along with page metadata (title and slug) to the Lectful Central API, which then generates the page accordingly.

This node is beneficial for automating the creation of web pages or UI layouts based on AI-driven templates, especially when integrating dynamic content or widget configurations programmatically. For example, a user can define a set of widgets with parameters such as titles and subtitles, specify the target tenant, and generate a fully configured page without manual intervention.

Practical use cases include:

  • Automatically generating landing pages with predefined widget layouts.
  • Creating personalized pages for different tenants using AI templates.
  • Streamlining UI updates by applying new widget configurations via automation workflows.

Properties

Name Meaning
Authentication Mode Choose how to authenticate with the Lectful Central API:
- Use Stored Credentials (configured in n8n)
- Manual Configuration (provide base URL and API key manually)
Credentials Note Notice shown when using Manual Configuration mode explaining that credentials fields can be left empty if overrides are provided.
Base URL Override Optional base URL to override the credential setting (without /api/v1). Used only in Manual Configuration mode.
API Key Override Optional API key to override the credential setting. Used only in Manual Configuration mode.
Tenant ID The ID of the tenant where the AI template will be applied. This identifies the target environment for the generated page.
Widgets Configuration A JSON array describing the widget configurations to apply. Each item should specify a widget_id and its parameters. Example:
[{"widget_id": "hero-1", "parameters": {"title": "Test Hero", "subtitle": "Test Subtitle"}}]
Page Title The title of the generated page.
Page Slug The slug (URL-friendly identifier) for the generated page.

Output

The node outputs the response from the Lectful Central API after applying the AI template. The output is structured as JSON and typically contains details about the created page or confirmation of the operation's success.

  • The json field includes the parsed API response object.
  • If the API returns a string, the node attempts to parse it into JSON; otherwise, it returns the raw string.
  • No binary data output is produced by this operation.

Example output structure (simplified):

{
  "json": {
    "page_id": "12345",
    "tenant_id": "tenant_abc",
    "title": "My Generated Page",
    "slug": "my-generated-page",
    "widgets": [
      {
        "widget_id": "hero-1",
        "parameters": {
          "title": "Test Hero",
          "subtitle": "Test Subtitle"
        }
      }
    ],
    "status": "success"
  }
}

Dependencies

  • Requires access to the Lectful Central API.
  • Authentication must be provided either via stored credentials configured in n8n or manual entry of the base URL and API key.
  • The API endpoint used is /admin/builderx/ai-template.
  • Proper permissions for the tenant identified by Tenant ID are necessary to apply templates.

Troubleshooting

  • Invalid JSON format for widgets configuration: The Widgets Configuration property must be valid JSON. Errors occur if the JSON is malformed. To fix, ensure the JSON array syntax is correct and all strings are properly quoted.
  • Missing or invalid credentials: When using stored credentials, ensure they are correctly configured with a valid base URL and API key. When using manual mode, both Base URL Override and API Key Override must be provided.
  • API errors: If the API returns an error, check the tenant ID validity and whether the user has permission to apply templates for that tenant.
  • Network issues: Ensure the base URL is reachable from the n8n instance and no firewall or network restrictions block the request.

Links and References

Discussion