Home Sign In Try Free

Contacts


The contacts object contains functions related to adding, removing and retreiving contacts

get_all()

Returns an array containing all contacts. Returns an empty array if no contacts exist.

Function Declaration

public function get_all();

Example Code

$textplode = new Textplode('API_KEY');
$contacts = $textplode->contacts->get_all();

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":[{"id":"1","first_name":"Contact","last_name":"One","number":"440000000000","score":"100.00"},{"id":"24","first_name":"Contact","last_name":"Two","number":"440000000001","score":"91.67"},{"id":"25","first_name":"Contact","last_name":"Three","number":"440000000002","score":"0.00"},]}

get()

Returns a single contact by it's ID. Returns an empty array if contact does not exist.

Function Declaration

public function get($id);

Example Code

$textplode = new Textplode('API_KEY');
$contact = $textplode->contacts->get(1);

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":[{"id":"1","first_name":"Contact","last_name":"One","number":"440000000000","score":"100.00"}]}

get_by_number()

Returns a single contact by it's associated mobile number. Returns an empty array if contact does not exist.

Function Declaration

public function get_by_number($phone_number);

Example Code

$textplode = new Textplode('API_KEY');
$number = '440000000000';
$contact = $textplode->contacts->get_by_number($number);

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":[{"id":"1","first_name":"Contact","last_name":"One","number":"440000000000","score":"100.00"}]}

add()

Add a contact. Returns the number of affected rows.

Function Declaration

public function add($first_name, $last_name, $phone_number, $group_id = 0);

Example Code

$textplode = new Textplode('API_KEY');
$credit_threshold = $textplode->account->get_credit_threshold();

Example Response

{"errors":{"errorCode":200,"errorMessage":"OK"},"version":"v3","data":{"rows":1}}