handle case where there is no emails index
implement the chat history endpoint