IAV-583/feat(wizard): Implement Step 9 - Agent Integrations and N8N Workflow Creation
Summary
This MR implements Step 9 of the Main Agent Wizard - the final configuration step that allows users to create integrations and generate N8N workflows for their Customer Care agents.
What's New
🔌 Integration Management
- Users can create integrations for multiple credential types:
- Messaging: WhatsApp, Instagram, Facebook Messenger, Telegram
- E-commerce: Shopify, WooCommerce (at least one required)
- Ticketing: Freshdesk (required if IAVIA ticketing is disabled)
- Duplicate integration prevention per credential type
- Automatic tracking of credential source (USER_PROVIDED vs SYSTEM_GENERATED)
⚙ ️ Workflow Creation
- Automatic workflow JSON template preparation with credential injection
- Workflow creation in N8N via core-n8n-service
- Automatic workflow activation after creation
- Integration status update upon successful workflow creation
- Agent status update to
CONFIGURATIONS_COMPLETE
🤖 Auto-generation of Missing Integrations
- Non-essential integrations are auto-created with fake credentials from N8N schema
- Strict validation: fails if schema cannot be retrieved
- Smart fake data generation based on property names and types
API Changes
New Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/customer-care/main-agent-wizard/integrations |
Create single integration |
| POST | /api/customer-care/main-agent-wizard/workflow |
Create N8N workflow |
Breaking Changes
userUid → x-user-uid (all wizard endpoints)
instanceName parameter removed from method signatures
Validation Rules
-
✅ At least one e-commerce integration (Shopify OR WooCommerce) required -
✅ Freshdesk integration required ifiaviaTicketingEnabled = false -
✅ Duplicate integration check per credential type per agent
Files Changed
-
AgentIntegrationService.java(new) -
AgentIntegrationServiceImpl.java(new - 733 lines) -
OrchestrationService.java(new) -
OrchestrationServiceImpl.java(new) -
N8nService.java(modified) -
N8nServiceImpl.java(modified) -
MainAgentWizardController.java(modified) -
MainAgentWizardPaths.java(modified) -
AgentConstants.java(modified) -
BusinessErrorCode.java(modified - 14 new error codes) -
FaqCategoryServiceImpl.java(bugfix) - New DTOs (6 files)
Testing
-
Integration creation with valid credentials -
Integration creation with missing credentials (should fail) -
Duplicate integration prevention -
Workflow creation with all required integrations -
Workflow creation with missing e-commerce (should fail) -
Workflow creation with missing Freshdesk when ticketing disabled (should fail) -
Auto-creation of non-essential integrations -
Workflow activation verification
Related Issues
Closes IAV-583