Skip to content

regression: outgoing webhooks fail to match emoji trigger words - #41542

Open
abhinavkrin wants to merge 2 commits into
masterfrom
regression/outgoing-webhook-emoji-trigger-words
Open

regression: outgoing webhooks fail to match emoji trigger words#41542
abhinavkrin wants to merge 2 commits into
masterfrom
regression/outgoing-webhook-emoji-trigger-words

Conversation

@abhinavkrin

@abhinavkrin abhinavkrin commented Jul 23, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Outgoing webhooks that use an emoji shortcode as their trigger word (for example :smile:) stopped firing in 8.7.

The reason: since 8.7 the message composer saves emojis as their native Unicode character (😄) instead of the :smile: text. The outgoing-webhook matcher compares the configured trigger word against the raw message text, so :smile: no longer appeared anywhere in the message and the webhook silently never ran. This worked in 8.6, where the message was stored as :smile:.

This change makes the trigger matcher recognize both forms. For each configured trigger word it now also checks the word's native Unicode emoji equivalent, so a :smile: trigger matches whether the message contains :smile: (e.g. sent via API) or 😄 (sent from the composer). It reuses the same shortcode-to-unicode conversion the message pipeline already uses.

Screen.Recording.2026-07-24.at.4.34.02.AM.mov

Issue(s)

CORE-2469 (no GitHub issue).

Steps to test or reproduce

  1. Create an incoming webhook that posts to a channel, e.g. #emoji-webhook-results.
  2. Create an outgoing webhook on another channel #emoji-webhook-source: event Message Sent, Trigger Words :smile:, Word Placement Anywhere On, URL set to the incoming webhook's URL.
  3. Open #emoji-webhook-source, type hello and pick the 😄 emoji from the picker/autocomplete, then send it.
  4. Expected: the message is forwarded and appears in #emoji-webhook-results. (Before this fix, nothing appeared.)

Further comments

CORE-2469

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Trigger-based integrations now recognize Unicode equivalents of configured trigger words.
    • Preserved trigger matching behavior for words appearing at the beginning or anywhere in a message.
    • Recorded trigger data consistently using the configured trigger word.

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
@abhinavkrin
abhinavkrin requested a review from a team as a code owner July 23, 2026 23:04
@dionisio-bot

dionisio-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 179b67d

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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Trigger URL matching recognizes Unicode equivalents of configured shortname trigger words while preserving existing position rules and reporting the original configured trigger word.

Changes

Unicode trigger-word matching

Layer / File(s) Summary
Expand and match trigger variants
apps/meteor/server/lib/integrations/lib/triggerHandler.ts
Configured trigger words are expanded with shortnameToUnicode; matching supports original and converted variants, while data.trigger_word retains the configured value.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: type: bug

Suggested reviewers: kevlehman, sampaiodiego

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the regression and the main fix area: emoji trigger-word matching for outgoing webhooks.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2469: Request failed with status code 401

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/server/lib/integrations/lib/triggerHandler.ts (1)

519-523: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for Unicode trigger variants.

Please cover shortcode and Unicode matches in both prefix and anywhere modes, and assert that data.trigger_word remains the original configured shortcode.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/meteor/server/lib/integrations/lib/triggerHandler.ts` around lines 519 -
523, Add regression tests around the trigger matching logic in triggerHandler,
covering shortcode and Unicode variants for both prefix mode and
triggerWordAnywhere mode. Assert each match succeeds and that data.trigger_word
retains the original configured shortcode rather than the matched Unicode
variant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/meteor/server/lib/integrations/lib/triggerHandler.ts`:
- Around line 519-523: Add regression tests around the trigger matching logic in
triggerHandler, covering shortcode and Unicode variants for both prefix mode and
triggerWordAnywhere mode. Assert each match succeeds and that data.trigger_word
retains the original configured shortcode rather than the matched Unicode
variant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d736d9c3-6264-4ec6-abf4-9bc5acf17958

📥 Commits

Reviewing files that changed from the base of the PR and between a0134b9 and b325511.

📒 Files selected for processing (1)
  • apps/meteor/server/lib/integrations/lib/triggerHandler.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/lib/integrations/lib/triggerHandler.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/lib/integrations/lib/triggerHandler.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/lib/integrations/lib/triggerHandler.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/lib/integrations/lib/triggerHandler.ts
🔇 Additional comments (1)
apps/meteor/server/lib/integrations/lib/triggerHandler.ts (1)

20-31: LGTM!

@abhinavkrin abhinavkrin added this to the 8.7.0 milestone Jul 23, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.57%. Comparing base (a0134b9) to head (b325511).

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-8.7.0   #41542      +/-   ##
=================================================
- Coverage          68.59%   68.57%   -0.02%     
=================================================
  Files               4138     4138              
  Lines             159417   159420       +3     
  Branches           28202    28194       -8     
=================================================
- Hits              109349   109325      -24     
- Misses             44929    44962      +33     
+ Partials            5139     5133       -6     
Flag Coverage Δ
e2e 58.87% <ø> (+0.03%) ⬆️
e2e-api 45.35% <0.00%> (-0.01%) ⬇️
unit 70.53% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread apps/meteor/server/lib/integrations/lib/triggerHandler.ts
Comment thread apps/meteor/server/lib/integrations/lib/triggerHandler.ts
@abhinavkrin
abhinavkrin requested a review from KevLehman July 24, 2026 00:19
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>

@gabriellsh gabriellsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not regarding the code itself, but is this really a regression? Trigger words are supposed to match the text of the message, with the native emoji implementation, the only thing that changed is how the client sends the emoji, instead of sending the shortcode as text, the unicode is used directly.

With this change, now the trigger word can also match unicode emoji, if the text matches an emoji shortcode. This can be quite confusing, since the integration will trigger in a message that does not contain that actual text. Also, it was always possible to send emoji as unicode, and though the client changed substantially in that regard, the way that emoji is sent in a message depends on the client, thus that is not a breaking change that needs to be fixed.

I'll leave some changes requested here to ensure that we discuss this before moving forward. Once we merge this PR, there won't be any take-backsies, as reverting this would be a breaking change.

@scuciatto scuciatto removed this from the 8.7.0 milestone Aug 5, 2026
Base automatically changed from release-8.7.0 to master August 7, 2026 01:58
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.

4 participants