wexa-chat 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -852,7 +852,7 @@ function createMessagesService(models, hooks = {}) {
852
852
  */
853
853
  async receiveLinkedinMessage(args) {
854
854
  const { linkedinChatId, message, messageId, senderName, senderProfileUrl } = args;
855
- const conversation = await Conversation.findOne({ linkedinChatId }).lean();
855
+ const conversation = await Conversation.findOne({ linkedinChatId }).sort({ lastMessageAt: -1 }).lean();
856
856
  if (!conversation) {
857
857
  throw new Error("Conversation not found for given linkedinChatId");
858
858
  }