Créer une étiquette WhatsApp
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "account_123",
"name": "VIP",
"color": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'account_123', name: 'VIP', color: 1})
};
fetch('https://api.wachap.com/v1/whatsapp/labels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'account_123', name: 'VIP', color: 1})
};
fetch('https://api.wachap.com/v1/whatsapp/labels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/labels"
payload = {
"accountId": "account_123",
"name": "VIP",
"color": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/labels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'account_123',
'name' => 'VIP',
'color' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/labels"
payload := strings.NewReader("{\n \"accountId\": \"account_123\",\n \"name\": \"VIP\",\n \"color\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"label": {
"id": "<string>",
"userId": "<string>",
"accountId": "<string>",
"labelId": "<string>",
"name": "<string>",
"color": 123,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"syncedAt": "<string>",
"fromSync": true,
"source": "<string>"
}
}Étiquettes WhatsApp
Créer une étiquette
Créez une nouvelle étiquette WhatsApp
POST
/
whatsapp
/
labels
Créer une étiquette WhatsApp
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/labels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "account_123",
"name": "VIP",
"color": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'account_123', name: 'VIP', color: 1})
};
fetch('https://api.wachap.com/v1/whatsapp/labels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'account_123', name: 'VIP', color: 1})
};
fetch('https://api.wachap.com/v1/whatsapp/labels', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/labels"
payload = {
"accountId": "account_123",
"name": "VIP",
"color": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/labels",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'account_123',
'name' => 'VIP',
'color' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/labels"
payload := strings.NewReader("{\n \"accountId\": \"account_123\",\n \"name\": \"VIP\",\n \"color\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"label": {
"id": "<string>",
"userId": "<string>",
"accountId": "<string>",
"labelId": "<string>",
"name": "<string>",
"color": 123,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"syncedAt": "<string>",
"fromSync": true,
"source": "<string>"
}
}Endpoint
/v1/whatsapp/labels
Body Parameters
Identifiant du compte WhatsApp.
Nom de l’étiquette. Si une étiquette active porte déjà ce nom, elle est retournée au lieu d’être recréée.
Identifiant de couleur WhatsApp. La valeur par défaut est
0.Identifiant personnalisé. WaChap génère un identifiant unique lorsqu’il est omis.
Exemple
curl -X POST https://api.wachap.com/v1/whatsapp/labels \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d '{
"accountId": "account_123",
"name": "VIP",
"color": 1
}'
Réponse
{
"success": true,
"label": {
"accountId": "account_123",
"labelId": "label_vip",
"name": "VIP",
"color": 1,
"deleted": false,
"source": "api"
}
}
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
⌘I
