cURL
curl -X POST 'https://api.wachap.com/v1/send' \
-H 'Content-Type: application/json' \
-d '{
"number": "2299775xxxx",
"type": "text",
"message": "Hello from cURL",
"instance_id": "609ACF283XXXX",
"access_token": "646116c7XXXX"
}'const res = await fetch('https://api.wachap.com/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
number: '2299775xxxx',
type: 'text',
message: 'Hello from JS',
instance_id: '609ACF283XXXX',
access_token: '646116c7XXXX'
})
});
const data = await res.json();
console.log(data);// app/api/send/route.js
export async function POST() {
const payload = {
number: '2299775xxxx',
type: 'text',
message: 'Hello from Next.js',
instance_id: '609ACF283XXXX',
access_token: '646116c7XXXX',
};
const res = await fetch('https://api.wachap.com/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
return new Response(await res.text(), { status: res.status });
}import requests
payload = {
'number': '2299775xxxx',
'type': 'text',
'message': 'Hello from Python',
'instance_id': '609ACF283XXXX',
'access_token': '646116c7XXXX'
}
r = requests.post('https://api.wachap.com/v1/send', json=payload)
print(r.json())<?php
$payload = [
'number' => '2299775xxxx',
'type' => 'text',
'message' => 'Hello from PHP',
'instance_id' => '609ACF283XXXX',
'access_token' => '646116c7XXXX'
];
$ch = curl_init('https://api.wachap.com/v1/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
payload := map[string]string{
"number": "2299775xxxx",
"type": "text",
"message": "Hello from Go",
"instance_id": "609ACF283XXXX",
"access_token": "646116c7XXXX",
}
b, _ := json.Marshal(payload)
resp, err := http.Post("https://api.wachap.com/v1/send", "application/json", bytes.NewBuffer(b))
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}{
"status": 200,
"message_id": "MSG-112233",
"message": "Message envoyé"
}{
"error": "<string>"
}Messages
Envoyer un message
Envoi de texte ou média via requête POST.
POST
/
send
cURL
curl -X POST 'https://api.wachap.com/v1/send' \
-H 'Content-Type: application/json' \
-d '{
"number": "2299775xxxx",
"type": "text",
"message": "Hello from cURL",
"instance_id": "609ACF283XXXX",
"access_token": "646116c7XXXX"
}'const res = await fetch('https://api.wachap.com/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
number: '2299775xxxx',
type: 'text',
message: 'Hello from JS',
instance_id: '609ACF283XXXX',
access_token: '646116c7XXXX'
})
});
const data = await res.json();
console.log(data);// app/api/send/route.js
export async function POST() {
const payload = {
number: '2299775xxxx',
type: 'text',
message: 'Hello from Next.js',
instance_id: '609ACF283XXXX',
access_token: '646116c7XXXX',
};
const res = await fetch('https://api.wachap.com/v1/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
return new Response(await res.text(), { status: res.status });
}import requests
payload = {
'number': '2299775xxxx',
'type': 'text',
'message': 'Hello from Python',
'instance_id': '609ACF283XXXX',
'access_token': '646116c7XXXX'
}
r = requests.post('https://api.wachap.com/v1/send', json=payload)
print(r.json())<?php
$payload = [
'number' => '2299775xxxx',
'type' => 'text',
'message' => 'Hello from PHP',
'instance_id' => '609ACF283XXXX',
'access_token' => '646116c7XXXX'
];
$ch = curl_init('https://api.wachap.com/v1/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
payload := map[string]string{
"number": "2299775xxxx",
"type": "text",
"message": "Hello from Go",
"instance_id": "609ACF283XXXX",
"access_token": "646116c7XXXX",
}
b, _ := json.Marshal(payload)
resp, err := http.Post("https://api.wachap.com/v1/send", "application/json", bytes.NewBuffer(b))
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}{
"status": 200,
"message_id": "MSG-112233",
"message": "Message envoyé"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
⌘I
