diff --git a/apps/meteor/app/livechat/server/lib/InactiveRoomsMonitor.ts b/apps/meteor/app/livechat/server/lib/InactiveRoomsMonitor.ts index e885f147ad56..2ab7a75f8f24 100644 --- a/apps/meteor/app/livechat/server/lib/InactiveRoomsMonitor.ts +++ b/apps/meteor/app/livechat/server/lib/InactiveRoomsMonitor.ts @@ -3,6 +3,7 @@ import { SyncedCron } from 'meteor/littledata:synced-cron'; import { Logger } from '../../../logger/server'; import { Livechat } from './Livechat'; import { Users, LivechatRooms } from '../../../models/server'; +import { SNS } from './SNS'; import { settings } from '../../../settings/server'; const logger = new Logger('InactiveRoomsMonitor'); @@ -64,6 +65,16 @@ export class InactiveRoomsMonitor { rooms?.forEach((room: any) => { logger.info('Closing inactive room: ', room._id); Livechat.closeRoom({ comment: this._closeComment, room, user: this._user, visitor: null }); + SNS.sendEvent({ + roomId: room._id, + category: 'Chat Session', + action: 'closed', + eventType: 'session', + timestamp: new Date().toISOString(), + properties: { + close_method: 'visitor_abandonment', + }, + }); }); } }