Skip to main content

I am using flow to send SMS to a customer. This works fine, but for new Messaging End Users, it can take up to 10 minutes before the SMS is sent and the Messaging Session is created.

I need to link the messaging session to the case where the users started the flow from, but the session isn't available right away.

 

I tried to use a record triggered flow on Messaging Session, but the flow isn't triggered. Any ideas to why the new Messaging Session doesn't trigger the flow?

11 answers
  1. Aug 19, 10:12 AM

    Hi Team,

    I faced the same issue and found a solution that worked for me.

    My requirement was to link a newly created Messaging Session to the Case from which the session was initiated using a Screen Flow.

    Solution:

    Enable Change Data Capture (CDC) for the Messaging Session object in Setup. This publishes a change event whenever an action occurs on a Messaging Session record, such as create, update, or delete. The event message provides the Messaging Session record ID and its field values, including the Messaging User ID.

    First, store the Case ID on the Messaging User record within the Screen Flow (or from wherever you are initiating the Messaging Session).

    Since a Messaging Session change event is published whenever an event occurs on the record, subscribe to it using either a Platform Event-Triggered Flow or an Apex Trigger on the Messaging Session Change Event. Then perform the required logic:

    1. Retrieve the Messaging User ID from the Messaging Session event.
    2. Use the Messaging User record to get the Case ID that was stored earlier.
    3. Update the Messaging Session record using the Messaging Session ID received in the event and the Case ID which we get by query the messaging user.

    This will successfully link the Messaging Session to the Case.

    If you need code samples or additional guidance for implementing this solution, please reply to this comment. 

     

    Thanks.

0/9000