Simuler une campagne

Cette méthode vous permet de simuler l'envoi d'une campagne. Simuler une campagne vous permet de connaitre le coût ainsi que le nombre de SMS envoyés et filtrés. Cette route ne crée pas réellement de campagne.

POST

/send/simulate

POST

/send/lists/simulate

Paramètres du body

text
requis
Votre message
value
requis
L'id de la liste
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

Exemples


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

{
  "sms": {
    "message": {
      "text": "Message via API",
      "pushtype": "alert",
      "sender": "Sephiroth",
      "delay": "2024-06-07 10:10:03"
    },
    "lists": [
      {
        "value": 45190
      },
      {
        "value": 47854
      }
    ]
  }
}
          
        

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

<?xml version="1.0" encoding="UTF-8"?>
<sms>
  <message>
    <text>Message via API</text>
    <pushtype>alert</pushtype>
    <sender>Sephiroth</sender>
    <delay>2024-06-07 10:10:03</delay>
  </message>
  <lists>
    <value>45190</value>
  </lists>
  <lists>
    <value>47854</value>
  </lists>
</sms>

      

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

$response = \SMSFactor\Campaign::sendToLists([
  'sms' => [
    'message' => [
      'text' => 'Message via API',
      'pushtype' => 'alert',
      'sender' => 'Sephiroth',
      'delay' => '2024-06-07 10:10:03'
    'lists' => [
      [
        'value' => 45190
      ],
      [
        'value' => 47854
      ]
    ]
  ]
], true); // True to simulate the campaign (no SMS sent)
      
    

Format de la réponse


{
  "status": 1,
  "message": "OK",
  "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>
  <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>