Create contact groups on your SMSJuice account that you can send to with the send API.
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.smsjuice.com/groups"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, '{ "key": "key", "secret": "secret", "groupName": "MyNewGroup", "contacts": [] }'); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); $response = curl_exec($ch); curl_close($ch); var_dump($response);
<?php include("../class/ContactGroup.class.php"); include("../TextMessagingService.php"); use TextMessagingService; //create the new group $group = new ContactGroup($key, $secret, $newGroupName); //add a contact to the group $group->addContact("447943385586"); //Add the new group to your account on SMSJuice for future use. echo TextMessagingService::addGroup($group); ?>
Parameter | Description | Required |
---|---|---|
key | account authentication key | Required |
secret | account authentication secret | Required |
groupName | name of group to add to your account | Required |
contacts | contacts to add to the group. The contacts list for the new group can be empty. It's empty by default when using our WRAPPERS, but you have to make sure it's there (empty or not)when programming manually. -You can add contacts with a name and a number OR just the number only. The list can take mixed values (as numbers only and names with numbers) at the same time. |
Required |
{ "status": "success" "operation": "group creation" "groupName": "jameme" "invalidContacts": [] }
Success Response | Description |
---|---|
status | whether the group creation was a success |
operation | the operation that was being done. In this case it's 'group creation' |
groupName | Name of the group created |
invalidContacts | A list of invalid contacts submitted but not stored as part of the group |
{ "operation": "failed" "error": "Group 'NewGroupName' already exists." }
Error Response | Description |
---|---|
invalid_credentials | Invalid API key and/or secret |
Group 'NewGroupName' already exists. | Group 'NewGroupName' already exists. |