Ajouter des contacts

Cette méthode vous permet d'ajouter des contacts à une liste.

POST

/list

Paramètres du body

value
requis
The recipient's number
listId
requis
L'id de la liste
info1 Information 1
info2 Information 2
info3 Information 3
info4 Information 4

Exemples


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

{
  "list": {
    "listId": 50433,
    "contacts": {
      "gsm": [
        {
          "value": "33601020306",
          "info1": "Hiroo",
          "info2": "Onoda"
        },
        {
          "value": "33601020307",
          "info1": "Grace",
          "info2": "Hopper"
        },
        {
          "value": "33601020308",
          "info1": "Hedy",
          "info2": "Lamarr",
          "info3": "Extase",
          "info4": "1933"
        }
      ]
    }
  }
}
          
        

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

<?xml version="1.0" encoding="UTF-8" ?>
<list>
  <listId>50433</listId>
  <contacts>
    <gsm info1="Hiroo" info2="Onoda">33601020306</gsm>
    <gsm info1="Grace" info2="Hopper">33601020307</gsm>
    <gsm info1="Hedy" info2="Lamarr" info3="Extase" info4="1933">33601020308</gsm>
  </contacts>
</list>
        
      

$response = \SMSFactor\ContactList::addContacts([
    'list' => [
      'list_id' => $list_id
      'contacts' => [
        'gsm' => [
          [
            'value' => '33601020306',
            'info1' => 'Hiroo',
            'info2' => 'Onoda'
          ],
          [
            'value' => '33601020307',
            'info1' => 'Grace',
            'info2' => 'Hopper'
          ],
          [
            'value' => '33601020308',
            'info1' => 'Hedy',
            'info2' => 'Lamarr',
            'info3' => 'Extase',
            'info4' => '1933'
          ]
        ]
      ]
    ]
]);
        
      

Format de la réponse


{
  "status": 1,
  "message": "OK",
  "contacts": 3,
  "id": "50433"     //the id of the created list
}
          
        

<?xml version="1.0" encoding="UTF-8" ?>
<response>
  <status>1</status>
  <message>OK</message>
  <contacts>3</contacts>
  <id>50433</id>
</response>