Lister les listes de contacts
curl --request GET \
--url https://api.wachap.com/v1/contact-groups \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups', 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/contact-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups"
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/contact-groups",
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/contact-groups"
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))
}Listes de contacts
Lister les listes
Récupérez toutes vos listes de contacts. Les listes sont triées par date de création décroissante.
GET
/
contact-groups
Lister les listes de contacts
curl --request GET \
--url https://api.wachap.com/v1/contact-groups \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups', 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/contact-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups"
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/contact-groups",
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/contact-groups"
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))
}Endpoint
/v1/contact-groups
Headers
Bearer token avec votre Secret Key (format:
Bearer sk_...)Exemples de requêtes
curl -X GET https://api.wachap.com/v1/contact-groups \
-H "Authorization: Bearer token"
const response = await fetch('https://api.wachap.com/v1/contact-groups', {
method: 'GET',
headers: {
'Authorization': 'Bearer token'
}
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.wachap.com/v1/contact-groups"
headers = { "Authorization": "Bearer token" }
response = requests.get(url, headers=headers)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer token"],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Exemple de réponse
{
"success": true,
"total": 3,
"lists": [
{
"$id": "65f1234567890abcdef12345",
"userId": "user_xxx",
"name": "Clients Premium",
"csvUrl": null,
"status": "ready",
"createdAt": "2024-03-15T10:00:00.000Z",
"updatedAt": "2024-03-15T10:00:00.000Z",
"totalContacts": 150
},
{
"$id": "65f1234567890abcdef12347",
"userId": "user_xxx",
"name": "Import en cours",
"csvUrl": "https://example.com/importing.csv",
"status": "importing",
"createdAt": "2024-03-16T11:00:00.000Z",
"updatedAt": "2024-03-16T11:00:00.000Z",
"totalContacts": 0
}
]
}
Champs de la réponse
| Champ | Type | Description |
|---|---|---|
$id | string | Identifiant unique de la liste |
name | string | Nom de la liste |
status | string | Statut (ready, importing) |
totalContacts | number | Nombre de contacts dans la liste |
createdAt | string | Date de création |
Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide |
500 | LIST_CONTACT_GROUPS_ERROR - Erreur lors de la récupération |
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Réponse
200
OK
⌘I
