Sauvegarder un contact
curl --request POST \
--url https://api.wachap.com/v1/sms/save-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "John Doe",
"phone_number": "+1234567890"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'John Doe', phone_number: '+1234567890'})
};
fetch('https://api.wachap.com/v1/sms/save-contact', 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({name: 'John Doe', phone_number: '+1234567890'})
};
fetch('https://api.wachap.com/v1/sms/save-contact', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/sms/save-contact"
payload = {
"name": "John Doe",
"phone_number": "+1234567890"
}
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/sms/save-contact",
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([
'name' => 'John Doe',
'phone_number' => '+1234567890'
]),
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/sms/save-contact"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"phone_number\": \"+1234567890\"\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))
}{
"success": true,
"message": "<string>"
}SMS
Sauvegarder un contact
Sauvegarder un contact via FCM sur l’appareil enregistré
POST
/
sms
/
save-contact
Sauvegarder un contact
curl --request POST \
--url https://api.wachap.com/v1/sms/save-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "John Doe",
"phone_number": "+1234567890"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'John Doe', phone_number: '+1234567890'})
};
fetch('https://api.wachap.com/v1/sms/save-contact', 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({name: 'John Doe', phone_number: '+1234567890'})
};
fetch('https://api.wachap.com/v1/sms/save-contact', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/sms/save-contact"
payload = {
"name": "John Doe",
"phone_number": "+1234567890"
}
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/sms/save-contact",
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([
'name' => 'John Doe',
'phone_number' => '+1234567890'
]),
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/sms/save-contact"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"phone_number\": \"+1234567890\"\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))
}{
"success": true,
"message": "<string>"
}Endpoint
/sms/save-contact
Headers
Bearer token avec votre Secret Key (format:
Bearer sk_...)Body Parameters
Nom complet du contact à sauvegarder.
Numéro de téléphone du contact (format international, ex: +1234567890).
Note
Cette requête permet de synchroniser un contact avec l’appareil mobile enregistré. L’action est déclenchée via Google Firebase Cloud Messaging (FCM).
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/sms/save-contact \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"name": "John Doe",
"phone_number": "+1234567890"
}'
const response = await fetch('https://api.wachap.com/v1/sms/save-contact', {
method: 'POST',
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
phone_number: '+1234567890'
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.wachap.com/v1/sms/save-contact"
headers = {
"Authorization": "Bearer token",
"Content-Type": "application/json"
}
payload = {
"name": "John Doe",
"phone_number": "+1234567890"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
<?php
$curl = curl_init();
$payload = [
"name" => "John Doe",
"phone_number" => "+1234567890"
];
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/sms/save-contact",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer token",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Exemple de réponse
{
"success": true,
"message": "Contact sauvegardé avec succès via FCM",
"data": {
"contactId": "cnt_789ghi012jkl"
}
}
Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide ou manquante |
400 | MISSING_PARAMETERS - Nom ou numéro manquant |
500 | FCM_ERROR - Erreur lors de la synchronisation via FCM |
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/json
⌘I
