Réimporter une liste
curl --request POST \
--url https://api.wachap.com/v1/contact-groups/{id}/reimport \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"csvUrl": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/reimport', 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({csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/reimport', 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}/reimport"
payload = { "csvUrl": "<string>" }
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/contact-groups/{id}/reimport",
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([
'csvUrl' => '<string>'
]),
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/contact-groups/{id}/reimport"
payload := strings.NewReader("{\n \"csvUrl\": \"<string>\"\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))
}Listes de contacts
Réimporter une liste depuis CSV
Remplacez tous les contacts d’une liste par un nouveau CSV
POST
/
contact-groups
/
{id}
/
reimport
Réimporter une liste
curl --request POST \
--url https://api.wachap.com/v1/contact-groups/{id}/reimport \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"csvUrl": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/reimport', 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({csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/reimport', 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}/reimport"
payload = { "csvUrl": "<string>" }
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/contact-groups/{id}/reimport",
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([
'csvUrl' => '<string>'
]),
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/contact-groups/{id}/reimport"
payload := strings.NewReader("{\n \"csvUrl\": \"<string>\"\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))
}Endpoint
/v1/contact-groups/:id/reimport
Headers
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
L’identifiant de la liste
Body Parameters
URL du nouveau fichier CSV à importer
Format du fichier CSV
Le fichier CSV doit contenir au minimum une colonnephone.
phone,name,city,email
+2290112345678,John Doe,Abidjan,john@example.com
+33612345678,Marie Dupont,Paris,marie@example.com
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/reimport \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"csvUrl": "https://example.com/new-contacts.csv"
}'
const response = await fetch('https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/reimport', {
method: 'POST',
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
csvUrl: "https://example.com/new-contacts.csv"
})
});
const data = await response.json();
console.log(data);
Exemple de réponse
{
"success": true,
"message": "Réimport déclenché",
"status": "importing"
}
Avertissement
Cette action est irréversible !
- Tous les contacts existants seront supprimés.
- Le nouveau CSV sera importé à leur place.
Codes d’erreur
| Code | Description |
|---|---|
400 | MISSING_CSV_URL - csvUrl est requis |
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | Liste non trouvée |
500 | REIMPORT_CONTACT_GROUP_ERROR - Erreur lors du réimport |
⌘I
