client.contacts manages contacts — the leads, customers, or users who communicate through your channels. Each contact can have linked conversations, comments, files, and activity history.
Schema
Field Type Description object_namestring? Object type identifier idstring Unique contact ID organization_idstring Organization this contact belongs to display_namestring? Contact display name emailstring? Email address phone_numberstring? Phone number avatar_urlstring? Profile picture URL created_atstring ISO 8601 creation timestamp updated_atstring ISO 8601 last-updated timestamp
Field Type Required Description namestring Update display name emailstring Update email address phonestring Update phone number
Field Type Description _idstring Unique comment ID textstring? Comment text body created_atstring? ISO 8601 creation timestamp
Field Type Description _idstring Unique file ID namestring? File name urlstring? Download URL sizenumber? File size in bytes
Methods
Method TypeScript Python Description List listlistPaginated list of contacts Get getgetGet a contact by ID Update updateupdateUpdate contact fields Search searchsearchFull-text search across contacts Export CSV exportCsvexport_csvDownload all contacts as CSV Get conversations getConversationsget_conversationsList conversations for a contact Get comments getCommentsget_commentsList internal comments on a contact Get files getFilesget_filesList files attached to a contact Get activities getActivitiesget_activitiesConversation activity log Upload avatar uploadAvatarupload_contactsUpload a file to contacts (avatar / file import) List notifications listNotificationslist_notificationsList notifications for current user Mark notifications read markNotificationsReadmark_notifications_readMark notifications as read Dismiss notification dismissNotificationdismiss_notificationDismiss a single notification Dismiss all notifications dismissAllNotificationsdismiss_all_notificationsClear all notifications
list / list
const page = await client . contacts . list ( { limit: 50 , skip: 0 } );
for ( const contact of page . data ) {
console . log (contact . id , contact . display_name , contact . email );
page = client.contacts. list ( limit = 50 , skip = 0 )
for contact in page. get ( " data " , [] ):
print ( contact [ " id " ] , contact. get ( " display_name " ) , contact. get ( " email " ))
search / search
const results = await client . contacts . search ( {
results = client.contacts. search ( " alice@example.com " )
update / update
const contact = await client . contacts . update ( " contact_id " , {
email: " alice@example.com " ,
contact = client.contacts. update ( " contact_id " , {
" email " : " alice@example.com " ,
getConversations / get_conversations
const conversations = await client . contacts . getConversations ( " contact_id " , {
channelTypes: " whatsapp,web " ,
conversations = client.contacts. get_conversations (
channel_types = " whatsapp,web " ,
const comments = await client . contacts . getComments ( " contact_id " , {
comments = client.contacts. get_comments ( " contact_id " , limit = 20 , skip = 0 )
getActivities / get_activities
Returns the activity log for a conversation linked to this contact.
const activities = await client . contacts . getActivities ( " conversation_id " );
activities = client.contacts. get_activities ( " conversation_id " )
listNotifications / list_notifications
const page = await client . contacts . listNotifications ( { limit: 20 , skip: 0 } );
for ( const n of page . data ) {
page = client.contacts. list_notifications ( limit = 20 , skip = 0 )
markNotificationsRead / mark_notifications_read
await client . contacts . markNotificationsRead ([ " notif_id_1 " , " notif_id_2 " ]);
client.contacts. mark_notifications_read ()
const formData = new FormData ();
formData . append ( " file " , avatarBlob, " avatar.png " );
const result = await client . contacts . uploadAvatar (formData);
with open ( " avatar.png " , " rb " ) as f:
result = client.contacts. upload_contacts ( files = { " file " : f} )