client.contacts quản lý contacts — khách hàng tiềm năng, khách hàng, hoặc người dùng giao tiếp qua các kênh của bạn. Mỗi contact có thể có các hội thoại, comments, files, và lịch sử hoạt động liên kết.
Schema
Field Type Mô tả object_namestring? Định danh loại đối tượng idstring ID duy nhất của contact organization_idstring Tổ chức sở hữu contact này display_namestring? Tên hiển thị của contact emailstring? Địa chỉ email phone_numberstring? Số điện thoại avatar_urlstring? URL ảnh đại diện created_atstring ISO 8601 thời gian tạo updated_atstring ISO 8601 thời gian cập nhật
Field Type Required Mô tả namestring Cập nhật tên hiển thị emailstring Cập nhật địa chỉ email phonestring Cập nhật số điện thoại
Field Type Mô tả _idstring ID duy nhất của comment textstring? Nội dung comment created_atstring? ISO 8601 thời gian tạo
Field Type Mô tả _idstring ID duy nhất của file namestring? Tên file urlstring? URL tải xuống sizenumber? Kích thước file (bytes)
Methods
Method TypeScript Python Mô tả List listlistDanh sách contacts có phân trang Get getgetLấy contact theo ID Update updateupdateCập nhật trường contact Search searchsearchTìm kiếm toàn văn contacts Export CSV exportCsvexport_csvTải xuống tất cả contacts dưới dạng CSV Get conversations getConversationsget_conversationsDanh sách hội thoại của contact Get comments getCommentsget_commentsDanh sách comments nội bộ trên contact Get files getFilesget_filesDanh sách files đính kèm với contact Get activities getActivitiesget_activitiesNhật ký hoạt động hội thoại Upload avatar uploadAvatarupload_contactsTải lên file cho contacts (avatar / import file) List notifications listNotificationslist_notificationsDanh sách thông báo cho người dùng hiện tại Mark notifications read markNotificationsReadmark_notifications_readĐánh dấu thông báo đã đọc Dismiss notification dismissNotificationdismiss_notificationBỏ qua một thông báo Dismiss all notifications dismissAllNotificationsdismiss_all_notificationsXóa tất cả thông báo
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
Trả về nhật ký hoạt động cho một hội thoại liên kết với contact này.
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} )