How to Capture Email Message ID After Workflow Email Notification?

How to Capture Email Message ID After Workflow Email Notification?

Hello everyone,

I have a workflow that triggers an email notification as an instant action. The email is sent successfully, but I need to capture the response (in JSON format) to store the message_id in a custom field for future reference.

Is there a way to achieve this using a custom function (or any other way)? For instance, could I schedule an action, say 2 minutes after the email is sent, to retrieve the message_id and save it? Any guidance or suggestions would be much appreciated!