Skip to content

New pagination not working for intercomClient.companies.listAttachedContacts({company_id}) #489

Closed

Description

@Gabrieloxe

Expected response

Pageable {
  response: {
    type: 'list',
    data: [ [Object], [Object], [Object], [Object], [Object] ],
    pages: {
      type: 'pages',
      next: null,
      page: 1,
      per_page: 50,
      total_pages: 1
    },
    total_count: 5
  },
  data: [],
  _hasNextPage: [Function: hasNextPage],
  getItems: [Function: getItems],
  loadNextPage: [Function: loadPage]
}

Observed response

...
 "pages": {
    "type": "pages",
    "next": {
      "page": 2,
      "starting_after": "WzE3NDczNjU1NTUwMDAsIjYzMTFhMTRkOWRiYzJjNGQ5NmU3MWJhNSIsMl0="
    },
    "page": 1,
    "per_page": 50,
    "total_pages": 4
  }

The main issue im facing here is the lack of the getting next page automatically as described in the sdk notes

 _hasNextPage: [Function: hasNextPage],
  getItems: [Function: getItems],
  loadNextPage: [Function: loadPage]

Activity

  1. jnchristensen commented on May 30, 2025

    @jnchristensen

    I'm seeing the same thing. The results are available in the response.data property but this is not exposed to the typescript linter since it is a private property.

  2. amitsharonzorro commented on Jul 3, 2025

    @amitsharonzorro

    I'm seeing the same thing, but even worse - no matter what I pass in the options, I get back only the first page.
    Request:

    await this.client.companies.listAttachedContacts({
          company_id: companyId,
          page: 2,
          per_page: 50,
        });
    

    Response:

    {
      "type": "pages",
      "next": {
        "page": 2,
        "starting_after": "WzE3MzYxODQ3MTAwMDAsIjY3MmU3ZTFmNmVhZDU1NjFmZTYwZjcyZSIsMl0="
      },
      "page": 1,
      "per_page": 50,
      "total_pages": 13
    }
    
  3. alif-tse commented on Jul 31, 2025

    @alif-tse

    Hey team,

    I have a customer who's impacted by the known TypeScript SDK bug where companies.listAttachedContacts fails to handle pagination correctly, preventing them from retrieving all contacts for large companies. I provided them with a workaround using the REST API and cursor-based pagination to fetch the full contact list while we wait for the SDK fix. I also offered assistance with implementing the workaround if they encounter issues.

    APP ID: 2404200
    Data hosting region: US
    User/Lead (who reported issue): 65b9271eb1e107a94e2d81ce
    Conversation with Customer: https://app.intercom.com/a/inbox/tx2p130c/inbox/admin/8107163/conversation/215469671384823?view=List

    Can Impersonate?: Yes
    Reason if no: N/a
    Affected customer's conversation/page: N/a

  4. alif-tse commented on Aug 14, 2025

    @alif-tse

    Hey @amitsharonzorro any update on this!

  5. Eclairemoy commented on Sep 4, 2025

    @Eclairemoy

    thanks for these details - we are working on a fix for this now!

  6. fern-support commented on Sep 5, 2025

    @fern-support
    Collaborator

    Hi @Gabrieloxe @alif-tse @amitsharonzorro @jnchristensen!
    Thanks for reporting this issue. Fern manages this generated SDK for Intercom, and we are investigating.
    We want to confirm that in the cases where you're seeing this bug that you're following the pagination usage pattern described in the README.md. From the snippets you've included here, we aren't seeing the step subsequent to calling the list method where you iterate over the items/pages.

    import { IntercomClient } from "intercom-client";
    
    const client = new IntercomClient({ token: "YOUR_TOKEN" });
    const response = await client.articles.list();
    for await (const item of response) {
        console.log(item);
    }
    
    // Or you can manually iterate page-by-page
    const page = await client.articles.list();
    while (page.hasNextPage()) {
        page = page.getNextPage();
    }
    

    Are you still seeing the issue when that's included?

  7. sean-inter-meade commented on Sep 8, 2025

    @sean-inter-meade

    @fern-support Hi there I've taken this over for @alif-tse so I will check in with the customer and let you know what they come back with. Ignore the below it's just to make sure I get pinged on comments made on this issue.

    APP ID: 2404200
    Data hosting region: US
    User/Lead (who reported issue): 65b9271eb1e107a94e2d81ce
    Conversation with Customer: https://intercomrades.intercom.com/a/apps/tx2p130c/inbox/inbox/conversations/215469671384823

  8. fern-support commented on Sep 26, 2025

    @fern-support
    Collaborator

    Circling back here. Has the adjusted syntax fixed this issue for folks?

  9. Gabrieloxe commented on Nov 24, 2025

    @Gabrieloxe
    Author

    Hi @fern-support and @sean-inter-meade, did you test the changes? This issue is still a problem and listAttachedContacts still does not support the for of loop pagination in the readme here : https://github.com/intercom/intercom-node?tab=readme-ov-file#pagination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions