{
  "id": "wOhcAXUWvyjMx9W0FscSx",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Open edX Dynamic Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "1e4ea3cd-891f-4e53-aaa5-3e82edbb71ed",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3120,
        -384
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 336,
        "content": "## Existing user alert\n\nHandles the existing-user branch from the registration check by notifying sales in Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "9aae4045-9b63-4b03-8a71-18ab59a1fb23",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3120,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 320,
        "content": "## Create registered contact\n\nCreates a new HubSpot contact for a registration and adds the contact to the Open edX Users list."
      },
      "typeVersion": 1
    },
    {
      "id": "0a0b251f-dde9-4d5c-8de1-4813280a4533",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3584,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 304,
        "content": "## Welcome and log\n\nSends the new user a welcome email, notifies the team in Slack, and records the registration outcome in Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "0b4c3369-f363-481d-8c41-c6e7b1515124",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2480,
        336
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 304,
        "content": "## Enrollment intake update\n\nReceives Open edX enrollment events, finds the enrolled user in HubSpot, and adds an enrollment record to HubSpot."
      },
      "typeVersion": 1
    },
    {
      "id": "65cbee80-0dd2-43f6-829b-9fe8e81975af",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3136,
        336
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 304,
        "content": "## Enrollment notify and log\n\nSends an enrollment email, posts a team notification in Slack, and logs the enrollment result to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "ace3acde-e081-49cf-87d8-9bb60a6a28e5",
      "name": "User Registration Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2544,
        -96
      ],
      "parameters": {
        "path": "b3717af3-d9e2-464f-b09f-59f45eae30de",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "06661f75-cd0d-4ae2-9baf-b9abab1777f4",
      "name": "User Enrollment Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2528,
        464
      ],
      "parameters": {
        "path": "b3717af3-d9e2-464f-b09f-59f45eae30de",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "390ab280-b871-4059-a999-76a28bf33556",
      "name": "Dispatch Welcome Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3632,
        -32
      ],
      "parameters": {
        "html": "Your welcome message",
        "options": {},
        "subject": "Welcome",
        "toEmail": "={{ $('User Registration Trigger').item.json.body.user_pii_email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0b36d891-9e80-48c1-86a8-5899aa59d6d9",
      "name": "Check User Existence",
      "type": "n8n-nodes-base.if",
      "position": [
        2928,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "26bd5d0f-6f59-46ee-95b2-9d6ab0e63078",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b397b78a-30d4-4d1a-928d-109442c28f53",
      "name": "Add to Open edX Users List",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        3376,
        128
      ],
      "parameters": {
        "email": "={{ $('User Registration Trigger').item.json.body.user_pii_email }}",
        "listId": 0,
        "resource": "contactList"
      },
      "typeVersion": 2.2
    },
    {
      "id": "4f020b3c-d73d-4f39-a9f9-8fce8676c31d",
      "name": "Create HubSpot Contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        3168,
        128
      ],
      "parameters": {
        "email": "={{ $('User Registration Trigger').item.json.body.user_pii_email }}",
        "options": {},
        "additionalFields": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "29d7dc72-1442-49c6-b4c1-760361a85fdb",
      "name": "Notify Team via Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        3808,
        -32
      ],
      "parameters": {
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "5dcbc615-3cec-4579-8823-075ebfb874d3",
      "name": "Append Results to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3984,
        -32
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "94777905-3a6d-47f3-a79a-b0888e0eb5d1",
      "name": "Search HubSpot Contacts",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2752,
        -96
      ],
      "parameters": {
        "operation": "search",
        "returnAll": true,
        "additionalFields": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "9ff9deca-ea8d-44c5-8625-3a9563120322",
      "name": "Notify Sales via Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        3280,
        -208
      ],
      "parameters": {
        "text": "=Hey! New user registered  {{ $('User Registration Trigger').item.json.body.user_pii_email }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "39dcf28f-862e-43e2-afec-e96727a6a46b",
      "name": "Insert Enrollment Record",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2944,
        464
      ],
      "parameters": {
        "options": {},
        "additionalFields": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "8269e419-70a1-4f2d-9dcd-a033013eff5f",
      "name": "Find Enrolled User",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2752,
        464
      ],
      "parameters": {
        "operation": "search",
        "returnAll": true,
        "additionalFields": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "12a8059f-6f53-423d-b61e-1c7356e566ae",
      "name": "Dispatch Enrollment Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3184,
        464
      ],
      "parameters": {
        "html": "=Welcome to the  \"{{ $('User Enrollment Trigger').item.json.body.enrollment_course_display_name }}\"",
        "options": {},
        "subject": "Enrolled Successfully",
        "toEmail": "={{ $('User Enrollment Trigger').item.json.body.enrollment_user_pii_email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "36c3073e-d9c0-4164-9e56-b9870ee7b915",
      "name": "Notify Post-Enrollment Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        3376,
        464
      ],
      "parameters": {
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "5a1f4192-fafc-4dba-bc16-2e745803929b",
      "name": "Record to Sheets Post-Enroll",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3568,
        464
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "fbcd557b-209e-444f-90d3-071647e1c992",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        -384
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Open edX Dynamic Workflow\n\n### How it works\n\nThis workflow automates two Open edX event streams: user registration and course enrollment. Registration events are checked against HubSpot, routed differently for existing versus new users, then followed by email, Slack, and Google Sheets logging. Enrollment events update HubSpot with enrollment data and then send notifications and log the result.\n\n### Setup steps\n\n- Configure the two Open edX webhooks to send registration and enrollment events to the corresponding n8n webhook URLs.\n- Connect HubSpot credentials and verify the contact search, contact creation, list membership, and enrollment record fields match your HubSpot schema.\n- Configure the email sending credentials and update the welcome and enrollment email templates as needed.\n- Connect Slack credentials and select the appropriate channels for sales and team notifications.\n- Connect Google Sheets credentials and confirm the target spreadsheet, sheet tabs, and column mappings for both registration and enrollment logs.\n\n### Customization\n\nYou can adjust the HubSpot list, enrollment record fields, Slack channels, email templates, and Google Sheets destinations to match different Open edX programs or reporting needs."
      },
      "typeVersion": 1
    },
    {
      "id": "513de0cb-06b5-4aac-8ccd-acdeb2104873",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2496,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 320,
        "content": "## Registration intake check\n\nReceives new Open edX registration events, searches HubSpot for an existing contact, and branches based on whether the user already exists."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "ac26beac-9ad3-41dc-8d2a-7a288f24514f",
  "connections": {
    "Find Enrolled User": {
      "main": [
        [
          {
            "node": "Insert Enrollment Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check User Existence": {
      "main": [
        [
          {
            "node": "Notify Sales via Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create HubSpot Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Team via Slack": {
      "main": [
        [
          {
            "node": "Append Results to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HubSpot Contact": {
      "main": [
        [
          {
            "node": "Add to Open edX Users List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dispatch Welcome Email": {
      "main": [
        [
          {
            "node": "Notify Team via Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search HubSpot Contacts": {
      "main": [
        [
          {
            "node": "Check User Existence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "User Enrollment Trigger": {
      "main": [
        [
          {
            "node": "Find Enrolled User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Enrollment Record": {
      "main": [
        [
          {
            "node": "Dispatch Enrollment Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dispatch Enrollment Email": {
      "main": [
        [
          {
            "node": "Notify Post-Enrollment Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "User Registration Trigger": {
      "main": [
        [
          {
            "node": "Search HubSpot Contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add to Open edX Users List": {
      "main": [
        [
          {
            "node": "Dispatch Welcome Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Post-Enrollment Team": {
      "main": [
        [
          {
            "node": "Record to Sheets Post-Enroll",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}