Returns the conversation history entry for the given conversation.
The ID of the conversation to return the history entry for
The conversation history entry for the conversation
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
UnbluApiError with type UnbluErrorType.INVALID_FUNCTION_ARGUMENTS if the conversation doesn't exist or cannot be accessed
Search for conversation history entries based on the provided query.
The query allows filtering by various criteria, such as the creation timestamp, the conversation state, participant person IDs, and many more. Results can be sorted using the orderBy parameter and paginated using offset and limit.
The search query containing filters, ordering, and pagination options
The search result containing matching conversation history entries
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
// Search for ended conversations created in the last 7 days
const result = await api.conversationHistory.search({
searchFilters: [
{
field: ConversationHistorySearchFilterField.STATE,
operator: {
type: ConversationStateOperatorType.EQUALS,
value: ConversationHistoryState.ENDED
}
},
{
field: ConversationHistorySearchFilterField.CREATION_TIMESTAMP,
operator: {
type: TimestampOperatorType.GREATER_THAN,
value: Date.now() - 7 * 24 * 60 * 60 * 1000
}
}
],
orderBy: [
{
field: ConversationHistoryOrderByField.CREATION_TIMESTAMP,
order: Order.DESCENDING
}
],
limit: 50
});
console.log(`Found ${result.items?.length} conversations`);
if (result.hasMoreItems) {
console.log(`More items available at offset ${result.nextOffset}`);
}
This class provides functionality around the conversation history