Chuyển đến nội dung

Conversation

client.conversations quản lý các luồng hội thoại giữa contacts và nhóm của bạn (hoặc AI agent). Mỗi hội thoại thuộc về một Channel và được liên kết với một Contact.


Schema

Conversation

FieldTypeMô tả
object_name"conversation"Bộ phân biệt loại đối tượng
idstringID duy nhất của hội thoại
organization_idstringTổ chức sở hữu hội thoại này
business_unit_idstringID đơn vị kinh doanh
channel_idstringKênh mà hội thoại này thuộc về
channel_typestringLoại nền tảng kênh (xem Channel)
contact_idstringID contact liên kết
statusstringTrạng thái hội thoại (vd: open, resolved)
namestringTên hiển thị của hội thoại
timestampstringISO 8601 thời gian của tin nhắn gần nhất
usersSimpleUser[]Thành viên nhóm hiện đang trong hội thoại này

Methods

MethodTypeScriptPythonMô tả
ListlistlistDanh sách hội thoại có phân trang
GetgetgetLấy hội thoại theo ID nội bộ
Get by conversation IDgetByConversationIdLấy theo ID hội thoại công khai
SearchsearchsearchTìm kiếm toàn văn trong đơn vị kinh doanh
Get views countgetViewsCountget_views_countĐếm hội thoại theo view/trạng thái
CreatecreatecreateTạo hội thoại mới
JoinjoinjoinTham gia hội thoại với tư cách thành viên nhóm
LeaveleaveleaveRời khỏi hội thoại
Update statusupdateStatusupdate_statusThay đổi trạng thái hội thoại
Update nameupdateNameĐổi tên hội thoại
Init video callinitVideoCallBắt đầu cuộc gọi video trong hội thoại
Assign team memberassignTeamMemberGán thành viên nhóm vào hội thoại
Remove team memberremoveTeamMemberXóa thành viên nhóm
Get invitable usersgetInvitableUsersDanh sách người dùng có thể mời

list / list

const page = await client.conversations.list({
type: "open",
q: "billing",
limit: 20,
skip: 0,
});
for (const conv of page.data) {
console.log(conv.id, conv.name, conv.status);
}

const results = await client.conversations.search({
businessUnitId: "bu_id",
q: "refund request",
limit: 10,
});

create / create

const conversation = await client.conversations.create({
channel_id: "channel_id",
contact_id: "contact_id",
});
console.log(conversation.id);

join / join

await client.conversations.join({ conversation_id: "conversation_id" });

updateStatus / update_status

await client.conversations.updateStatus({
conversation_id: "conversation_id",
status: "resolved",
});

assignTeamMember

await client.conversations.assignTeamMember({
conversation_id: "conversation_id",
user_id: "agent_user_id",
});

leave / leave

await client.conversations.leave({ conversation_id: "conversation_id" });

getByConversationId

const conversation = await client.conversations.getByConversationId("public_conversation_id");
console.log(conversation.id, conversation.status);

getViewsCount / get_views_count

const counts = await client.conversations.getViewsCount({ type: "open" });
console.log(counts);

updateName

await client.conversations.updateName({
conversation_id: "conversation_id",
name: "VIP Support Thread",
});

removeTeamMember

await client.conversations.removeTeamMember({
conversation_id: "conversation_id",
user_id: "agent_user_id",
});

getInvitableUsers

const users = await client.conversations.getInvitableUsers("conversation_id");
for (const u of users) {
console.log(u._id, u.name);
}

initVideoCall

const result = await client.conversations.initVideoCall({
conversation_id: "conversation_id",
});
console.log(result.conversation);