Skip to content

Moving some of the automation flow from n8n #41

Description

@pasc4le

Replace part of the current n8n-based recruitment automation flow with Inngest, so stage-related side effects are managed closer to the Next.js app and can be delayed, canceled, and extended with event/webhook-based logic.

The main goal is to stop executing some stage automations immediately on stage change. Instead, when a relevant stage change happens, the app should create an Inngest workflow that runs later and can still be canceled before execution.

Requirements:

  • use Inngest as the background workflow/scheduling solution alongside Next.js
  • trigger workflows from stage changes in the app, instead of relying only on n8n triggers
  • support delayed execution, starting with a default delay of 1 hour
  • support cancellation before the delayed action is executed
  • support sleeping-hour scheduling rules, for example:
    • if event time + 1 hour is before 9:00 PM, run at that time
    • if event time + 1 hour is 9:00 PM or later, run the next day at 9:00 AM
    • convert all the times to Rome timezone GMT+1/CET
  • keep the workflow design extensible so future automations can also be triggered from webhooks/events

Current Automations:

  • Step A: send the email confirming receipt of the application using a Google Docs template rendered through the shared email templating function, then notify the HR and log Telegram channels through the shared notification function
  • Step B: send the interview booking email, including the booking link generated from the current application data, using the shared email templating function, then notify the HR and log Telegram channels through the shared notification function
  • Step C: notify HR when a candidate selects an interview slot using the shared notification function
  • Step D: create the interview report document, create the calendar event and meeting link, save the generated data back into the interview record, then notify HR using the shared notification function
  • Shared email templating function: load the correct Google Docs template and replace placeholders with application or interview data. Considering using a library like jinja.
  • Shared notification function: route notifications to the correct Telegram channel depending on the event type

Suggested order:

  1. Add Inngest to the project and connect it to the Next.js app.
  2. Identify which stage changes should emit application events.
  3. Create a shared scheduling rule to compute the actual execution time.
  4. Implement delayed Inngest functions for the selected stage automations.
  5. Add cancellation logic so a later change can stop a pending workflow.
  6. Verify the migrated flow works without depending on n8n for those steps.

Acceptance criteria:

  •  selected stage automations are triggered from the app through Inngest
  •  migrated automations do not run immediately; they follow the new delayed scheduling rule
  •  pending automations can be canceled before execution
  •  business-hour scheduling is respected
  •  the new flow is structured so webhook/event-driven automations can be added later

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions