Skip to content

Commit

Permalink
Merge pull request #694 from chaynHQ/develop
Browse files Browse the repository at this point in the history
Merge Develop onto Main
  • Loading branch information
annarhughes authored Oct 29, 2024
2 parents f15a9b8 + cde6bbc commit 7cd3354
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/crisp/crisp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,28 @@ export class CrispService {
let totalChatOrigin = 0;

for (const userEmail of userEmails) {
const conversations = await CrispClient.website.listPeopleConversations(
crispWebsiteId,
userEmail,
);

for (const conversation of conversations) {
const messages = await CrispClient.website.getMessagesInConversation(
try {
const conversations = await CrispClient.website.listPeopleConversations(
crispWebsiteId,
conversation,
userEmail,
);

for (const message of messages) {
if (message.from === 'user') {
if (message.origin === 'chat') totalChatOrigin++;
if (message.origin === 'email') totalEmailOrigin++;
for (const conversation of conversations) {
const messages = await CrispClient.website.getMessagesInConversation(
crispWebsiteId,
conversation,
);

for (const message of messages) {
if (message.from === 'user') {
if (message.origin === 'chat') totalChatOrigin++;
if (message.origin === 'email') totalEmailOrigin++;
}
}
}
} catch (error) {
// skip
console.log(error);
}
}
const totalMessages = totalEmailOrigin + totalChatOrigin;
Expand Down

0 comments on commit 7cd3354

Please sign in to comment.