List all collections in a catalog
This endpoint will return a list of collections a given WhatsApp Business number has published on their account. You can list collections that belong to your own WhatsApp account or any other WhatsApp Business account.
To use this API, you must connect a number that uses the free version of WhatsApp Business. This API does not need a WhatsApp Business API account to work.
You may need the collection IDs of these collections to make modifications to your catalog.
Request query parameter
For each request, you must specify the phone number you connected to 2Chat that you want to use as the client. This must be set as a query parameter in the URL.
Example: from_number=+595981461442
, where +595981461442
is the number you have connected.
Getting a list of collections
If you want to get a list of your collections, make a GET request to https://api.p.2chat.io/open/whatsapp/catalog/collections?from_number=+595981461442
without specifying any phone number.
If you instead want to list collections that belong to another WhatsApp Business account, you can add that phone number to the URL to get them.
For example: https://api.p.2chat.io/open/whatsapp/catalog/collections/+17137157533?from_number=+595981461442
.
Use +595981461442 as an example of a live working set of collections you can query
Invocation
- cURL
- Python
- NodeJS
curl --location --request GET 'https://api.p.2chat.io/open/whatsapp/catalog/collections?from_number=+595981461442' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/whatsapp/catalog/collections?from_number=+595981461442"
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var config = {
method: 'get',
url: 'https://api.p.2chat.io/open/whatsapp/catalog/collections?from_number=+595981461442',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
{
"success": true,
"collections": [
{
"id": "1001398997609659",
"name": "Backpacks",
"is_approved": true,
"approval_status": "APPROVED",
"products": [
{
"id": "9846351425439378",
"is_hidden": false,
"url": "https://2chatdemo.com/products/herschel-iona",
"name": "HERSCHEL | IONA",
"description": "Featuring a cinch closure concealed by a slender top flap, the Iona backpack unites everyday practicality with clean design.",
"availability": "in stock",
"max_available": 99,
"whatsapp_product_can_appeal": true,
"retailer_id": "herschel1",
"checkmark": false,
"is_approved": true,
"approval_status": "APPROVED",
"images": [
{
"url": "https://2chat-user-data-dev.s3.amazonaws.com/w/p/595981461442/9846351425439378_1"
}
]
}
]
},
{
"id": "695139435805721",
"name": "Shoes",
"is_approved": true,
"approval_status": "APPROVED",
"products": [
{
"id": "6498277906923281",
"is_hidden": false,
"url": "",
"name": "PUMA | SUEDE CLASSIC REGAL",
"description": "First introduced in 1968, the Puma Suede Classic is Puma's most epic sneaker with its athletic inspired design and smooth suede. The Puma Suede Classic Regal Red/White is constructed with a suede upper and contrasting low profile rubber sole, and fat laces, the classic continues to make its mark on the streets today.",
"availability": "in stock",
"max_available": 99,
"whatsapp_product_can_appeal": true,
"retailer_id": "puma1",
"checkmark": false,
"is_approved": true,
"approval_status": "APPROVED",
"images": [
{
"url": "https://2chat-user-data-dev.s3.amazonaws.com/w/p/595981461442/6498277906923281_1"
}
]
}
]
}
]
}
Field | Description |
---|---|
id | The ID of the collection. You will need this value to make any kind of modification to this collection |
name | The name field of the collection. This field can't be edited |
is_approved | true when the product was approved by WhatsApp and visible to your customers |
approval_status | Any of PENDING , OUTDATED , REJECTED or APPROVED |
products | A list of products that are part of the collection |