Add a product to your catalog
This endpoint will let you add a product to a WhatsApp catalog. If you also want to add it to a certain collection, you can do that with the Add Collection endpoint.
This endpoint needs that at least 1 product exists in your catalog. Add one manually using the app if you don't have any.
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 product IDs of these products to make modifications to your catalog.
Just like with the app, each modification you make will go through a verification process made by WhatsApp. It can take between a few minutes to a few hours.
Available fields
Field | Description |
---|---|
name | Name field of the product. This field is mandatory |
image_url | An URL pointing to the default image of the product. This field is mandatory |
description | A description of the product |
price | The price of your product |
currency | This value defaults to the currency of the country of your number. E.g.: USD , EUR , MXN , PYG , etc. |
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 |
Setting a currency
You can specify a currency that isn't your number's default but you won't be able to change it later. For example, if you have a United States number your default currency will
be USD
. If you don't specify any value for this field, this is the currency that will be displayed alongside your product prices.
However, you can also set it to CAD
for example, but you won't be able to edit the product to change it back to USD
later. You would have to delete the product and add it back in to restore it to USD
.
For a list of valid currency codes, see IBAN's list.
Invocation
Make a POST
request to https://api.p.2chat.io/open/whatsapp/catalog/product
to add a new product and specify the following request body:
Request body
For each request, you must specify the phone number you connected to 2Chat where you want to add the new product and the fields you want to fill out. Only the name
and
the image_url
are mandatory.
{
"from_number": "+595981461442",
"product": {
"name": "PUMA | SUEDE CLASSIC REGAL",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "110.00",
"currency": "USD",
"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"
}
}
- cURL
- Python
- NodeJS
curl --location --request POST 'https://api.p.2chat.io/open/whatsapp/catalog/product' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981461442",
"product": {
"name": "PUMA | SUEDE CLASSIC REGAL",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "110.00",
"currency": "USD",
"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"
}
}'
import requests
url = "https://api.p.2chat.io/open/whatsapp/catalog/product"
payload = json.dumps({
"from_number": "+595981461442",
"product": {
"name": "PUMA | SUEDE CLASSIC REGAL",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "110.00",
"currency": "USD",
"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"
}
})
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("POST", 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",
"image_url": "https://2chat.co/img/2chat-logo.png",
"price": "110.00",
"currency": "USD",
"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"
}
});
var config = {
method: 'POST',
url: 'https://api.p.2chat.io/open/whatsapp/catalog/product',
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
}