Dupliquer une liste
curl --request POST \
--url https://api.wachap.com/v1/contact-groups/{id}/duplicate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups/{id}/duplicate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups/{id}/duplicate', 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/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/{id}/duplicate"
req, _ := http.NewRequest("POST", 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
Dupliquer une liste
Créez une copie complète d’une liste de contacts existante avec tous ses contacts
POST
/
contact-groups
/
{id}
/
duplicate
Dupliquer une liste
curl --request POST \
--url https://api.wachap.com/v1/contact-groups/{id}/duplicate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups/{id}/duplicate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/contact-groups/{id}/duplicate', 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/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/{id}/duplicate"
req, _ := http.NewRequest("POST", 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
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
string
requis
L’identifiant de la liste à dupliquer
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/duplicate \
-H "Authorization: Bearer token"
const response = await fetch('https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/duplicate', {
method: 'POST',
headers: {
'Authorization': 'Bearer token'
}
});
const data = await response.json();
console.log(data);
Exemple de réponse
{
"success": true,
"newListId": "65f1234567890abcdef99999",
"list": {
"$id": "65f1234567890abcdef99999",
"userId": "user_xxx",
"name": "Clients Premium (copie)",
"csvUrl": null,
"status": "ready",
"createdAt": "2024-03-16T15:00:00.000Z",
"updatedAt": "2024-03-16T15:00:00.000Z",
"totalContacts": 150
}
}
Comportement
- La nouvelle liste aura le même nom suivi de ” (copie)”.
- Tous les contacts sont copiés avec leurs champs personnalisés.
- La nouvelle liste est immédiatement utilisable (
status: ready). - La liste originale n’est pas modifiée.
Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | Liste non trouvée |
500 | DUPLICATE_CONTACT_GROUP_ERROR - Erreur lors de la duplication |
