Actions2
Use Prompt
AI-generatedOverview
This node integrates with the PromptDocker API to manage and use prompt templates. It allows users to list all prompts, retrieve details of a specific prompt, or use a prompt by substituting variables within its content. The "Use Prompt" operation is particularly useful for dynamically generating text based on predefined templates where placeholders are replaced with user-provided values.
Common scenarios include:
- Automating content generation by filling in templates with dynamic data.
- Retrieving prompt templates for review or modification.
- Managing a collection of reusable prompt templates in a workspace.
For example, you might have a blog post template with variables like {{blog_content}} and {{author_name}}. Using this node, you can supply values for these variables and generate the final prompt text ready for further processing or AI input.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform: - List Prompts: Retrieve all available prompts. - Get Prompt: Get details of a specific prompt by ID. - Use Prompt: Retrieve a prompt and replace variables with provided values. |
| Prompt ID (for Get Prompt) | The unique identifier of the prompt to retrieve when using the "Get Prompt" operation. |
| Prompt ID (for Use Prompt) | The unique identifier of the prompt template to use when performing variable substitution. |
| Load Variables | A button that, when clicked, loads variables detected in the selected prompt template (only shown when a Prompt ID is set for "Use Prompt"). |
| Variables | A collection of variables to substitute in the prompt template. Each variable has: - Variable Name or ID: Select from detected variables or specify an expression. - Value: The string value to replace the variable with. |
Output
The node outputs JSON data structured according to the selected operation:
- List Prompts: An array of prompt objects representing all prompts in the workspace.
- Get Prompt: Details of a single prompt including its ID and content.
- Use Prompt: An object containing:
prompt_id: The ID of the prompt used.name: The name of the prompt.original_content: The original prompt template content with variables.processed_content: The prompt content after replacing variables with provided values.variables_detected: List of all variables found in the prompt template.variables_used: Key-value pairs of variables that were replaced.missing_variables: List of variables detected but not provided values (if any).ready_for_ai: Boolean indicating if all variables were replaced and the prompt is ready for AI use.
No binary data output is produced by this node.
Dependencies
- Requires access to the PromptDocker API.
- Needs an API key credential configured in n8n to authenticate requests.
- The base URL and API key must be set in the node's credentials configuration.
- Internet connectivity to reach the PromptDocker service.
Troubleshooting
- Prompt not found or has no content: Occurs if the specified prompt ID does not exist or the prompt content is empty. Verify the prompt ID and ensure the prompt exists in your PromptDocker workspace.
- API authentication errors: If the API key is invalid or missing, requests will fail. Check that the API key credential is correctly configured.
- Missing variables warning: When using the "Use Prompt" operation, if some variables detected in the prompt template are not provided values, they will appear in
missing_variables. Provide values for all required variables to avoid incomplete prompt generation. - HTTP request failures: Network issues or incorrect base URL settings can cause request failures. Confirm network connectivity and credential settings.
Links and References
- PromptDocker API Documentation (example link, replace with actual)
- n8n Expressions Documentation — for using expressions in variable names or values
- n8n Credential Management — how to configure API keys in n8n