Reply via Outlook directly to email received from Mailhook

I have an Automatic email reply scenario set up using Mailhooks for Instant responses.

Currently the scenario is set up as below:

  1. Mailhook receives mail and starts scenario
  2. Outlook searches the Email Subject line taken from the mailhook modules and sorts by descending order to ensure it gets the most recent mail.
  3. Outlook then Gets the Message information by searching the Message ID retrieved in step 2 (Outlook search module).

The rest of the scenario then checks the body content and using a router and filters decides whether to reply or not. The Reply modules require the specific Message ID to reply to, hence my search and get modules.

My Issue:
A scenario ran this morning where the search module returned the wrong email. It searched using the correct subject line retrieved from the Mailhook but the output email was completely different. This resulted in the rest of the scenario running with incorrect information.

My Goal:
To reply directly to the email received.

Where’s the issue:
I think my approach to retrieving the most recent email is flawed but I am not aware of a better way.

@TF-Medforce since you are dealing with recent emails, i will suggest to use filters with date. Going on with subject line is a risky option.

If you will add filter with dates then it will be full proof plan that email which scenario is dealing with is most recent.

Princy Jain
Make consultant,
For consulting support: Follow up Automated

2 Likes

Thanks for the reply @Princy

Where would you suggest to place these filters? What Modules would pair this these Filters?

I would also add all emails will come from the exact same email address. The filters between Mailhook and Search Outlook filters for “From [Email Address]”.

Would changing the Search Module to Search “From [Email Address]” and Ordering by Received Date Time Descending solve this? There is a small warning in the Search Module saying this parameter (Order by) is not supported with Search so maybe this isn’t viable.

image

I really appreciate the help :slight_smile:

You don’t have to make any changes in modules. See in screenshot that where you have to attach

Princy Jain
Make consultant,
For consulting support: Follow up Automated

2 Likes

Thanks @Princy but I’m not sure this solves my issue of returning an incorrect email in the Search Module.

Correct me if I’m wrong but this solution would just stop a reply from being sent if it grabs a wrong email, but doesn’t ensure it grabs the correct email to begin with.

The reason why I have Search and Get modules is to retrieve the Message ID required for the Reply modules, as the Mailhook (Webhook) module doesn’t output the Message ID. If I had a more fool proof way of returning the correct Message ID every time I don’t think I would need this filter - although it would be a nice failsafe to include.

You are right. If you will search with subject line there can be chance of that. SO search with sender email address. It will return all emails by him. Then you have to create two filters.

  1. Filter by subject line: Create filter match subject line from search module with subject line from mailhook

  2. Filter by date: Now to solve your existing problem you have to filter with date that email must be received within 60min. This will help you to return the latest email from that sender.

2 Likes

Hi @Princy , thanks again for your replies.

These are all great security steps and fail safes but they are not addressing the main issue of the Search Module returning the wrong email in the first place.

For more context, I have limited the output parameter to 1 as these emails are extremely time sensitive (1-2mins) so the search needs to be extremely accurate to return the 1 email received from the mailhook in the first place.

I have now tried searching “From:[email] AND Sent:today” which has worked in testing but this morning an email was received which should have been replied to but the Search Module returned no Output bundle. When of course it should have because the Scenario only runs when there is a new Email to Output in the first place.

May be microsoft 365 needs time to show results in scenario. Try sleep module after webhook and then test with live data.

2 Likes

Yep this is my current solution - a 12 second Sleep Module right after the Webhook. This issue never came up in testing due to my email being lightweight but as the Live emails have approx. 100 other emails CC’d I think this slows down Outlook load speed.

I’ll mark the sleep module suggestion as Solution for now as I believe the core issue was although Outlook has received the email and pushed the Mailhook, it hasn’t entirely loaded on the backend and requires a little time. Thank you for all the help @Princy :smile:

3 Likes