Skip to content

Integrate Intercom SDK for helpdesk functionality #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Ayyanaruto
Copy link
Contributor

@Ayyanaruto Ayyanaruto commented Jul 5, 2025

2025-07-16.18-59-40.mp4

Integrate the Intercom SDK to enhance helpdesk prefill functionality, replacing the previous Freshworks integration with the new messaging feature.

Summary by CodeRabbit

  • New Features

    • Integrated Intercom messenger for user support, replacing the previous Freshworks widget.
    • Users can now initiate support messages via Intercom when encountering errors.
  • Chores

    • Updated dependencies to include the Intercom messenger SDK.

Copy link
Contributor

coderabbitai bot commented Jul 5, 2025

"""

Walkthrough

The changes replace the Freshworks support widget integration with the Intercom Messenger SDK in the web server project. This includes updating dependencies, initializing Intercom in the app head, and modifying the helpdesk prefill functionality to use Intercom for error reporting instead of Freshworks.

Changes

File(s) Change Summary
web-server/package.json Added @intercom/messenger-js-sdk dependency.
web-server/src/components/AppHead.tsx Removed Freshworks widget scripts and styles; initialized Intercom Messenger SDK in useEffect.
web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx Replaced Freshworks widget prefill with Intercom's showNewMessage for helpdesk error reporting.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppHead
    participant IntercomSDK

    User->>AppHead: Loads application
    AppHead->>IntercomSDK: Initialize with App ID
    Note right of IntercomSDK: Intercom Messenger loaded

    User->>SomethingWentWrong: Encounters error
    SomethingWentWrong->>IntercomSDK: showNewMessage(error details)
    IntercomSDK->>User: Opens Intercom Messenger with error message
Loading

Poem

🐇
Out with the old, in with the new,
Intercom hops in, Freshworks bids adieu.
Error reports now swiftly sent,
With messenger magic, support is meant.
A bunny’s leap, a cheerful cheer—
The helpdesk’s future is bright and clear!

"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd55e5e and 984a82f.

📒 Files selected for processing (1)
  • web-server/src/components/AppHead.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web-server/src/components/AppHead.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: All file linting
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

🔭 Outside diff range comments (1)
web-server/src/components/AppHead.tsx (1)

13-32: Potential issue: Intercom may initialize multiple times.

The Intercom initialization is inside a useEffect with dependencies that may cause it to re-run when the router changes. This could lead to multiple initializations of the Intercom widget.

Consider moving the Intercom initialization to a separate useEffect with an empty dependency array:

  useEffect(() => {
    const isDev = process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'development';
-    Intercom({
-      app_id: 'kckm1m2e'
-    });
+  }, [router.asPath, router.events, router.isReady, router.pathname]);
+
+  useEffect(() => {
+    Intercom({
+      app_id: process.env.NEXT_PUBLIC_INTERCOM_APP_ID || 'kckm1m2e'
+    });
+  }, []);
+
+  useEffect(() => {
+    const isDev = process.env.NEXT_PUBLIC_APP_ENVIRONMENT === 'development';
    if (!isDev) {
      const onFocus = () => track('WINDOW_FOCUS');
      const onBlur = () => track('WINDOW_BLUR');
      const onUnload = () => track('WINDOW_UNLOAD');

      window.addEventListener('focus', onFocus);
      window.addEventListener('blur', onBlur);
      window.addEventListener('beforeunload', onUnload);
      return () => {
        window.removeEventListener('focus', onFocus);
        window.removeEventListener('blur', onBlur);
        window.removeEventListener('beforeunload', onUnload);
      };
    }
  }, [router.asPath, router.events, router.isReady, router.pathname]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bafb28c and ec897c7.

⛔ Files ignored due to path filters (1)
  • web-server/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • web-server/package.json (1 hunks)
  • web-server/src/components/AppHead.tsx (2 hunks)
  • web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: All file linting
🔇 Additional comments (2)
web-server/package.json (1)

18-18: Confirm @intercom/messenger-js-sdk version and beta status

The dependency in web-server/package.json (line 18):

"@intercom/messenger-js-sdk": "^0.0.14",

is indeed the latest published release—but it’s still classified as a beta (0.0.x) with no non-beta version available.

Before proceeding, please ensure you’re comfortable with the implications of a beta SDK:

  • Pin the dependency to an exact version (e.g. "0.0.14") if you need to avoid unintended minor bumps.
  • Add integration or end-to-end tests around any Intercom interactions to catch breaking changes early.
  • Monitor the package’s changelog or GitHub issues for upcoming API changes or security advisories.
web-server/src/components/SomethingWentWrong/SomethingWentWrong.tsx (1)

1-1: Good implementation approach for replacing Freshworks with Intercom.

The import and usage of showNewMessage aligns well with the overall migration strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant