Campagne

Cette méthode vous permet d'envoyer une campagne à un ou plusieurs destinataires.

POST

/send

Paramètres du body

text
requis
Votre message
value
requis
Les numéros des destinataires
pushtype Le type d'envoi (alert ou marketing)
delay La date d'envoi Y-m-d H:i:s
sender Vous permet de personnaliser l'expéditeur
gsmsmsid Un id de votre choix pour lier le message à son accusé de réception

Exemples


POST /send HTTP/1.1
Host: api.smsfactor.com
Authorization: Bearer your.token
Accept: application/json

{
  "sms": {
    "message": {
      "text": "Message via API",
      "pushtype": "alert",
      "sender": "Illidan",
      "delay": "2019-09-05 10:44:28"
    },
    "recipients": {
      "gsm": [
        {
          "gsmsmsid": "100",
          "value": "33601020304"
        },
        {
          "gsmsmsid": "101",
          "value": "33601020305"
        }
      ]
    }
  }
}
          
        

<?xml version="1.0" encoding="UTF-8"?>
<sms>
  <message>
    <text>Message via API</text>
    <pushtype>alert</pushtype>
    <sender>Illidan</sender>
    <delay>2019-09-05 10:44:28</delay>
  </message>
  <recipients>
    <gsm gsmsmsid="100">33601020304</gsm>
    <gsm gsmsmsid="101">33601020305</gsm>
  </recipients>
</sms>
        
      

\SMSFactor\SMSFactor::setApiToken('your token');

$response = \SMSFactor\Campaign::send([
  'sms' => [
    'message' => [
      'text' => 'Message via API',
      'pushtype' => 'alert',
      'sender' => 'Illidan',
      'delay' => '2019-09-05 10:44:28'
    'recipients' => [
      'gsm' => [
        [
          'gsmsmsid' => "100",
          'value' => '33601020304'
        ],
        [
          'gsmsmsid' => "101",
          'value' => '33601020305'
        ]
      ]
    ]
  ]
], false); // True to simulate the campaign (no SMS sent)
      
    

Format de la réponse


{
  "status": 1,      
  "message": "OK",
  "ticket": "14672468",   //The id of your campaign
  "cost": 2,              //The cost of your campaign
  "credits": 642,         //Your credits after your campaign has been created
  "total": 2,             //Number of message before filtering  
  "sent": 2,              //Number of message after filtering
  "blacklisted": 0,       //Number of blacklisted numbers
  "duplicated": 0,        //Number of duplicated numbers
  "invalid": 0,           //Number of invalid numbers
  "npai": 0               //Number of npai numbers
}
          
        

<response>
  <status>1</status>
  <message>OK</message>
  <ticket>14672468</ticket>
  <cost>2</cost>
  <credits>642</credits>
  <total>2</total>
  <sent>2</sent>
  <blacklisted>0</blacklisted>
  <duplicated>0</duplicated>
  <invalid>0</invalid>
  <npai>0</npai>
</response>