Send message via API (example request)
cURL example```bash
curl -X POST https://api.envoisms.ma/v1/messages \
-H "Authorization: Bearer VOTRE_CLE_API" \
-H "Content-Type: application/json" \
-d '{
"to": "+212661234567",
"from": "ENVOISMS",
"channel": "sms",
"message": "Bonjour, votre commande a été confirmée.",
"message_type": "premium"
}'
const response = await fetch("https://api.envoisms.ma/v1/messages", {
method: "POST",
headers: {
"Authorization": "Bearer VOTRE_CLE_API",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "+212661234567",
from: "ENVOISMS",
channel: "sms",
message: "Bonjour, votre commande a été confirmée."
})
});
const data = await response.json();
{
"message_id": "msg_8f2a1c",
"status": "queued",
"to": "+212661234567",
"operator": "IAM",
"segments": 1,
"cost": 0.35
}