Create contact groups on your SMSJuice account

Create contact groups on your SMSJuice account that you can send to with the send API.


    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "");
    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": "MyExistingGroup",
        "contacts": ["447933652246"]
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $response = curl_exec($ch);




use TextMessagingService;
//create aninstance of the group that you want to add new contacts to
$group = new ContactGroup($key, $secret, $newGroupName);
//add thew new contact to the group
//Add the new contact to the group on your SMSJuice account.
echo TextMessagingService::addContactToGroup($group);


Parameter Description Required
key account authentication key
secret account authentication secret
groupName Name of existing group to which the new contacts/numbers will be added
contacts contacts to add to the existing group.
-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.


        "status": "success"
        "operation": "add contacts to group"
        "groupName": "IamAnExistingGroup"
        "invalidContacts": []

Success Response Codes

Success Response Description
status whether the group creation was a success
operation the operation that was being done. In this case it's 'add contacts to group'
groupName Name of the existing group to which new contacts were added
invalidContacts A list of invalid contacts submitted but not stored as part of the group


        "operation": "failed"
        "error": "Group 'MyGroupName' does not Exist. Please create a group first."

Error Response Codes

Error Response Description
invalid_credentials Invalid API key and/or secret
Group Does not exist Group to add numbers to does not exist on your account