This project demonstrates how to integrate XAF¡¦s AI chat functionality with n8n using a Blazor UI. The integration enables seamless communication between XAF's AI services and the n8n workflow automation platform.
This solution provides:
- XAF AI Chat: An interactive dialogue system powered by AI.
- n8n Integration: Automates processes by responding to chat events via n8n workflows.
- .NET 8 SDK
- A Blazor Server hosting environment
- A running instance of n8n (self-hosted or cloud)
- XAF configuration with AI chat functionality enabled
- Clone the XAF project:
git clone https://github.com/antonylu0826/XafN8nChat.git
- Install and start n8n following the official guide: n8n Installation Guide
- Create a workflow that can receive application endpoints or events. You can upload the sample workflow from the repository (n8n sample).
- Get the webhook URL from n8n. This will be used to communicate between Blazor Server and n8n.
- In
Startup.cs
, update the service configuration to include the XAF AI chat module:services.Addn8nChat(configureOptions => { configureOptions.ChatUrl = "<your_n8n_webhook_url>"; });
For example, your controller might include an action that sends a chat message to the n8n webhook:
- Build and run the Blazor Server project
- API Errors: Ensure the webhook URL is correct and n8n is running.
- Configuration Issues: Verify that the XAF AI chat module and n8n setup (e.g., API key) are correctly configured.
- Network Connectivity: Test the connection between the Blazor Server and the n8n instance.
This README provides a brief guide for integrating XAF's AI chat functionality with n8n. Please adjust it according to your specific environment and needs.