Create list

This method allows you to create a list of contacts. Each contacts can have up to 4 custom informations. Those informations can then be displayed inside each text. For instance, if you insert [info1] in your text, it will automatically be replaced with the associated contact.

POST

/list

Body Parameters

value
required
The recipient's number in E.164 format
name The list name. If no name is provided, the creation date will be the default one
info1 Information 1
info2 Information 2
info3 Information 3
info4 Information 4

Examples


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

{
  "list": {
    "name": "My list",
    "contacts": {
      "gsm": [
        {
          "value": "33612345678",
          "info1": "Louis",
          "info2": "de Broglie",
          "info3": "1892",
          "info4": "Dieppe"
        },
        {
          "value": "33612345677",
          "info1": "Richard",
          "info2": "Feynman",
          "info3": "1918",
          "info4": "New-York"
        }
      ]
    }
  }
}
          
        

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

<?xml version="1.0" encoding="UTF-8" ?>
<list>
  <name>My list</name>
  <contacts>
    <gsm>
      <value>33612345678</value>
      <info1>Louis</info1>
      <info2>de Broglie</info2>
      <info3>1892</info3>
      <info4>Dieppe</info4>
    </gsm>
    <gsm>
      <value>33612345677</value>
      <info1>Richard</info1>
      <info2>Feynman</info2>
      <info3>1918</info3>
      <info4>New-York</info4>
    </gsm>
  </contacts>
</list>
        
      

$response = \SMSFactor\ContactList::create([
    'list' => [
      'name' => 'My list',
      'contacts' => [
        'gsm' => [
          [
            'value' => '33612345678',
            'info1' => 'Louis',
            'info2' => 'de Broglie',
            'info3' => '1892',
            'info4' => 'Dieppe'
          ],
          [
            'value' => '33612345677',
            'info1' => 'Richard',
            'info2' => 'Feynman',
            'info3' => '1918',
            'info4' => 'New-York'
          ]
        ]
      ]
    ]
]);
      
    

Result Format


{
  "status": 1,
  "message": "OK",
  "contacts": 2,
  "invalid": 0,
  "duplicates": 0,
  "id": "5a0331bffc5886074551ce97"     //the id of the created list. It's an ObjectId type (string of 12 chars)
}
          
        

<response>
  <status>1</status>
  <message>OK</message>
  <contacts>2</contacts>
  <invalid>0</invalid>
  <duplicates>0</duplicates>
  <id>50433</id>
</response>