Skip to content
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

source-intercom-native: add config option to use /companies/scroll endpoint #2256

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

Alex-Bair
Copy link
Member

@Alex-Bair Alex-Bair commented Jan 8, 2025

Description:

Intercom has two separate endpoints for retrieving companies: /companies/list (limited to 10k companies) and /companies/scroll (limited to only one "scroll" happening at a time). For users that have more than 10k companies in their Intercom account, they will need to use the /companies/scroll endpoint to ensure no data is missed.

The connector previously always used the /companies/list endpoint, and this PR adds the ability to use the /companies/scroll endpoint instead. The new use_companies_list_endpoint config option controls which of the two company-related endpoints are used. Within the connector, an asyncio.Lock is used to avoid attempting concurrent "scrolls" between the two streams that want to use /companies/scroll - companies and company_segments.

The connector defaults to using /companies/scroll, preferring to capture all data instead of potentially missing data if the user has >10k companies.

It may be worthwhile to remove the option to use /companies/list at a later date. The main reasons I anticipate users would check the use_companies_list_endpoint option are:

  • they have another application using /companies/scroll that they can't disable (not sure how common that is)
  • they want the slight speed boost in companies and company_segments (which seems relatively negligible with the limited testing I've done)

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

source-intercom-native connector docs should be updated to reflect the new use_companies_list_endpoint config option.

Notes for reviewers:

Tested on a local stack. Confirmed:

  • Companies can be successfully fetched via the _scroll_companies function.
  • The companies and company_segments streams do not concurrently try to hit /companies/scroll.
  • The use_companies_list_endpoint config option controls whether /companies/list or /companies/scroll is used.
  • The connector crashes & logs an error message if it tries to access /companies/scroll but receives a 400 response indicating some other application is using the endpoint.

This change is Reviewable

…endpoint

Intercom has two separate endpoints for retrieving companies:
`/companies/list` (limited to 10k companies) and `/companies/scroll`
(limited to only one "scroll" happening at a time). For users that have
more than 10k companies in their Intercom account, they will need to use
the `/companies/scroll` endpoint to ensure no data is missed.

The `use_companies_list_endpoint` controls which of the two
company-related endpoints are used. Within the connector, an
`asyncio.Lock` is used to avoid attempting concurrent "scrolls" between
`companies` and `company_segments`.

The connector defaults to using `/companies/scroll`, preferring to
capture all data instead of potentially missing data if the user has >10k companies.

It may be worthwhile to remove the option to use `/companies/list` at a
later date. The main reasons I anticipate users would check the
`user_companies_list_endpoint` option are:
- they have another application using `/companies/scroll` that they
    can't disable (not sure how common that is)
- they want the slight speed boost in `companies` and `company_segments`
    (which seems relatively negligible with the testing I've done)
@Alex-Bair Alex-Bair force-pushed the bair/intercom-native-companies-scroll branch from f072c81 to 988e7bc Compare January 9, 2025 14:05
@Alex-Bair Alex-Bair marked this pull request as ready for review January 9, 2025 14:06
Copy link
Member

@williamhbaker williamhbaker left a comment

Choose a reason for hiding this comment

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

LGTM, nice!

@Alex-Bair Alex-Bair merged commit 04590ba into main Jan 9, 2025
74 of 81 checks passed
@Alex-Bair Alex-Bair deleted the bair/intercom-native-companies-scroll branch January 9, 2025 15:08
Alex-Bair added a commit to estuary/flow that referenced this pull request Jan 9, 2025
Updates links & documents the `use_companies_list_endpoint` config option added in estuary/connectors#2256.
Alex-Bair added a commit to estuary/flow that referenced this pull request Jan 9, 2025
Updates links & documents the `use_companies_list_endpoint` config option added in estuary/connectors#2256.
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.

2 participants