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.mjs CHANGED
@@ -844,7 +844,7 @@ function createMessagesService(models, hooks = {}) {
844
844
  */
845
845
  async receiveLinkedinMessage(args) {
846
846
  const { linkedinChatId, message, messageId, senderName, senderProfileUrl } = args;
847
- const conversation = await Conversation.findOne({ linkedinChatId }).lean();
847
+ const conversation = await Conversation.findOne({ linkedinChatId }).sort({ lastMessageAt: -1 }).lean();
848
848
  if (!conversation) {
849
849
  throw new Error("Conversation not found for given linkedinChatId");
850
850
  }