Dupliquer une campagne
curl --request POST \
--url https://api.wachap.com/v1/campaigns/{id}/duplicate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/campaigns/{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/campaigns/{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/campaigns/{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/campaigns/{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/campaigns/{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))
}Campagnes
Dupliquer une campagne
Créez une copie exacte d’une campagne existante
POST
/
campaigns
/
{id}
/
duplicate
Dupliquer une campagne
curl --request POST \
--url https://api.wachap.com/v1/campaigns/{id}/duplicate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/campaigns/{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/campaigns/{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/campaigns/{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/campaigns/{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/campaigns/{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))
}Dupliquer une campagne
Créez une copie exacte d’une campagne existante.Endpoint
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
string
requis
L’identifiant de la campagne à dupliquer
Éléments copiés
✅ Copié :- Nom de la campagne (avec préfixe “Copie de”)
- Type de message et contenu
- Configuration (délai, programmation, etc.)
- Liste des contacts
- AccountId
- Statistiques (
sent,failed,pendingremis à 0) - Statut (devient
draft) - Dates de lancement et de fin
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/campaigns/campaign_abc123/duplicate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token"
Exemple de réponse
{
"success": true,
"message": "Campagne dupliquée avec succès",
"originalCampaign": { "id": "campaign_abc123" },
"newCampaign": {
"id": "campaign_xyz789",
"name": "Copie de Campagne Promotionnelle Janvier",
"status": "draft"
}
}
Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | CAMPAIGN_NOT_FOUND - Campagne source non trouvée |
