Is there a way to fire any automation when a MessageSession record's status is changed to "Ended", or in other words when the user clicks end chat?

I have got a MessageSession trigger that I can see is firing on update via the developer console's debug logs, but no debug log is created when end chat is clicked. Also tried a process builder but same issue, doesn't fire.

Several use cases, parenting files to the correct record (Lead and/or Case) and saving the conversation elsewhere etc.

If relevant I can see a rest call to the below in the Chrome network console when clicking end chat:


1 Answer 1


Figured it out. Some observations for others in the future:

  1. Any image/file upload is done via the Automated Process User
  2. End Chat does not set the MessagingSession Status to Ended, the MessagingSession trigger does not fire here
  3. Closing the MessagingSession tab does change the status Ended, and the MessagingSession trigger fires
  4. For point 3, the trigger runs as the automated process user!
  • 1
    I so much appreciate it when a dev is stuck for a while, then figures it out, then posts a self-answered question. Will save others endless hours.
    – cropredy
    Apr 14, 2021 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .