💬 Salesforce LWC – Customer Inactivity Timer for Messaging Channels

🧩 Overview

A custom Lightning Web Component (LWC) designed to automatically monitor and manage customer inactivity in Salesforce Messaging sessions.
The component tracks agent–customer interactions in real time and sends warning messages & ends conversations after configurable inactivity thresholds — all driven by Custom Metadata Types for easy, declarative setup.


⚙️ Key Features

  • ⏱️ Automatic inactivity detection – continuously monitors Messaging Sessions through the Conversation Toolkit API
  • 💡 Dynamic configuration – timeout and warning intervals are retrieved from Custom Metadata Types, allowing full admin control
  • 🗨️ Automated warnings & conversation closing – sends predefined messages before timeout and gracefully ends inactive sessions
  • 🔄 Session persistence – uses localStorage to restore timer states even after page reloads
  • 🧠 Error handling & state safety – includes robust exception management and logic to prevent false conversation closures
  • 🧰 Salesforce best practices – optimized with @AuraEnabled(cacheable=true), wire adapters, and separation of concerns between LWC and Apex

🧱 Tech Stack

  • Lightning Web Components (LWC)
  • ☁️ Apex (Server-side logic & metadata access)
  • 🧩 Salesforce Conversation Toolkit API
  • 🗃️ Custom Metadata Types (Configuration Management)
  • 💾 LocalStorage (Client State Persistence)
  • 🔍 UI Record API & LDS

🧪 Testing & Quality

  • ✅ Fully covered Apex test class using mock data (no SeeAllData=true)
  • 🧱 Strict adherence to Salesforce security and performance best practices
  • 🧩 Built for scalability and easy adaptation across different Messaging Channels