Skip to content

GetCollection#

Test Postman Apidog

The method is designed to retrieve information about a specific catalog collection with support for pagination over products within the collection.

Behavior change

Previously the method worked without instance authorization via WhatsApp's public GraphQL. Now the instance must be authorized.
If the method is called on an unauthorized instance, an authorization error is returned.

WhatsApp-side limitations

If catalog methods are called frequently, WhatsApp may temporarily restrict access to the Business Catalog API. Do not send a large number of requests to catalog methods over a short period of time.

Request#

To get a collection, you need to send a request to the address:

POST
{{apiUrl}}/waInstance{{idInstance}}/getCollection/{{apiTokenInstance}}

To obtain the request parameters idInstance and apiTokenInstance, refer to the section Before you start.

Request parameters#

Parameter Type Required Description
chatId string Yes Seller's chat identifier in the format 79876543210@c.us
collectionId string Yes Unique collection identifier
productLimit integer No Maximum number of products in the response (default 3)
afterProduct string No Cursor for product pagination. Use the paging.after value from the previous response

Request body example#

{
  "chatId": "79876543210@c.us",
  "collectionId": "25790827003925602",
  "productLimit": 3,
  "afterProduct": "value from paging.after"
}

Response#

Response fields#

Field Type Description
paging object Pagination object, contains the after field โ€“ cursor for the next page of products
collection object The requested collection object

Collection object (collection):

Field Type Description
id string Unique collection identifier
name string Collection name
status_info object Status information (usually null)
products array Array of products within the collection (limited by productLimit)

Product object inside the collection:

Field Type Description
id string Product identifier
name string Product name
price string Price (in the smallest currency unit)
currency string Currency code

Response body example#

{
  "paging": {
    "after": ""
  },
  "collection": {
    "id": "25790827003925602",
    "name": "Kitchen Essentials",
    "status_info": null,
    "products": [
      {
        "id": "26437451389197252",
        "name": "Handmade Ceramic Mug",
        "price": "100",
        "currency": "USD"
      }
    ]
  }
}

GetCollection errors#

For a list of common errors for all methods, see the section Common errors

Code examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/getCollection/{{apiTokenInstance}}"

payload = {
    "chatId": "79876543210@c.us",
    "collectionId": "25790827003925602",
    "productLimit": 3,
    "afterProduct": ""
}
headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getCollection/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "79876543210@c.us",
    "collectionId": "25790827003925602",
    "productLimit": 3,
    "afterProduct": ""
}'