BulkSMSMaroc API

Envoi de SMS depuis votre application

Un seul endpoint JSON pour envoyer des SMS via la plateforme BulkSMSMaroc.

Endpoint

POST https://bulksmsmaroc.com/api/send-push

Content-Type : application/json

Description

Cet endpoint permet d’envoyer des SMS en utilisant la plateforme BulkSMSMaroc depuis votre application.

Corps de la requête (JSON)

Paramètre Type Obligatoire Description
key string Oui Clé API fournie à l’utilisateur.
toNumber string Oui Numéro du destinataire au format international.
message string Oui Contenu du SMS à envoyer.

Exemple de corps JSON

{
  "key": "votre-cle-api",
  "toNumber": "+212612345678",
  "message": "Votre message"
}

Exemples d’intégration

curl -sS -X POST "https://bulksmsmaroc.com/api/send-push" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"key":"votre-cle-api","toNumber":"+212612345678","message":"Votre message"}'
<?php

$url = 'https://bulksmsmaroc.com/api/send-push';
$payload = [
    'key' => 'votre-cle-api',
    'toNumber' => '+212612345678',
    'message' => 'Votre message',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
const url = 'https://bulksmsmaroc.com/api/send-push';

async function sendSms() {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
    },
    body: JSON.stringify({
      key: 'votre-cle-api',
      toNumber: '+212612345678',
      message: 'Votre message',
    }),
  });

  const data = await response.json();
  return data;
}

sendSms();