PromptLayer Connection¶
This workflow demonstrates a basic integration with PromptLayer, a prompt management and logging service. It pulls a prompt template from PromptLayer and logs API requests for tracking and analytics purposes.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Manual Trigger: The workflow starts when manually executed
- Fetch Prompt Template: Retrieves a prompt template labeled "prod" from PromptLayer using the template ID "pbapldemo"
- Log Request: Sends request and response data back to PromptLayer for tracking, including model information, input/output messages, and timing data
Workflow Diagram¶
graph TD
A[When clicking 'Execute workflow'] --> B[Pull Prompt from PromptLayer]
B --> C[HTTP Request - Log to PromptLayer]
Trigger¶
- Type: Manual Trigger
- Activation: Click "Execute workflow" button in n8n interface
- Use Case: Testing and demonstration purposes
Nodes Used¶
| Node | Type | Purpose |
|---|---|---|
| When clicking 'Execute workflow' | Manual Trigger | Starts the workflow manually |
| Pull Prompt from PromptLayer | HTTP Request | Fetches prompt template from PromptLayer API |
| HTTP Request | HTTP Request | Logs request data back to PromptLayer |
External Services & Credentials Required¶
PromptLayer API¶
- Service: PromptLayer (https://api.promptlayer.com)
- Authentication: API Key via X-API-KEY header
- Required Credentials: PromptLayer API key (currently hardcoded - should be moved to credentials)
⚠️ Security Note: The API key is currently hardcoded in the workflow. This should be moved to n8n credentials for security.
Environment Variables¶
No environment variables are currently used. Consider moving the following to environment variables:
- PROMPTLAYER_API_KEY: PromptLayer API key
- PROMPT_TEMPLATE_ID: Template ID (currently "pbapldemo")
Data Flow¶
Input¶
- Manual execution trigger (no input data required)
Processing¶
- Retrieves prompt template with label "prod" from PromptLayer
- References data from nodes "Message to bot" and "Support Bot" (these nodes don't exist in the current workflow)
Output¶
- Prompt template data from PromptLayer
- Log confirmation from PromptLayer API
Error Handling¶
No explicit error handling is implemented in this workflow. Consider adding: - Error handling for API failures - Validation of API responses - Fallback mechanisms for service unavailability
Known Limitations¶
- API key is hardcoded and exposed in the workflow
- References non-existent nodes ("Message to bot" and "Support Bot")
- No error handling for API failures
- Workflow appears incomplete as it references missing components
- Currently inactive (workflow status is
false)
Related Workflows¶
No related workflows identified from the current context.
Setup Instructions¶
-
Import Workflow
- Copy the workflow JSON
- Import into your n8n instance
-
Configure Credentials
- Create a new HTTP Request credential in n8n
- Add your PromptLayer API key
- Update both HTTP Request nodes to use the credential instead of hardcoded keys
-
Update Template ID
- Replace "pbapldemo" with your actual PromptLayer template ID
- Ensure the template exists in your PromptLayer account
-
Fix Missing References
- The logging node references "Message to bot" and "Support Bot" nodes that don't exist
- Either add these nodes or update the JSON body to use appropriate data sources
-
Test the Workflow
- Activate the workflow
- Click "Execute workflow" to test the connection
- Verify data appears in your PromptLayer dashboard
-
Security Hardening
- Move API keys to n8n credentials
- Consider using environment variables for configuration
- Add appropriate error handling