Statut d'une campagne
curl --request GET \
--url https://api.wachap.com/v1/campaigns/{id}/status \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/campaigns/{id}/status', 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/campaigns/{id}/status', 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}/status"
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/campaigns/{id}/status",
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/campaigns/{id}/status"
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))
}Campagnes
Statut d’une campagne
Obtenez le statut détaillé et les statistiques d’une campagne
GET
/
campaigns
/
{id}
/
status
Statut d'une campagne
curl --request GET \
--url https://api.wachap.com/v1/campaigns/{id}/status \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.wachap.com/v1/campaigns/{id}/status', 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/campaigns/{id}/status', 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}/status"
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/campaigns/{id}/status",
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/campaigns/{id}/status"
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))
}Statut d’une campagne
Obtenez le statut détaillé et les statistiques d’une campagne.Endpoint
/v1/campaigns/:id/status
Headers
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
L’identifiant de la campagne
Exemples de requêtes
curl -X GET https://api.wachap.com/v1/campaigns/campaign_abc123/status \
-H "Authorization: Bearer token"
// Polling pour suivi temps réel
const response = await fetch('https://api.wachap.com/v1/campaigns/campaign_abc123/status', {
headers: { 'Authorization': 'Bearer token' }
});
const data = await response.json();
console.log(`Progression: ${data.campaign.progress.percentage}%`);
Exemple de réponse
{
"success": true,
"campaign": {
"id": "campaign_abc123",
"name": "Campagne Promotionnelle Janvier",
"status": "running",
"totalContacts": 150,
"sent": 87,
"failed": 3,
"pending": 60,
"progress": {
"percentage": 60,
"successRate": 96.67,
"failureRate": 3.33,
"estimatedTimeRemaining": 120000
}
}
}
Champs de la réponse
| Champ | Description |
|---|---|
status | Statut actuel (draft, running, paused, completed, failed) |
totalContacts | Nombre total de contacts |
sent | Messages envoyés avec succès |
failed | Messages échoués |
pending | Messages en attente |
progress.percentage | Pourcentage de progression (0-100) |
progress.estimatedTimeRemaining | Temps restant estimé (ms) |
Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | CAMPAIGN_NOT_FOUND - Campagne non trouvée |
⌘I
