Contacts Print

  • 0

Contacts API Documentation

The Contacts API allows you to manage and interact with your contacts on WaSMS.Net. This includes creating, deleting, and retrieving contacts and groups. Below are the key API endpoints for contact management.


1. Contacts - Create Contact

This endpoint allows you to create a new contact in your account. It requires the create_contact API permission.

POST: https://sys.wasms.net/api/create/contact

 

Parameters:

Field Type Description
secret String The API secret you copied from the Tools -> API Keys page.
phone String The recipient's mobile number, in E.164 format or local format.
name String Name of the contact.
groups String List of group IDs separated by commas.

 

Success Response Format:

Field Type Description
status Number Status code (200 = Success)
message String Response message
data Array Contact creation details

 

Example Success Response:

json
{ "status": 200, "message": "Contact has been created!", "data": false }

 

Error Response Format:

Field Type Description
status Number Status code: 400, 401, 403, 500
message String Error message
data Array Any additional data (usually empty)

 

Example PHP Request:

php
<?php $contact = [
"secret" => "API_SECRET", // your API secret from (Tools -> API Keys) page "groups" => "1,2,3,4",
"phone" => "+923012345678",
"name" => "Martin Crater" ];
$cURL = curl_init("https://sys.wasms.net/api/create/contact");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $contact);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);
?>

2. Contacts - Create Group

This endpoint allows you to create a contact group in your account. It requires the create_group API permission.

POST: https://sys.wasms.net/api/create/group

 

Parameters:

Field Type Description
secret String The API secret you copied from the Tools -> API Keys page.
name String The name of the contact group.

 

Success Response Format:

Field Type Description
status Number Status code (200 = Success)
message String Response message
data Array Group creation details

 

Example Success Response:

json
{ "status": 200, "message": "Contact group has been created!", "data": false }

Example PHP Request:

php
<?php $group = [
"secret" => "API_SECRET", // your API secret from (Tools -> API Keys) page "name" => "Friends" ];
$cURL = curl_init("https://sys.wasms.net/api/create/group");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $group);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);
?>

3. Contacts - Delete Contact

This endpoint allows you to delete a contact from your account. It requires the delete_contact API permission.

GET: https://sys.wasms.net/api/delete/contact

Parameters:

Field Type Description
secret String The API secret you copied from the Tools -> API Keys page.
id Number The contact ID to be deleted.

 

Success Response Format:

Field Type Description
status Number Status code (200 = Success)
message String Response message
data Array Contact deletion details

 

Example Success Response:

json
{ "status": 200, "message": "Contact has been deleted!", "data": false }

Example PHP Request:

php
<?php $apiSecret = "API_SECRET"; // your API secret from (Tools -> API Keys) page $contactId = 1;
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, "https://sys.wasms.net/api/delete/contact?secret={$apiSecret}&id={$contactId}");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);
?>

4. Contacts - Get Contacts

This endpoint allows you to retrieve a list of saved contacts. It requires the get_contacts API permission.

GET: https://sys.wasms.net/api/get/contacts

Parameters:

Field Type Description
secret String The API secret you copied from the Tools -> API Keys page.
limit Number (Optional) Limit the number of results per page. Default: 10.
page Number (Optional) Page number for pagination. Default: 1.

 

Success Response Format:

Field Type Description
status Number Status code (200 = Success)
message String Response message
data Array List of contacts

 

Example Success Response:

json
{ "status": 200, "message": "Saved Contacts", "data": [ { "id": 2, "groups": ["1"], "phone": "+639184661538", "name": "Shane" }, { "id": 3, "groups": ["1", "9", "10", "11"], "phone": "+639206150514", "name": "Terry Bom" } ] }

Example PHP Request:

php
<?php $apiSecret = "API_SECRET"; // your API secret from (Tools -> API Keys) page $cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, "https://sys.wasms.net/api/get/contacts?secret={$apiSecret}");
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($cURL);
curl_close($cURL);
$result = json_decode($response, true);
print_r($result);
?>

Conclusion

The WaSMS.Net Contacts API allows you to efficiently manage contacts and groups, providing full control over creation, deletion, and retrieval processes. By integrating these API endpoints into your system, you can automate and streamline your contact management activities.

For more information, visit the Tools -> API Keys page in your WaSMS.Net account or contact our support team.


Was this answer helpful?

« Back