Skip to content

chore: remove deprecated methods for livechat in 8.0 #7058

Open
Rohit3523 wants to merge 20 commits intodevelopfrom
deprecated-method-remove
Open

chore: remove deprecated methods for livechat in 8.0 #7058
Rohit3523 wants to merge 20 commits intodevelopfrom
deprecated-method-remove

Conversation

@Rohit3523
Copy link
Contributor

@Rohit3523 Rohit3523 commented Mar 18, 2026

Proposed changes

Remove deprecated methods based on https://docs.rocket.chat/docs/deprecated-and-phasing-out-features.

New endpoints

  • livechat/agent.status
  • livechat/room.resumeOnHold
  • users.sendConfirmationEmail
  • livechat/room.closeByUser
  • livechat/room.forward
  • livechat/tags

Deprecated methods

  • livechat:changeLivechatStatus
  • livechat:resumeOnHold
  • sendConfirmationEmail
  • livechat:closeRoom
  • livechat:transfer
  • livechat:getTagsList

Issue(s)

https://rocketchat.atlassian.net/browse/SUP-1008

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • New Features

    • Added omnichannel endpoints for agent status, closing, forwarding, resuming on-hold conversations, and retrieving livechat tags.
    • Added user email confirmation endpoint.
  • Changes

    • Inquiry takeup now supports optional user assignment and returns success status.
    • Returning an inquiry now returns result + success flags instead of a bare boolean.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb7b8d2b-d5af-4528-9450-d35e5d4a3ffb

📥 Commits

Reviewing files that changed from the base of the PR and between 18556d5 and 65e1252.

📒 Files selected for processing (1)
  • app/ee/omnichannel/lib/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/ee/omnichannel/lib/index.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: format

Walkthrough

Updates REST endpoint definitions (omnichannel + users) and changes client-side services to prefer new REST calls for server versions >= 8.0.0 while preserving legacy method-wrapper fallbacks for older servers.

Changes

Cohort / File(s) Summary
Endpoint Definitions
app/definitions/rest/v1/omnichannel.ts, app/definitions/rest/v1/users.ts
Added omnichannel endpoints: livechat/agent.status (POST), livechat/room.closeByUser (POST), livechat/room.forward (POST), livechat/tags (GET), livechat/room.resumeOnHold (POST); updated livechat/inquiries.take and livechat/inquiries.returnAsInquiry signatures/returns; added users.sendConfirmationEmail (POST).
EE Omnichannel Logic
app/ee/omnichannel/lib/index.ts
Introduced server-version branching: changeLivechatStatus and takeResume now call REST endpoints (livechat/agent.status, livechat/room.resumeOnHold) for server >= 8.0.0, else use legacy SDK method-wrapper calls.
Client REST services
app/lib/services/restApi.ts
Updated functions to branch by server version: sendConfirmationEmail (returns { success: boolean } and calls users.sendConfirmationEmail), closeLivechat (uses livechat/room.closeByUser), forwardLivechat (uses livechat/room.forward), and getTagsList (uses livechat/tags and returns tags array) with fallbacks to legacy method wrappers for older servers.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Client UI
    participant Service as restApi Service
    participant Store as Redux Store
    participant SDK as SDK (methodCallWrapper / REST)
    participant Server as Server API

    UI->>Service: invoke action (e.g., change status / resume / close / forward / send confirmation / get tags)
    Service->>Store: read server.version
    alt server.version >= "8.0.0"
        Service->>SDK: POST new REST endpoint (e.g., livechat/agent.status, livechat/room.resumeOnHold, users.sendConfirmationEmail, livechat/room.closeByUser, livechat/room.forward, livechat/tags)
        SDK->>Server: HTTP POST/GET to REST API
        Server-->>SDK: REST response ({ success: boolean, ... })
        SDK-->>Service: return response
    else older server
        Service->>SDK: call legacy method wrapper (e.g., livechat:changeLivechatStatus, livechat:resumeOnHold, sendConfirmationEmail, livechat:closeRoom, livechat:transfer, livechat:getTagsList)
        SDK->>Server: DDP method call
        Server-->>SDK: method response
        SDK-->>Service: return response
    end
    Service-->>UI: resolve promise / return result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: removing deprecated livechat methods in preparation for version 8.0 compatibility.
Linked Issues check ✅ Passed The PR addresses SUP-1008 by replacing all deprecated livechat methods with new REST endpoints, restoring omnichannel toggle functionality and ensuring server 8.0+ compatibility.
Out of Scope Changes check ✅ Passed All changes directly support the objective of migrating deprecated livechat methods to REST endpoints; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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.

@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 18, 2026 16:13 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 18, 2026 16:13 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 18, 2026 16:13 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 18, 2026 16:29 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 18, 2026 16:29 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 18, 2026 16:29 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 18, 2026 17:08 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 18, 2026 17:08 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 18, 2026 17:08 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 19, 2026 12:03 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 19, 2026 12:03 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 19, 2026 12:03 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 19, 2026 13:19 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 19, 2026 13:19 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 19, 2026 13:19 — with GitHub Actions Error
@Rohit3523 Rohit3523 changed the title chore: replace livechat deprecated method chore: remove deprecated methods for livechat in 8.0 Mar 19, 2026
@Rohit3523 Rohit3523 marked this pull request as ready for review March 19, 2026 13:37
@Rohit3523 Rohit3523 had a problem deploying to experimental_android_build March 19, 2026 13:38 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to official_android_build March 19, 2026 13:38 — with GitHub Actions Error
@Rohit3523 Rohit3523 had a problem deploying to experimental_ios_build March 19, 2026 13:38 — with GitHub Actions Error
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/lib/services/restApi.ts (1)

456-463: Consider adding type definition for transferData.

The transferData parameter is typed as any, which loses type safety. The type definition for livechat/room.forward in omnichannel.ts specifies { roomId: string; userId?: string; departmentId?: string }.

♻️ Proposed type improvement
-export const forwardLivechat = (transferData: any) => {
+export const forwardLivechat = (transferData: { roomId: string; userId?: string; departmentId?: string }) => {
 	const serverVersion = reduxStore.getState().server.version;
 	if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '8.0.0')) {
 		return sdk.post('livechat/room.forward', transferData);
 	}
 	// RC 0.36.0
 	return sdk.methodCallWrapper('livechat:transfer', transferData);
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/lib/services/restApi.ts` around lines 456 - 463, forwardLivechat
currently types transferData as any, losing type safety; replace any with the
proper typed shape used for the RPC "livechat/room.forward" (e.g. the
interface/type from omnichannel.ts: { roomId: string; userId?: string;
departmentId?: string }) so that forwardLivechat(transferData: ...) uses that
specific type; update the function signature in forwardLivechat and any callers
if needed to import and use the shared type (referencing forwardLivechat and the
type declared in omnichannel.ts) to ensure consistent typing across
SDK.post('livechat/room.forward') and
sdk.methodCallWrapper('livechat:transfer').
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/ee/omnichannel/lib/index.ts`:
- Around line 10-17: The function changeLivechatStatus has an unused parameter
`status`; remove it from the signature and stop passing it into the legacy call.
Update export const changeLivechatStatus = () => { ... } and change the fallback
call from sdk.methodCallWrapper('livechat:changeLivechatStatus', status) to
sdk.methodCallWrapper('livechat:changeLivechatStatus') (and adjust any
TypeScript signatures/types accordingly). Keep the compareServerVersion check
and the sdk.post('livechat/agent.status') call unchanged.

---

Nitpick comments:
In `@app/lib/services/restApi.ts`:
- Around line 456-463: forwardLivechat currently types transferData as any,
losing type safety; replace any with the proper typed shape used for the RPC
"livechat/room.forward" (e.g. the interface/type from omnichannel.ts: { roomId:
string; userId?: string; departmentId?: string }) so that
forwardLivechat(transferData: ...) uses that specific type; update the function
signature in forwardLivechat and any callers if needed to import and use the
shared type (referencing forwardLivechat and the type declared in
omnichannel.ts) to ensure consistent typing across
SDK.post('livechat/room.forward') and
sdk.methodCallWrapper('livechat:transfer').
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 266a2572-ccd5-4b8e-8523-edde49b68e7a

📥 Commits

Reviewing files that changed from the base of the PR and between 115fa79 and 18556d5.

📒 Files selected for processing (4)
  • app/definitions/rest/v1/omnichannel.ts
  • app/definitions/rest/v1/users.ts
  • app/ee/omnichannel/lib/index.ts
  • app/lib/services/restApi.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: format
🔇 Additional comments (7)
app/definitions/rest/v1/omnichannel.ts (2)

139-148: LGTM!

The updated type definitions for livechat/inquiries.take (adding optional userId param and returning { success: boolean }) and livechat/inquiries.returnAsInquiry (returning { result: boolean; success: boolean }) align with the migration to REST endpoints.


259-292: LGTM!

The endpoint type definitions for livechat operations are well-structured and correctly implemented. All five endpoints (livechat/agent.status, livechat/room.closeByUser, livechat/room.forward, livechat/tags, and livechat/room.resumeOnHold) properly type both request parameters and response shapes, and their usage throughout the codebase confirms the type signatures are accurate.

app/definitions/rest/v1/users.ts (1)

72-74: LGTM!

The new users.sendConfirmationEmail endpoint type definition is correctly structured and follows the established pattern for POST endpoints in this file.

app/ee/omnichannel/lib/index.ts (1)

40-47: LGTM!

The takeResume function correctly implements version branching and properly passes the roomId parameter to the new livechat/room.resumeOnHold endpoint.

app/lib/services/restApi.ts (3)

109-116: LGTM!

The sendConfirmationEmail function correctly implements version branching with consistent return type Promise<{ success: boolean }> for both the new REST endpoint and the legacy method wrapper.


419-431: LGTM!

The closeLivechat function correctly implements version branching. The new livechat/room.closeByUser endpoint receives the required parameters (rid, comment, and optional tags), while the legacy fallback maintains backward compatibility.


507-518: LGTM!

The getTagsList function correctly implements version branching with proper defensive coding. The success check and fallback to an empty array ensures graceful handling of API failures.

@Rohit3523 Rohit3523 deployed to approve_e2e_testing March 19, 2026 13:44 — with GitHub Actions Active
@Rohit3523 Rohit3523 requested a deployment to official_android_build March 19, 2026 13:47 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_android_build March 19, 2026 13:47 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to experimental_ios_build March 19, 2026 13:47 — with GitHub Actions Waiting
@Rohit3523 Rohit3523 requested a deployment to official_ios_build March 19, 2026 13:47 — with GitHub Actions Waiting
Copy link
Contributor

@OtavioStasiak OtavioStasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants