Overview
TelemanAI’s contact management system provides a centralized database for all your contacts. Organize contacts into groups, import from CSV files, and maintain detailed contact information for targeted campaigns.
Individual Contacts Store detailed information for each contact
Contact Groups Organize contacts into targeted groups
Bulk Import Import thousands of contacts from CSV files
Export Data Export contacts for backup or external use
Add individual contacts with detailed information:
// From ContactController.php:37-86 - Create Contact
public function store ( Request $request )
{
$contact = new Contact ;
$contact -> user_id = Auth :: id ();
$contact -> name = $request -> name ;
// Phone number with automatic + prefix
$contact -> phone = Str :: startsWith ( $request -> phone , '+' )
? $request -> phone
: '+' . $request -> phone ;
$contact -> email = $request -> email ;
$contact -> country = $request -> country ;
$contact -> gender = $request -> gender ;
$contact -> dob = $request -> dob ;
$contact -> profession = $request -> profession ;
$contact -> save ();
// Assign to groups
if ( $request -> groups_ids != null ) {
foreach ( $request -> groups_ids as $group_id ) {
$group_contact = new GroupContact ;
$group_contact -> contact_id = $contact -> id ;
$group_contact -> group_id = $group_id ;
$group_contact -> save ();
}
}
}
Each contact can store the following information:
Name - Full name of the contact
Phone - Phone number in international format (auto-adds + prefix)
Email - Email address for multi-channel campaigns
Country - Country of residence
Gender - Gender for personalization
Date of Birth - Birthday for special campaigns
Profession - Job title or industry
Reference - Custom reference field for your use
-- From migrations/2022_06_14_120852_create_contacts_table.php
CREATE TABLE contacts (
id BIGINT UNSIGNED PRIMARY KEY ,
user_id BIGINT UNSIGNED,
name TEXT ,
phone TEXT ,
email TEXT ,
country TEXT ,
gender TEXT ,
dob TEXT ,
profession TEXT ,
reference TEXT ,
created_at TIMESTAMP ,
updated_at TIMESTAMP
);
Creating Groups
Organize contacts into groups for targeted campaigns:
// From ContactController.php:199-234 - Create Group
public function group_store ( Request $request )
{
$group = new Group ;
$group -> user_id = Auth :: id ();
$group -> name = $request -> name ;
$group -> description = $request -> description ;
$group -> status = $request -> status == 1 ? true : false ;
$group -> save ();
}
Create Group
Provide a name and description for your contact group
Assign Contacts
Select which contacts to include in the group
Use in Campaigns
Reference the group when creating voice or SMS campaigns
Group Assignment
Assign contacts to groups individually or in bulk:
// From ContactController.php:329-365 - Assign Contacts to Group
public function group_assign_store ( $group_id , $group_slug , Request $request )
{
$group = Group :: find ( $group_id );
// Delete existing assignments
GroupContact :: where ( 'group_id' , $group_id ) -> delete ();
// Store each contact in the group
foreach ( $request -> contact_ids as $contact ) {
$group_contact = new GroupContact ;
$group_contact -> user_id = Auth :: id ();
$group_contact -> group_id = $group_id ;
$group_contact -> contact_id = $contact ;
$group_contact -> save ();
}
}
Quickly assign all your contacts to a group:
// From ContactController.php:448-484 - Assign All Contacts
public function assign_all_contacts ( $group_id )
{
// Delete existing contacts in the group
GroupContact :: where ( 'group_id' , $group_id ) -> delete ();
$contacts = Contact :: where ( 'user_id' , Auth :: id ()) -> get ();
$groupContactData = [];
foreach ( $contacts as $contact ) {
$groupContactData [] = [
'user_id' => Auth :: id (),
'group_id' => $group_id ,
'contact_id' => $contact -> id ,
];
}
// Insert in batches for performance
$chunkSize = 100 ;
$groupContactChunks = array_chunk ( $groupContactData , $chunkSize );
foreach ( $groupContactChunks as $chunk ) {
GroupContact :: insert ( $chunk );
}
}
Batch insertion improves performance when assigning thousands of contacts to a group.
Group Data Structure
-- From migrations/2022_06_17_123302_create_groups_table.php
CREATE TABLE groups (
id BIGINT UNSIGNED PRIMARY KEY ,
user_id BIGINT UNSIGNED,
name TEXT ,
description TEXT ,
status BOOLEAN ,
created_at TIMESTAMP ,
updated_at TIMESTAMP
);
Bulk Import
CSV Import
Import large contact lists from CSV files:
// From ContactController.php:379-396 - CSV Import
public function import ( Request $request )
{
// Create user-specific directory
$directoryPath = public_path ( 'uploads/csv/' . auth () -> id ());
if ( ! File :: isDirectory ( $directoryPath )) {
File :: makeDirectory ( $directoryPath , 0755 , true , true );
}
// Split large CSV files for processing
splitCsv ( $request -> file ( 'csv' ));
smilify ( 'success' , 'Contact imported successfully' );
}
Prepare CSV File
Format your CSV file with columns for name, phone, email, etc.
Upload File
Upload your CSV file through the contacts interface
Processing
The system automatically processes your file in chunks
Check Progress
Monitor import progress with the status indicator
Your CSV file should include these columns:
name, phone, email, country, gender, dob, profession
John Doe, +1234567890, [email protected] ,USA, Male, 1990-01-01, Engineer
Jane Smith, +0987654321, [email protected] ,UK, Female, 1985-05-15, Manager
Phone numbers must include the country code. The system will automatically add a + prefix if missing.
Import Progress Tracking
Check the status of your CSV import:
// From ContactController.php:527-530 - Check Import Status
public function check_import_status ()
{
return csv_import_progress ();
}
Real-Time Search
Search contacts by name or phone number:
// From ContactController.php:420-436 - Search Contacts
public function searchContacts ( Request $request )
{
if ( $request -> has ( 'search' ) && $request -> search != '' ) {
$search = $request -> search ;
$contacts = Contact :: HasAgent ()
-> where ( function ( $query ) use ( $search ) {
$query -> where ( 'name' , 'LIKE' , "% $search %" )
-> orWhere ( 'phone' , 'LIKE' , "% $search %" );
})
-> orderBy ( 'name' , 'asc' )
-> simplePaginate ( 50 );
} else {
$contacts = allContacts ();
}
return view ( 'backend.contacts.index' , compact ( 'contacts' ));
}
Find contacts dynamically for campaign selection:
// From ContactController.php:517-525 - AJAX Contact Search
public function getContactsAjax ( Request $request )
{
$query = $request -> get ( 'query' );
$results = Contact :: where ( 'name' , 'like' , '%' . $query . '%' )
-> orWhere ( 'phone' , 'like' , '%' . $query . '%' )
-> get ();
return response () -> json ( $results );
}
Export your contacts to CSV format:
// From ContactController.php:371-374 - Export Contacts
public function export ()
{
return Excel :: download ( new ContactsExport , 'contacts.csv' );
}
Exported files include:
All contact information
Group memberships
Creation dates
Custom reference fields
Find contact information during active calls:
// From ContactController.php:411-418 - Find Contact by Phone
public function find_contact_by_number ( Request $request )
{
$contact_info = find_contact_by_phone ( $request -> caller_number );
return response () -> json ([
'contact_info' => $contact_info ,
]);
}
This feature is used by the Web Dialer to display contact information during incoming calls.
Modify contact information and group assignments:
// From ContactController.php:108-164 - Update Contact
public function update ( Request $request , $contact_id )
{
$contact = Contact :: where ( 'id' , $contact_id ) -> first ();
$contact -> name = $request -> name ;
$contact -> phone = Str :: startsWith ( $request -> phone , '+' )
? $request -> phone
: '+' . $request -> phone ;
$contact -> email = $request -> email ;
$contact -> country = $request -> country ;
$contact -> gender = $request -> gender ;
$contact -> dob = $request -> dob ;
$contact -> profession = $request -> profession ;
$contact -> save ();
// Update group assignments
if ( $request -> groups_ids != null ) {
foreach ( $request -> groups_ids as $group_id ) {
GroupContact :: updateOrCreate ([
'group_id' => $group_id ,
'contact_id' => $contact_id
]);
}
}
}
Remove contacts and their associated data:
// From ContactController.php:169-186 - Delete Contact
public function destroy ( $contact_id )
{
$contact = Contact :: where ( 'id' , $contact_id ) -> first ();
// Delete related data
$contact -> group_contacts () -> delete ();
$contact -> campaign_voice () -> delete ();
$contact -> campaign_voice_status_log () -> delete ();
$contact -> delete ();
}
Deleting a contact removes all campaign history and lead tracking data. This action cannot be undone.
Best Practices
Clean Data Maintain clean contact data with proper phone number formats and complete information.
Organized Groups Create logical groups based on demographics, interests, or campaign types.
Regular Backups Export your contacts regularly for backup and data security.
Update Records Keep contact information current by updating records after each interaction.
Integration with Campaigns
Contacts and groups are the foundation of your campaigns:
Import Contacts
Add contacts manually or via CSV import
Create Groups
Organize contacts into targeted groups
Build Campaigns
Select groups when creating voice or SMS campaigns
Track Results
View contact-level results and update records based on outcomes
Voice Campaigns Create campaigns targeting your contact groups
SMS Marketing Send bulk SMS to contact groups
Web Dialer Call contacts directly from the web interface