Lister les étiquettes WhatsApp
curl --request GET \
--url https://api.wachap.com/v1/whatsapp/labels \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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: 'GET', headers: {Authorization: 'Bearer <token>'}};
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"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, 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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/labels"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"labels": [
{
"id": "<string>",
"userId": "<string>",
"accountId": "<string>",
"labelId": "<string>",
"name": "<string>",
"color": 123,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"syncedAt": "<string>",
"fromSync": true,
"source": "<string>"
}
],
"total": 123,
"sync": {},
"warning": {}
}Étiquettes WhatsApp
Lister les étiquettes
Récupérez les étiquettes d’un compte WhatsApp
GET
/
whatsapp
/
labels
Lister les étiquettes WhatsApp
curl --request GET \
--url https://api.wachap.com/v1/whatsapp/labels \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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: 'GET', headers: {Authorization: 'Bearer <token>'}};
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"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, 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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/labels"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"labels": [
{
"id": "<string>",
"userId": "<string>",
"accountId": "<string>",
"labelId": "<string>",
"name": "<string>",
"color": 123,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"syncedAt": "<string>",
"fromSync": true,
"source": "<string>"
}
],
"total": 123,
"sync": {},
"warning": {}
}Endpoint
Paramètres
string
requis
Identifiant du compte WhatsApp.
boolean
Utilisez
true pour demander une synchronisation avec WhatsApp avant de retourner la liste. Par défaut, WaChap utilise le cache disponible.Exemple
curl "https://api.wachap.com/v1/whatsapp/labels?accountId=account_123&sync=true" \
-H "Authorization: Bearer token"
Réponse
{
"success": true,
"labels": [
{
"accountId": "account_123",
"labelId": "label_vip",
"name": "VIP",
"color": 1,
"deleted": false,
"source": "sync"
}
],
"total": 1,
"sync": {
"requested": true,
"success": true,
"cached": true
}
}
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
