feat: add trigger Message Edited and Message Deleted for integration outgoing
Proposed changes (including videos or screenshots)
When a user edits or deletes a message, Rocket.Chat will also send the corresponding information through the webhook (similar to the Message Sent trigger). If an external system wants to synchronize message data with Rocket.Chat, it can use the message_id to handle all related logic for that specific message.
-
add Trigger Message Edited
-
add Trigger Message Deleted
-
Rocket.chat send data via webhook when trigger Message Edited
-
Rocket.chat send data via webhook when trigger Message Deleted
Issue(s)
https://github.com/RocketChat/feature-requests/issues/952
Steps to test or reproduce
Further comments
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
π¦ Changeset detected
Latest commit: 1fb779c3b87103c10c8a47b4e3be94408e8dc6fc
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 41 packages
| Name | Type |
|---|---|
| @rocket.chat/meteor | Major |
| @rocket.chat/core-typings | Major |
| @rocket.chat/rest-typings | Major |
| @rocket.chat/uikit-playground | Patch |
| @rocket.chat/api-client | Patch |
| @rocket.chat/apps | Patch |
| @rocket.chat/core-services | Patch |
| @rocket.chat/cron | Patch |
| @rocket.chat/ddp-client | Patch |
| @rocket.chat/freeswitch | Patch |
| @rocket.chat/fuselage-ui-kit | Major |
| @rocket.chat/gazzodown | Major |
| @rocket.chat/http-router | Patch |
| @rocket.chat/livechat | Patch |
| @rocket.chat/model-typings | Patch |
| @rocket.chat/ui-avatar | Major |
| @rocket.chat/ui-client | Major |
| @rocket.chat/ui-contexts | Major |
| @rocket.chat/web-ui-registration | Major |
| @rocket.chat/account-service | Patch |
| @rocket.chat/authorization-service | Patch |
| @rocket.chat/ddp-streamer | Patch |
| @rocket.chat/omnichannel-transcript | Patch |
| @rocket.chat/presence-service | Patch |
| @rocket.chat/queue-worker | Patch |
| @rocket.chat/stream-hub-service | Patch |
| @rocket.chat/federation-matrix | Patch |
| @rocket.chat/license | Patch |
| @rocket.chat/media-calls | Patch |
| @rocket.chat/omnichannel-services | Patch |
| @rocket.chat/pdf-worker | Patch |
| @rocket.chat/presence | Patch |
| rocketchat-services | Patch |
| @rocket.chat/models | Patch |
| @rocket.chat/network-broker | Patch |
| @rocket.chat/omni-core-ee | Patch |
| @rocket.chat/mock-providers | Patch |
| @rocket.chat/ui-video-conf | Major |
| @rocket.chat/ui-voip | Major |
| @rocket.chat/instance-status | Patch |
| @rocket.chat/omni-core | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Walkthrough
Adds two outgoing trigger events, messageEdited and messageDeleted: event definitions, type updates, trigger handler mapping, callback registrations for edit/delete, invocation on delete, translations, and unit + E2E tests covering both flows.
Changes
| Cohort / File(s) | Summary |
|---|---|
Changeset & Docs \.changeset/feat-trigger-outgoing-add-edit-and-delete-events.md |
Adds changeset documenting the feature. |
Type Definitions packages/core-typings/src/IIntegration.ts |
Extends OutgoingIntegrationEvent to include 'messageEdited' and 'messageDeleted'. |
Event Configuration & I18n apps/meteor/app/integrations/lib/outgoingEvents.ts, packages/i18n/src/locales/en.i18n.json |
Adds outgoing event entries and English translations for messageEdited and messageDeleted. |
Trigger Handler & Mapping apps/meteor/app/integrations/server/lib/triggerHandler.ts |
Maps event args for messageEdited/messageDeleted, adds optional isDeleted?: boolean, guards outgoingEvents access, and includes message/room/user in payloads; sets isEdited/isDeleted appropriately. |
Trigger Registrations apps/meteor/app/integrations/server/triggers.ts |
Updates afterSaveMessage signature (typed IMessage), triggers messageEdited when appropriate, and registers afterDeleteMessage to emit messageDeleted. |
Delete Flow Invocation apps/meteor/app/lib/server/functions/deleteMessage.ts |
Invokes triggerHandler.executeTriggers('messageDeleted', deletedMsg, room, user) when a message is deleted. |
Unit Tests apps/meteor/tests/unit/server/integrations/triggerHandler.spec.ts, apps/meteor/tests/unit/server/integrations/triggers.spec.ts |
Adds unit tests covering trigger execution, argument mapping, isEdited/isDeleted flags, disabled integrations, multiple integrations, and error/edge cases for both events. |
End-to-End Tests apps/meteor/tests/e2e/integrations/message-triggers.spec.ts |
Adds E2E tests that create integrations for edit/delete, exercise edit and delete flows via API/UI, and validate integration lifecycle (enable/disable/delete). |
Sequence Diagram(s)
sequenceDiagram
participant User as User
participant App as Rocket.Chat App
participant Callbacks as Callback Registry
participant Handler as TriggerHandler
participant Integration as Outgoing Integration
rect rgb(200,230,255)
Note over User,Integration: Message Edited flow
User->>App: Edit message
App->>Callbacks: afterSaveMessage(message, {room})
Callbacks->>Handler: executeTriggers('messageEdited', message, room, editor)
Handler->>Handler: mapEventArgsToData('messageEdited')
Handler->>Integration: HTTP POST (payload with isEdited=true, message, user, room)
Integration-->>Handler: 2xx/response
end
rect rgb(230,200,255)
Note over User,Integration: Message Deleted flow
User->>App: Delete message
App->>Callbacks: afterDeleteMessage(message, room)
Callbacks->>Handler: executeTriggers('messageDeleted', message, room, deleter)
Handler->>Handler: mapEventArgsToData('messageDeleted')
Handler->>Integration: HTTP POST (payload with isDeleted=true, message, user, room)
Integration-->>Handler: 2xx/response
end
Estimated code review effort
π― 4 (Complex) | β±οΈ ~45 minutes
- Review mapping logic in
triggerHandler.tsfor accurate fields (isEdited/isDeleted, message text vs attachments). - Verify
triggers.tscallback conditions (editedAt/editedBy handling) and the newafterDeleteMessageregistration. - Confirm delete flow integration in
deleteMessage.tsand correct user attribution. - Inspect added tests for robustness and whether any private method overrides could mask issues.
Suggested labels
stat: ready to merge, stat: QA assured
Suggested reviewers
- tassoevan
- d-gubert
- lucas-a-pelegrino
Poem
π° A tap, a tweak, a vanished lineβ
Webhooks hop and bells align,
Edited flags and deleted trace,
Triggered tales set forth apace,
Tests nibble carrots, code feels fine. π₯
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 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 change: adding two new outgoing integration triggers for message edited and deleted events, which aligns with all substantial changes across multiple files. |
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
π₯ Commits
Reviewing files that changed from the base of the PR and between 89c273ae1beef4413aa2c2d2fbc538efb8958721 and 1fb779c3b87103c10c8a47b4e3be94408e8dc6fc.
π Files selected for processing (1)
-
packages/i18n/src/locales/en.i18n.json(1 hunks)
π§ Files skipped from review as they are similar to previous changes (1)
- packages/i18n/src/locales/en.i18n.json
[!TIP]
π Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests β including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- π Description β Summarize the main change in 50β60 words, explaining what was done.
- π References β List relevant issues, discussions, documentation, or related PRs.
- π¦ Dependencies & Requirements β Mention any new/updated dependencies, environment variable changes, or configuration updates.
- π Contributor Summary β Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- βοΈ Additional Notes β Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
Please review and merge this PR!