Edit a product
This endpoint will let you edit an existing product in your catalog.
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 will need the product ID to do this. You can obtain it finding the product in your list of products.
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
Field | Description |
---|---|
name | Name field of the product. You can't set this field to NULL |
image_url | An URL pointing to the first image of the product. You can't set this field to NULL |
description | A description of the product |
price | The price of your product. If the price was never set, editing it may not work unless you edit it using the app |
is_hidden | Whether this product is hidden from your customers or not |
url | URL field of the product. For example, the link to the product in your Shopify store |
retailer_id | your custom ID for this product. For example, its SKU value |
Invocation
Make a PUT
request to https://api.p.2chat.io/open/whatsapp/catalog/product/<product-id>
and specify any of the following fields in the request body:
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",
"product": {
"name": "PUMA > SUEDE CLASSIC REGAL (new)",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "150.00",
"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.",
"retailer_id": "puma1.1"
}
}
In the following examples, we are using 6489529801134316
as the product ID.
- cURL
- Python
- NodeJS
curl --location --request PUT 'https://api.p.2chat.io/open/whatsapp/catalog/product/6489529801134316' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981461442",
"product": {
"name": "PUMA > SUEDE CLASSIC REGAL (new)",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "140.00",
"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.",
"retailer_id": "puma1.1"
}
}'
import requests
url = "https://api.p.2chat.io/open/whatsapp/catalog/product/6489529801134316"
payload = json.dumps({
"from_number": "+595981461442",
"product": {
"name": "PUMA > SUEDE CLASSIC REGAL (new)",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "150.00",
"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.",
"retailer_id": "puma1.1"
}
})
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
let data = JSON.stringify({
"from_number": "+595981461442",
"product": {
"name": "PUMA > SUEDE CLASSIC REGAL (new)",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "150.00",
"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.",
"retailer_id": "puma1.1"
}
});
var config = {
method: 'PUT',
url: 'https://api.p.2chat.io/open/whatsapp/catalog/product/6489529801134316',
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
}