Skip to content

fix(intercom): keep mapped external_id in rETL v2 identify regardless of email - #5735

Merged
krishna2020 merged 2 commits into
developfrom
fix/intercom-retl-keep-mapped-external-id
Oct 27, 2026
Merged

krishna2020 merged 2 commits into
developfrom
fix/intercom-retl-keep-mapped-external-id

Conversation

@krishna2020

@krishna2020 krishna2020 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

What are the changes introduced in this PR?

Follow-up to #5730. In the Intercom rETL (mappedToDestination) identify flow for API v2, rEtlPayload still forced external_id to null whenever email was present, dropping an explicitly mapped external_id.

This replaces the forced assignment with a conditional one that only fills external_id when it is missing:

// keep a mapped external_id; when it is missing and email is not present, fall back to user_id
$.outputs.apiVersion === "v2" && !payload.external_id && !payload.email ? payload.external_id = payload.user_id;

What is the related Linear task?

Related to INT-7442

Please explain the objectives of your changes below

On v2 rETL, an external_id that was mapped (e.g. via identifierType: external_id) should always reach Intercom, and user_id should only be used as a fallback when there is no email.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

v2 rETL record Before After
external_id mapped, no email sent (since #5730) sent
external_id mapped, email present dropped sent
only user_id, no email external_id = user_id external_id = user_id
only user_id, email present no external_id no external_id

API v1 and event stream are unchanged.

Only setups that put external_id into the rETL traits themselves are affected (the mapper only offers user_id/email as identifiers — see INT-7448). For their records with an email, the contact matched by email now also gets the mapped external_id; Intercom may return a 409 if a different contact already owns that external_id.

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Testing

  • intercom-identify-test-22 (external_id + email) now expects external_id in the PUT body. It fails on current develop and passes with this change.
  • New rETL v2 identify cases:
    • intercom-identify-test-23: user_id identifier plus a different mapped external_id, no email → the mapped external_id wins (fails on the code before fix(intercom): keep mapped external_id in rETL v2 flow when email is absent #5730).
    • intercom-identify-test-24: identifierType: email → no external_id derived.
    • intercom-validation-test-11: no email, user_id or external_id → Either email or userId is required for Identify call.
  • All 76 Intercom component tests and 54 Intercom unit tests pass.

🤖 Generated with Claude Code

@krishna2020
krishna2020 requested review from a team as code owners October 27, 2026 07:12
Copilot AI balanced review requested due to automatic review settings October 27, 2026 07:12
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8223084b-7181-4b57-8abe-2b05dead522e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

saikumarrs
saikumarrs previously approved these changes Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The shared workflow also preserves external_id in API v1 requests, contrary to the stated v2-only scope.

1 open issue
What changed in this PR

This follow-up to #5730 preserves explicitly mapped external_id values when email is present in Intercom API v2 rETL identify payloads.

Changes:

  • Replaces unconditional external_id assignment with a conditional user_id fallback.
  • Updates the existing regression fixture to expect both email and the mapped external_id.
File Description
test/​integrations/​destinations/​intercom/​processor/​identifyTestData.ts Updates the expected identify payload and success criteria.
src/​cdk/​v2/​destinations/​intercom/​procWorkflow.yaml Preserves mapped IDs and conditionally applies the fallback.

Review effort: Balanced

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.40%. Comparing base (86ceb7c) to head (98d75ee).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5735   +/-   ##
========================================
  Coverage    92.40%   92.40%           
========================================
  Files          737      737           
  Lines        40859    40859           
  Branches      9586     9587    +1     
========================================
  Hits         37754    37754           
+ Misses        2921     2844   -77     
- Partials       184      261   +77     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused v2 change matches the intended behavior and includes relevant regression coverage, with no unresolved blocking issues.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

krishna2020 and others added 2 commits October 27, 2026 14:53
… of email

The rETL v2 payload step still forced external_id to null whenever email was
present, dropping an explicitly mapped external_id. Only fill external_id when
it is missing: keep a mapped value as is, and fall back to user_id only when
email is not present. API v1 is left untouched.

Follow-up to INT-7442

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add rETL v2 identify cases for:
- user_id identifier plus a different mapped external_id without email:
  the mapped external_id wins
- email as the rETL identifier: no external_id is derived
- no email, user_id or external_id: identify fails with
  "Either email or userId is required"

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@krishna2020
krishna2020 force-pushed the fix/intercom-retl-keep-mapped-external-id branch from 943a83b to 98d75ee Compare October 27, 2026 09:23
Copilot AI balanced review requested due to automatic review settings October 27, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused change and regression fixtures support the intended behavior with no unresolved blocking findings; tests were not run during this review.

No open issues 🎉

Review effort: Balanced

@sonarqubecloud

Copy link
Copy Markdown

@krishna2020
krishna2020 merged commit 0cf9dd7 into develop Oct 27, 2026
49 checks passed
@krishna2020
krishna2020 deleted the fix/intercom-retl-keep-mapped-external-id branch October 27, 2026 09:44
krishna2020 added a commit that referenced this pull request Nov 2, 2026
#5735 was reverted from the release in #5738 after the changelog was generated, so it does not ship in v1.166.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
krishna2020 added a commit that referenced this pull request Nov 2, 2026
#5735 was reverted from the release in #5738 after the changelog was generated, so it does not ship in v1.166.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
krishna2020 added a commit that referenced this pull request Nov 3, 2026
## What are the changes introduced in this PR?

Removes the #5735 entry from the v1.166.0 section of `CHANGELOG.md`.

The changelog was generated in `chore(release): v1.166.0` before #5735
was reverted from the release in #5738, so it still listed #5735 as
shipping. With the revert, nothing from #5735 ships in v1.166.0.

Replaces #5740, whose commit message failed commitlint
(`footer-max-line-length`: a body line starting with `#5735` is parsed
as a footer). Same change, reworded commit message.

## What is the related Linear task?

Related to INT-7442

## Please explain the objectives of your changes below

Keep the v1.166.0 changelog accurate.

### Any changes to existing capabilities/behaviour, mention the reason &
what are the changes ?

N/A — changelog only.

### Any new dependencies introduced with this change?

N/A

### Any new generic utility introduced or modified. Please explain the
changes.

N/A

### Any technical or performance related pointers to consider with the
change?

N/A

<hr>

### Developer checklist

- [x] My code follows the style guidelines of this project

- [x] **No breaking changes are being introduced.**

- [x] All related docs linked with the PR?

- [x] All changes manually tested?

- [ ] Any documentation changes needed with this change?

- [x] Is the PR limited to 10 file changes?

- [x] Is the PR limited to one linear task?

- [ ] Are relevant unit and component test-cases added in **new
readability format**?

### Reviewer checklist

- [ ] Is the type of change in the PR title appropriate as per the
changes?

- [ ] Verified that there are no credentials or confidential data
exposed with the changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

4 participants