Add n8n workflow provider with webhook-based execution #3585
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
参考 coze, dify provider 以及 n8n 官方文档接口,增加 n8n provider。
Motivation / 动机
Enable n8n workflow automation integration with AstrBot, allowing users to trigger custom n8n workflows via webhooks and receive responses through the chatbot interface.
Modifications / 改动点
Core Implementation:
astrbot/core/utils/n8n_api_client.py: Lightweight HTTP client for webhook communicationastrbot/core/provider/sources/n8n_source.py: Provider adapter implementing full Provider interfaceIntegration:
astrbot/core/provider/manager.py: Provider registrationdashboard/src/views/ProviderPage.vue: Type mappingdashboard/src/utils/providerUtils.js: Provider icontests/test_n8n_provider.py: 13 unit tests covering initialization, methods, parsingDocumentation:
docs/n8n_provider_implementation.mdwith configuration guideConfiguration example:
{ "type": "n8n", "id": "my_workflow", "enable": true, "n8n_webhook_url": "https://n8n.example.com/webhook/abc123", "n8n_http_method": "POST", "n8n_auth_header": "Authorization", "n8n_auth_value": "Bearer token", "n8n_output_key": "output", "n8n_input_key": "input", "timeout": 120, "variables": {"key": "value"} }Verification Steps / 验证步骤
uv run pytest tests/test_n8n_provider.py -vuv run python -c "from astrbot.core.provider.sources.n8n_source import ProviderN8n"uv run python -c "from astrbot.core.provider.register import provider_cls_map; print('n8n' in provider_cls_map)"Screenshots or Test Results / 运行截图或测试结果
CodeQL Security Scan:
Compatibility & Breaking Changes / 兼容性与破坏性变更
This is a purely additive change. New provider type with no impact on existing providers or configurations.
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.