Track Email Conversation Threads with owasync.py
- Dominant language
- Python
- Stars
- 845
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
When creating incidents via email messages, it would seem advantageous to only create an incident once per a conversation thread. Users will add the "On call" email address to a thread that requires emergency attention, which triggers the incident, but every successive message in that thread will continue to create new Iris incidents each time there is a reply.
I notice that there is a check in ResponseEmail.on_post for the 'In-Reply-To' header, but at least in my organization's Exchange implementation I don't see that header existing. However, Outlook/Exchange _does_ have a well-documented 'Thread-Index' header that tracks the uniqueness of a conversation thread:
https://msdn.microsoft.com/en-us/library/ee202481(v=exchg.80)?ranMID=24542&ranEAID=TnL5HPStwNw&ranSiteID=TnL5HPStwNw-go3ivEugoQ2BnSvLr55H8A&tduid=(753a0626561d1d154f69a0a528d10da2)(256380)(2459594)(TnL5HPStwNw-go3ivEugoQ2BnSvLr55H8A)()
Using the Thread-Index, I have some code that will store the unique Thread-Index ID in the incident context. When an incoming email message arrives that would normally create an incident, ResponseEmail.on_post will first check incidents created in the past X number of hours (configurable), and if the context already contains the same Thread-Index ID, skip creation of a new incident and log a warning.
Let me know what you think about the feature and I can send a PR if you like it. Thanks!
Contributor guide
Research direction
Start at ResponseEmail.on_post and inspect the existing In-Reply-To handling and incident creation flow. Trace how incoming email headers and incident context are accessed, then determine how recent incidents are checked for a matching Thread-Index. Done means repeated messages in one configured conversation thread do not create additional incidents, while distinct threads still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100