Overview
This node integrates with Alibaba Cloud's AI Guardrails service to analyze and detect potentially harmful or sensitive content within text data. It is designed to safeguard AI applications by performing content moderation, detecting sensitive data leaks, prompt attacks, malicious URLs/files, and watermark presence in the provided text.
Common scenarios where this node is beneficial include:
- Moderating user-generated content to ensure compliance with community guidelines.
- Detecting sensitive or confidential information before processing or storing text data.
- Preventing prompt injection or manipulation attacks in AI-driven chatbots or assistants.
- Scanning for malicious links or files embedded in text inputs or outputs.
- Verifying watermark presence for copyright or authenticity checks.
Practical example:
- A chatbot platform uses this node to scan incoming user messages ("input") to block harmful content before responding.
- An AI content generation system scans its generated text ("output") to ensure no policy violations or sensitive data leakage occurs.
Properties
| Name | Meaning |
|---|---|
| Content | The text content to be analyzed by the AI Guardrails service. |
| Detection Type | Specifies whether to detect issues in the "Input" text (user-provided) or "Output" text (generated by AI). Options: Input, Output |
Output
The node outputs an array of JSON objects, each corresponding to one input item analyzed. Each output object contains:
_finalSuggestion: Overall suggestion from the service (e.g., "pass", "block").contentModerationSuggestion: Suggestion related to general content moderation.sensitiveDataSuggestion: Suggestion regarding detection of sensitive data.promptAttackSuggestion: Suggestion about prompt injection or attack attempts.maliciousUrlSuggestion: Suggestion on presence of malicious URLs.maliciousFileSuggestion: Suggestion on presence of malicious files.waterMark: URL string if a watermark was detected in the content.desensitization: Details about any desensitization applied to sensitive data.responses: Raw responses from the AI Guardrails API for detailed inspection.
The node does not output binary data.
Dependencies
- Requires an API key credential for Alibaba Cloud AI Guardrails service (access key ID and secret).
- Makes HTTP POST requests to Alibaba Cloud's AI Guardrails endpoint.
- Uses HMAC-SHA1 signing for request authentication.
- Requires n8n credentials configuration with valid Alibaba Cloud AI Guardrails API keys.
Troubleshooting
Common Issues:
- Invalid or missing API credentials will cause authentication failures.
- Exceeding rate limits or quota on the Alibaba Cloud AI Guardrails service may result in errors.
- Large content inputs are automatically split into smaller chunks; extremely large inputs might still cause timeouts or partial results.
- Network connectivity issues can prevent successful API calls.
Error Messages:
"invoke api fail. code: XXX, message: YYY": Indicates the API returned an error code and message. Check credentials, permissions, and request parameters.- HTTP 4xx errors wrapped as API errors suggest client-side issues like invalid parameters or unauthorized access.
- Other errors are thrown as operation errors and may indicate transient issues or misconfiguration.
Resolution Tips:
- Verify that the API key credentials are correctly set up in n8n.
- Ensure the content length is reasonable or rely on automatic chunking.
- Enable "Continue On Fail" option to handle individual item errors gracefully.
- Review the raw API response in the output for more details on failure reasons.
Links and References
- Alibaba Cloud AI Guardrails Product Page
- Alibaba Cloud API Documentation (Replace XXXXX with actual doc ID if available)