Skip to content

Conversation

client.conversations manages conversation threads between contacts and your team (or AI agent). Each conversation belongs to a Channel and is linked to a Contact.


Schema

Conversation

FieldTypeDescription
object_name"conversation"Object type discriminator
idstringUnique conversation ID
organization_idstringOrganization this conversation belongs to
business_unit_idstringBusiness unit ID
channel_idstringThe channel this conversation belongs to
channel_typestringChannel platform type (see Channel)
contact_idstringLinked contact ID
statusstringConversation status (e.g. open, resolved)
namestringConversation display name
timestampstringISO 8601 timestamp of the most recent message
usersSimpleUser[]Team members currently in this conversation

Methods

MethodTypeScriptPythonDescription
ListlistlistPaginated list of conversations
GetgetgetGet a conversation by internal ID
Get by conversation IDgetByConversationIdGet by the public conversation ID
SearchsearchsearchFull-text search within a business unit
Get views countgetViewsCountget_views_countCount conversations per view/status
CreatecreatecreateCreate a new conversation
JoinjoinjoinJoin a conversation as a team member
LeaveleaveleaveLeave a conversation
Update statusupdateStatusupdate_statusChange the conversation status
Update nameupdateNameRename a conversation
Init video callinitVideoCallStart a video call in a conversation
Assign team memberassignTeamMemberAssign a team member to the conversation
Remove team memberremoveTeamMemberRemove a team member
Get invitable usersgetInvitableUsersList users that can be invited

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);