diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md new file mode 100644 index 00000000..22e6e675 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md @@ -0,0 +1,110 @@ +# Migrate Workflow to n8n - Validation Checklist + +## Source Analysis + +- [ ] Source platform was identified +- [ ] Source workflow details were gathered +- [ ] Trigger type was identified +- [ ] All integrations were identified +- [ ] Workflow complexity was assessed + +## Platform Mapping + +- [ ] Platform mappings were loaded +- [ ] Source trigger was mapped to n8n trigger +- [ ] All source actions were mapped to n8n nodes +- [ ] Conditional logic was mapped correctly +- [ ] Loops/iterations were mapped correctly +- [ ] Data transformations were identified + +## Workflow Structure + +- [ ] n8n workflow has valid JSON structure +- [ ] Workflow name is set +- [ ] Migration tag is added (migrated-from-[platform]) +- [ ] All nodes have unique IDs +- [ ] All nodes have unique names +- [ ] Trigger node is properly configured + +## Node Configuration + +- [ ] All mapped nodes are created +- [ ] Node types are valid n8n types +- [ ] Node parameters are configured +- [ ] Credentials placeholders are set +- [ ] Node positions are calculated correctly +- [ ] No overlapping nodes + +## Data Mappings + +- [ ] Field mappings from source to n8n are correct +- [ ] Data type conversions are handled +- [ ] Date/time format differences are addressed +- [ ] Expressions use correct n8n syntax (={{ }}) +- [ ] Set nodes are used for simple transformations +- [ ] Code nodes are used for complex transformations + +## Conditional Logic + +- [ ] IF nodes are created for conditional branches +- [ ] Switch nodes are created for multiple conditions +- [ ] Conditions are properly configured +- [ ] True/false branches are correct (index 0/1) +- [ ] All branches are connected + +## Connections + +- [ ] All nodes are connected properly +- [ ] Trigger connects to first action +- [ ] Actions are connected in sequence +- [ ] Conditional branches are connected +- [ ] Merge points are connected +- [ ] All connections reference existing nodes +- [ ] No orphaned nodes (except trigger) + +## Error Handling + +- [ ] Error handling strategy is defined +- [ ] Critical nodes have retry logic if needed +- [ ] continueOnFail is set appropriately +- [ ] Error handling matches or improves on source + +## Migration Notes + +- [ ] Source platform is documented +- [ ] Migration date is recorded +- [ ] Credentials needed are listed +- [ ] Platform-specific differences are noted +- [ ] Testing considerations are documented + +## Validation + +- [ ] Workflow passes JSON validation +- [ ] All required parameters are set +- [ ] Workflow structure is logical +- [ ] Migration matches source workflow functionality + +## Credentials & Authentication + +- [ ] All services requiring credentials are identified +- [ ] Credential types are correct for n8n +- [ ] OAuth requirements are noted +- [ ] API key requirements are noted +- [ ] Authentication differences from source are documented + +## Testing Readiness + +- [ ] Workflow can be imported into n8n +- [ ] Test data requirements are clear +- [ ] Expected outputs are defined +- [ ] Comparison approach with source is defined +- [ ] Initial monitoring plan is suggested + +## Documentation + +- [ ] User has import instructions +- [ ] Credential setup guidance provided +- [ ] Data mapping explanations provided +- [ ] Testing approach explained +- [ ] Platform differences highlighted +- [ ] Post-migration checklist provided diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md new file mode 100644 index 00000000..17ffd53d --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md @@ -0,0 +1,350 @@ +# Migrate Workflow to n8n - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow migrates automation workflows from other platforms to n8n. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: source platform, workflow details, integrations, file paths + + + Summarize your understanding + Skip directly to Step 2 (Check Context7 MCP) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which platform are you migrating from?" + Present numbered options: + 1. Zapier - Migrate Zapier Zaps to n8n + 2. Make (Integromat) - Migrate Make scenarios to n8n + 3. HubSpot Workflows - Migrate HubSpot workflows to n8n + 4. Microsoft Power Automate - Migrate Power Automate flows to n8n + 5. IFTTT - Migrate IFTTT applets to n8n + 6. Other - Specify another automation platform + + WAIT for user selection (1-6) + Store selection in {{source_platform}} + + + Ask: "Please specify the platform you're migrating from" + WAIT for user input + Store in {{source_platform}} + + + Ask Question 2: "How will you provide the workflow to migrate?" + Present numbered options: + 1. Describe it - Explain what the workflow does + 2. Provide export file - Upload/paste workflow export file + 3. Provide screenshots - Share workflow screenshots + 4. Provide documentation - Share workflow documentation + + WAIT for user selection (1-4) + + + Ask: "Please describe what the workflow does (trigger, actions, logic)" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow export file path or paste the content" + WAIT for user input + Store in {{workflow_file}} or {{workflow_content}} + + + + Ask: "Please share the workflow screenshots and describe the flow" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow documentation" + WAIT for user input + Store in {{workflow_description}} + + + Ask Question 3: "What is the trigger for this workflow?" + Present numbered options: + 1. Webhook/HTTP Request - Triggered by incoming HTTP requests + 2. Schedule/Cron - Runs on a schedule + 3. Form Submission - Triggered by form submissions + 4. Database Change - Triggered by database events + 5. Email - Triggered by incoming emails + 6. Service Event - Triggered by external service (Slack, Google Sheets, etc.) + 7. Not sure - Will determine from workflow details + + WAIT for user selection (1-7) + Store selection in {{trigger_type}} + + Ask Question 4: "What integrations/services does this workflow use?" + Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)" + WAIT for user input + Store in {{integrations_used}} + + Ask Question 5: "How complex is the workflow?" + Present numbered options: + 1. Simple - Linear flow with 3-5 steps + 2. Medium - Some conditional logic, 6-10 steps + 3. Complex - Multiple branches, loops, 11-20 steps + 4. Very Complex - Advanced logic, 20+ steps + + WAIT for user selection (1-4) + Store selection in {{complexity}} + + Ask Question 6: "What should the migrated workflow be named?" + WAIT for user input + Store in {{workflow_name}} + + Ask Question 7: "Where should the n8n workflow file be saved?" + Present numbered options: + 1. Default location - workflows/[workflow-name].json + 2. Custom path - Specify your own file path + 3. Project root - Save in main project directory + + WAIT for user selection (1-3) + + Ask for specific path + WAIT for user input + + Store final path in {{save_location}} + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 3 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge." + Proceed to Step 4 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Integrations used: {{integrations_used}} + - Trigger type: {{trigger_type}} + - Source platform: {{source_platform}} + Store relevant documentation snippets for reference + + + + + Load {{platform_mappings}} file + Extract mappings for {{source_platform}} + Identify equivalent n8n nodes for source platform components + + + + + Parse source workflow file/content + Extract workflow structure + + + Analyze workflow based on description and details: + 1. Identify trigger type and configuration + 2. List all actions/steps in order + 3. Identify conditional logic (if/then branches) + 4. Identify loops or iterations + 5. Identify data transformations + 6. Identify error handling + 7. Map integrations to n8n nodes + + Present analysis to user: + - Source trigger: [platform-specific trigger] + - n8n trigger: [mapped n8n node] + - Source actions: [list with platform names] + - n8n actions: [list with n8n node types] + - Logic: [conditional branches, loops] + - Transformations: [data mapping needs] + + + + Load {{helpers}} for node creation guidelines + Load {{templates}} for reference + + Design n8n workflow structure: + 1. Map source trigger to n8n trigger node + 2. Map each source action to n8n node(s) + 3. Convert conditional logic to IF/Switch nodes + 4. Convert loops to Split In Batches nodes + 5. Add Set/Code nodes for data transformations + 6. Plan node connections + 7. Add error handling where needed + + Present migration plan to user: + - n8n Trigger: [node type and configuration] + - n8n Nodes: [list with descriptions] + - Connections: [flow diagram] + - Data Mappings: [field mappings] + - Credentials Needed: [list of integrations requiring auth] + + Ask: "Does this migration plan look correct?" + Present numbered options: + 1. Yes - Proceed with migration + 2. No - Adjust the plan + 3. Add more details - Provide additional information + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust plan based on feedback + Repeat this step + + + + + Follow guidelines from {{helpers}} for proper node creation + + Initialize workflow structure: + + { + "name": "{{workflow_name}}", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [ + { + "name": "migrated-from-{{source_platform}}" + } + ] + } + + + Build nodes ONE at a time: + + For Each Mapped Node: + 1. Generate unique node ID + 2. Set node name (descriptive, unique) + 3. Set node type from platform mappings + 4. Set typeVersion (usually 1) + 5. Calculate position (220px spacing) + 6. Configure parameters based on source workflow + 7. Map data fields from source to n8n format + 8. Add credentials placeholder if needed + 9. Set error handling if required + + + For Data Transformations: + 1. Identify field mappings needed + 2. Create Set nodes for simple mappings + 3. Create Code nodes for complex transformations + 4. Use n8n expressions: ={{ $json.fieldName }} + 5. Handle data type conversions + 6. Handle date/time format differences + + + For Conditional Logic: + 1. Create IF nodes for if/then branches + 2. Create Switch nodes for multiple conditions + 3. Map source conditions to n8n condition format + 4. Set up true/false branches (index 0/1) + + + For Connections: + 1. Connect trigger to first action + 2. Connect actions in sequence + 3. Connect conditional branches + 4. Connect merge points + 5. Validate all connections + + + Add migration notes as workflow tags + Validate all node IDs are unique + Validate all connections reference existing nodes + + + + Add comment nodes or documentation: + - Source platform: {{source_platform}} + - Migration date: {timestamp} + - Credentials to configure: [list] + - Testing notes: [important considerations] + - Platform-specific differences: [notes] + + + + Save workflow to {{save_location}} + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow migrated successfully to {{save_location}}" + + + + Provide post-migration instructions: + 1. Import the JSON file into n8n + 2. Configure credentials for these services: [list] + 3. Review and update these data mappings: [list] + 4. Test with sample data before activating + 5. Compare outputs with original platform + 6. Monitor initial executions closely + + Highlight platform-specific differences: + - Authentication: [differences] + - Data formats: [differences] + - Scheduling: [differences] + - Error handling: [differences] + + Ask: "Would you like help with any specific part of the migration?" + Present numbered options: + 1. No - I'm ready to test + 2. Yes - Explain credential setup + 3. Yes - Explain data mappings + 4. Yes - Explain testing approach + + WAIT for user selection (1-4) + + + Provide requested explanation + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml new file mode 100644 index 00000000..8634098e --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml @@ -0,0 +1,32 @@ +name: migrate-workflow +description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/migrate-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + source_platform: "" # Will be elicited + workflow_description: "" # Will be elicited + workflow_file: "" # Will be elicited (optional) + workflow_content: "" # Will be elicited (optional) + integrations_used: [] # Will be elicited + trigger_type: "" # Will be elicited + complexity: "" # Will be elicited + save_location: "" # Will be elicited + workflow_name: "" # Will be elicited + context7_available: false # Will be checked + +default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json" + +standalone: true +web_bundle: false