Skip to main content

Edit a collection

This endpoint will let you edit an existing collection of products in your catalog.

info

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.

info

You will need the collection ID you want to edit to do this. You can obtain it by finding the collection in your list of collections.

You will also need the product IDs of the products you want to add or remove from the collection. You can get them in your list of products.

caution

Just like with the app, each modification you make will go through a verification process made by WhatsApp that can take between a few minutes to a few hours.

Available fields

FieldDescription
add_product_idsThe list of product IDs you want to add to this collection. It can be empty
remove_product_idsThe list of product IDs you want to remove to this collection. It can be empty

Invocation

Make a PUT request to https://api.p.2chat.io/open/whatsapp/catalog/collection/<collection-id> and specify any of the following fields in the request body:

In the following examples, we are using 268305749345797 as the collection ID we are editing, with 7096834393683427 as the product ID to remove and 6498277906923281 to add.

Request body

For each request, you must specify the phone number you connected to 2Chat that has the product you want to edit inside its catalog.

{
"from_number": "+595981461442",
"collection": {
"remove_product_ids": [ "7096834393683427" ],
"add_product_ids": [ "6498277906923281" ]
}

}
curl --location --request PUT 'https://api.p.2chat.io/open/whatsapp/catalog/collection/268305749345797' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981461442",
"collection": {
"remove_product_ids": [ "7096834393683427" ],
"add_product_ids": [ "6498277906923281" ]
}
}'

Response

danger

The collection ID changes every time you edit it. Make sure to update new requests with the new ID.

{
"success": true
}