Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

feat: add onboarding chatbot flow for employee setup

Open Jayant-kernel opened this issue 11 months ago • 4 comments

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • Introduced an automated onboarding chatbot to guide users through setup.
    • Collects department, employee ID, and location; summarizes and confirms at completion.
    • Persists per-user progress so onboarding can resume across sessions.
    • Starts when users initiate onboarding and prevents duplicate completion.
    • Recognizes "help" messages to provide basic guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

Jayant-kernel avatar Dec 10 '25 07:12 Jayant-kernel

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar Dec 10 '25 07:12 dionisio-bot[bot]

⚠️ No Changeset found

Latest commit: 0c6e375ac8c6071a3118145b9b1aaaed3659e397

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Dec 10 '25 07:12 changeset-bot[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

:x: NullPointer-cell
:x: vaibhavmp25-maker


NullPointer-cell seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Dec 10 '25 07:12 CLAassistant

Walkthrough

A new Node.js Express webhook at POST /webhook implements a MongoDB-backed, stateful onboarding chatbot that persists per-user progress and responses and walks users through collecting department, employee ID, and location, with a global "help" handler.

Changes

Cohort / File(s) Change Summary
Onboarding Chatbot Server
onboarding-bot/index.js
Added new Express server implementing a stateful onboarding webhook. Connects to MongoDB via MONGODB_URI (with fallback), defines a Mongoose User schema/model (username, step, department, employeeId, location), creates users on first interaction, logs user/step/message, and handles a step-driven flow (steps 0–4) plus a global "help" response.
Project manifest
onboarding-bot/package.json
Added package.json with project metadata, entry point, scripts (start, dev), and dependencies: dotenv, express, mongoose.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Server as Express /webhook
  participant DB as MongoDB (Mongoose)

  Client->>Server: POST /webhook { username, message }
  Server->>DB: findOne({ username })
  alt user exists
    DB-->>Server: user doc (with step)
  else new user
    Server->>DB: create user { username, step:0 }
    DB-->>Server: new user doc
  end
  Server->>Server: evaluate message & current step
  alt "help" in message
    Server-->>Client: FAQ/help response
  else step 0: start command
    Server->>DB: update step -> 1
    DB-->>Server: updated doc
    Server-->>Client: prompt for department
  else step 1: record department
    Server->>DB: update department, step -> 2
    DB-->>Server: updated doc
    Server-->>Client: prompt for Employee ID
  else step 2: record employee ID
    Server->>DB: update employeeId, step -> 3
    DB-->>Server: updated doc
    Server-->>Client: prompt for location
  else step 3: record location
    Server->>DB: update location, step -> 4
    DB-->>Server: updated doc
    Server-->>Client: send summary (department, ID, location)
  else step 4: already completed
    Server-->>Client: "onboarding completed" message
  end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect Mongoose schema fields, defaults, and validation.
  • Validate step transition logic and handling of unexpected inputs.
  • Review DB connection, error handling, and startup logs.
  • Check message parsing for "help" detection and potential false positives.
  • Verify environment variable usage and fallback behavior.

Poem

🐇 I hop through messages, bright and spry,
Gathering answers as moments fly.
Department, ID, and where you'll stay—
I tuck them in and guide the way.
Onboarding done — a joyful rabbit sigh.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding an onboarding chatbot flow for employee setup, which matches the core purpose of the new files (index.js and package.json).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 10 '25 07:12 coderabbitai[bot]