Problem
I am running a WhatsApp Business catalog with 63+ products across 6 collections. The current Evolution API implementation has critical pagination limitations that prevent fetching all products correctly.
1. getCatalog β Auto-pagination limited to 50 products max
File: src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
const limit = data.limit || 10; // β Default is only 10!
let countLoops = 0;
while (fetcherHasMore && countLoops < 4) { // β Max 4 loops only!
catalog = await this.getCatalog({ jid, limit, cursor: nextPageCursor });
// ...
countLoops++;
}
- With default
limit=10 and max 4 loops β 50 products max
- Even with
limit=50 and 4 loops β 250 products max
- For catalogs with 250+ products, this is insufficient
- The WhatsApp binary protocol supports cursor-based pagination via the
<after> tag, but the Evolution API does not expose the cursor parameter to users
2. cursor parameter stripped by validation schema
File: src/validate/business.schema.ts
export const catalogSchema = {
type: "object",
properties: {
number: { type: "string" },
limit: { type: "number" },
// β οΈ cursor is MISSING from validation schema!
},
};
Even though getCatalogDto defines cursor?: string, the validation schema strips it out, so users cannot manually paginate beyond the auto-pagination limit.
3. getCollections β Hard cap at 20 items per collection
File: src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
const limit = data.limit <= 20 ? data.limit : 20; // "tem esse limite, nΓ£o sei porque"
- Collections with more than 20 products get truncated
- In my case, both "Seblak" and "Cemilan" collections have exactly 20 products each β adding even 1 more product would cause data loss
- The comment "tem esse limite, nΓ£o sei porque" ("it has this limit, I don't know why") suggests this cap is arbitrary
- Baileys defaults to
limit = 51 for getCollections, but Evolution API overrides it to max 20
4. getCatalog frequently returns isBusiness: false (unreliable)
The fetchCatalog method catches errors and returns a fallback:
} catch (error) {
console.log(error);
return { wuid: jid, name: null, isBusiness: false };
}
This makes getCatalog unreliable β it frequently returns empty results even for valid business accounts, while getCollections works consistently.
Proposed Solutions
-
Increase auto-pagination loops β Change countLoops < 4 to a higher value (e.g., countLoops < 20) or make it configurable
-
Expose cursor in validation schema β Add cursor: { type: "string" } to catalogSchema so users can manually paginate
-
Increase limit default β Change data.limit || 10 to data.limit || 50 for better out-of-the-box experience
-
Remove or increase getCollections item limit β Change data.limit <= 20 ? data.limit : 20 to allow higher values (e.g., data.limit || 100)
-
Add nextPageCursor to getCatalog API response β Currently the internal auto-pagination consumes the cursor, but exposing it would allow external pagination
Environment
- Evolution API version: latest (self-hosted)
- WhatsApp integration: Baileys
- Catalog size: 63+ products across 6 collections
- Business account: Verified and active
Workaround (for anyone facing the same issue)
Currently using getCollections as the primary data source (it returns all products with collection/category info) and skipping getCatalog entirely. However, this still has the 20-item-per-collection limit.
cc: @n8n users who sync WA catalogs β this affects any catalog with 50+ products
Problem
I am running a WhatsApp Business catalog with 63+ products across 6 collections. The current Evolution API implementation has critical pagination limitations that prevent fetching all products correctly.
1.
getCatalogβ Auto-pagination limited to 50 products maxFile:
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.tslimit=10and max 4 loops β 50 products maxlimit=50and 4 loops β 250 products max<after>tag, but the Evolution API does not expose thecursorparameter to users2.
cursorparameter stripped by validation schemaFile:
src/validate/business.schema.tsEven though
getCatalogDtodefinescursor?: string, the validation schema strips it out, so users cannot manually paginate beyond the auto-pagination limit.3.
getCollectionsβ Hard cap at 20 items per collectionFile:
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.tslimit = 51for getCollections, but Evolution API overrides it to max 204.
getCatalogfrequently returnsisBusiness: false(unreliable)The
fetchCatalogmethod catches errors and returns a fallback:This makes
getCatalogunreliable β it frequently returns empty results even for valid business accounts, whilegetCollectionsworks consistently.Proposed Solutions
Increase auto-pagination loops β Change
countLoops < 4to a higher value (e.g.,countLoops < 20) or make it configurableExpose
cursorin validation schema β Addcursor: { type: "string" }tocatalogSchemaso users can manually paginateIncrease
limitdefault β Changedata.limit || 10todata.limit || 50for better out-of-the-box experienceRemove or increase getCollections item limit β Change
data.limit <= 20 ? data.limit : 20to allow higher values (e.g.,data.limit || 100)Add
nextPageCursorto getCatalog API response β Currently the internal auto-pagination consumes the cursor, but exposing it would allow external paginationEnvironment
Workaround (for anyone facing the same issue)
Currently using
getCollectionsas the primary data source (it returns all products with collection/category info) and skippinggetCatalogentirely. However, this still has the 20-item-per-collection limit.cc: @n8n users who sync WA catalogs β this affects any catalog with 50+ products