-
Notifications
You must be signed in to change notification settings - Fork 113
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
feat(intercom): upgrade intercom version from 1.4 to 2.10 #2867
Conversation
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2867 +/- ##
===========================================
- Coverage 87.28% 87.16% -0.12%
===========================================
Files 872 859 -13
Lines 29500 29227 -273
Branches 6865 6817 -48
===========================================
- Hits 25749 25476 -273
Misses 3405 3405
Partials 346 346 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,57 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have some negative test cases as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check processor tests, i have already added negative tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For intermediate API call failure there no tests from what I confer
6128608
to
1fbdacc
Compare
let payload = .message.context.mappedToDestination === true ? $.outputs.rEtlPayload : $.outputs.groupEtlPayload; | ||
const contactId = $.outputs.searchContact; | ||
const companyId = await $.createOrUpdateCompany(payload, .destination); | ||
$.assert(companyId, "Unable to add user to company"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are creating/updating the company here and adding the user will be done from server. So we need to update the error messge.
$.assert(companyId, "Unable to add user to company"); | |
$.assert(companyId, "Unable to create or update company"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
- name: prepareCreateOrUpdateCompanyPayload | ||
condition: $.outputs.messageType === {{$.EventType.GROUP}} && !$.isDefinedAndNotNull($.outputs.searchContact) | ||
template: | | ||
$.assert(.message.groupId, "groupId is required for group call"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is required because groupId is mapped with company_id and intercom does lookup based on company_id. so it's always recommended to send groupId
if (apiServer === 'eu') { | ||
return BASE_EU_ENDPOINT; | ||
} | ||
if (apiServer === 'au') { | ||
return BASE_AU_ENDPOINT; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use switch case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
* @param {*} destination | ||
* @returns | ||
*/ | ||
const searchContact = async (message, destination) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we checked the limit of the search API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nesting & Limitations
You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiple's there can be:
There's a limit of max 2 nested filters
There's a limit of max 15 filters for each AND or OR group
this are their query limits which we are already following
rate limits is same and applicable to all endpoints as per below doc
https://developers.intercom.com/docs/references/rest-api/errors/rate-limiting/
I see some extra changes coming in . |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
closing this pr as it contains too many other changes due to conflicts which is difficult to resolve. created new pr here |
Description of the change
Version Upgrade Highlights:
1. An intermediate call is made to search for the contact.
2. If the contact is located, an update user call is made; otherwise, a create user call is initiated.
In v1.4, the response included two transformed outputs:
1. Creation or update of the company.
2. Addition of the user to the company.
With v2.10, the flow has been adjusted:
1. Initially, a contact lookup based on email is performed.
2. If a contact is found, an additional intermediate call is made to create and update the company. The final
payload, adding the user to the company, is then returned to the server.
3. If no contact is found, the second intermediate API call is skipped, and the response for creating or updating the
company is directly returned to the server.
Type of change
Related issues
Checklists
Development
Code review