Outlook REST API. How to start new thread on forward message? - outlook-restapi

First i want to ask how the Outlook client decides if a message that the user wrote should be in the same thread(conversation) or in a new one on forward of a message.
From my observations it checks the subject, but does it check also something else.
I'm using the Outlook rest api v2 and beta versions.
To force the api to create the message in new thread i tried setting the subject in the following patern:
Fwd: { subject of the message i forward} or
Fwr: { subject of the message i forward}
The only successful approach was to add some character to the end of the subject text, but i'm afraid that this might be considered as a bug from some users.
So is there some way to create the message in a new thread when calling /messages/{message_id}/createforward endpoint?
Looking forward for an answer to this.

I used a different approach when it came to Forward/Reply messages, because I had some issues with Attachments. It seems that my approach could be useful in your case as well.
When I want to forward a message, I retrieve all the attachments of the message and I add 'FW:' at the beginning of the subject, and then I use https://outlook.office365.com/api/v2.0/me/sendmail as If I am sending a new email! That will start a new thread! I hope it works for you.

Related

Gmail API Watch Request Not Filtering Label IDs

Issue
Trying to get the Gmail API to send only new messages to Cloud Pub/Sub by using the Gmail APIs Watch function but when setting the labelIds in order to filter to just INBOX, i am still notified of all changes, files sent, drafts etc.
I've looked online and can see that there are people that are experiencing this issue and there is even a bug out for it https://issuetracker.google.com/issues/36759803.
But i find it kind of odd that the entire feature of filtering just doesn't work and its been an issue for 5 years according to the bug report. Makes me think its just me that is doing something wrong. Would be cool to hear from anyone that has got this to work.
Where im at
I'm using the Gmail API, trying to get my Gmail account to publish messages to Cloud Pub/Sub. I've managed to do this however im trying to filter what i get notifications for to just new messages. This is where i have a problem.
According to this Gmail API documentation, it appears all i have to call is the code below and that should be that. I will add however, that im calling the Kotlin equivalent, but i don't think this should matter.
request = {
'labelIds': ['INBOX'],
'topicName': 'projects/myproject/topics/mytopic'
}
gmail.users().watch(userId='me', body=request).execute()
What im calling:
val request = WatchRequest().apply {
labelIds = listOf("INBOX")
topicName = "projects/myproject/topics/mytopic"
}
gmail.users().watch("me", request).execute()
Other things ive tried
I have tried adding labelFilterAction = Include and other variations but they all seem to be ignored.
After trying the ideas listed by ziganotschka, I'm more confident that the issue is not related to specific client libraries.
I managed to speak to someone at Google who in turn contacted the G-mail API team. They said they were aware that this is an issue, that it has been an issue since 2015 and was most likely caused by a change they made back then.
A ticket is still open, but doesn't look like it will be fixed.
Perform the following trouble-shooting actions
Provide a request body including labelIds, labelFilterAction AND topicName as specified here
Try the label "UNREAD" instead of "INBOX"
To discart Kotlin implementation related issues, test your request in a programming language that allows you to pass the request as a JSON body in exactly the same way as specified in the documentation.

Reset unread message count for Facebook page (Facebook Graph API)

I am trying to build a small Python tool to connect our Helpdesk software (Helpscout) with our companies Facebook page to be able to receive and answer messages from clients directly from within Helpscout.
I am using the conversation endpoint to grab all unread conversation:
conversations = api.get_object('[page_id]/conversations?fields=messages.limit(20){message,from},name, unread_count,message_count')
The problem is, once I read the messages the unread counter still stays the same until we open those messages directly from within the Facebook page. Spent lots of time to find a solution, but apparently there is no option to reset the counter or handle it any other way.
As a workaround I currently use the overall message count and compare it every time I check for new message to only load the new ones. That works fine, but there is still the issue that all messages stay unread on the Facebook page and will be all loaded again with every API call until we manually click them.
Thought about using Selenium to just do this job 1 time per day and clean the inbox, but don't really like this. Any idea how to solve this? Maybe I missed some API feature which can help?
I use the Send API to send the messages back to our customer, but could also not find any option to update the conversation in any way to handle it:
data = {"recipient": {"id": "xxxxx"}, "message": {"text": message}}
response = requests.post('https://graph.facebook.com/v3.2/me/messages?access_token=xxxx', headers=headers, data=json.dumps(data))
Maybe it is possible to move the conversation from the regular inbox to "Done" folder which could solve it?
After doing some research I found a solution to it here:
FbChatBot mark message as Read
You cannot update the unread count, but you can let all conversations automatically move to the "DONE" folder to let them not show up in your inbox anymore by using the "Handover Protocol": https://developers.facebook.com/docs/messenger-platform/handover-protocol
The app has to be set as 'Primary Receiver' and 'Page Inbox' as 'Secondary Receiver'.
All conversations will be moved to "DONE" now. Just make sure to set the correct permissions in the messenger webhook settings:
There will be no error without it, but messages will stay in the inbox and it does not work.

Firebase (Google) Cloud Messaging (FCM, old GCM) - check message status

I'm trying to find a solution to ensure a push notification to my Chrome extension has been received before sending another one. IF it hasn't been received and another one should go, I would change its content to tell the user he has multiple new informations to check.
So I'm looking for a way to check the previous message status using its ID, or check the queue of messages if using a collapse key, before sending a new one. But I can't find anything related to this, except here : https://support.google.com/googleplay/android-developer/answer/2663268?hl=en there is FCM message status detailed, but no way to get them after the first response.
I am aware receipts can be implemented using XMPP but I would really prefer to remain on the regular HTTP protocol.
Thanks ahead for any help.
XMPP receipts would be the recommended way for you to get an ack that the message was delivered. You can also use the Play Developer console (Android developer console) to view statistics on the status of messages. However this will not be sufficient if you want to automatically resend, you would have to do this manually.

Cannot keep messages in the same conversation due to missing MESSAGE-ID header at Gmail

At some messages in Gmail, the MESSAGE-ID header is missing and I need to use it as IN-REPLY-TO header when replying so I can keep the replies at the same conversation.
When those emails with missing MESSAGE-ID header are replied from the Gmail's WEB UI, the replies stay with the conversation and the reply in fact acquires a IN-REPLY-TO header something looks like <-4185615914882731559#unknownmsgid> I could not discover how is this generated.
I've been trying to find a solution to this problem quite a while, ended up trying a few desktop email clients, Airmail and Sparrow to see how they behave. If I ever reply a particular email which is missing the MESSAGE-ID header using those email clients, the sent reply also acquires the same IN-REPLY-TO header <-4185615914882731559#unknownmsgid> and the reply indeed stays at the same conversation as expected.
So, I would like to ask how they achieve this, do they somehow generate the IN-REPLY-TO header <-4185615914882731559#unknownmsgid>? Is there a rule or a workaround?
This is a classic problem, every mail reader has it. The classic solution is:
copy the References field from the message you reply to, if any.
make up an In-Reply-To field, perhaps with a made-up message-id, perhaps with the sender's address and the message's date.
Keep the subject, and append "re: ".
You may also copy the Thread-Index field, if there is one.
Gmail's and most other threading algorithms will then connect the dots.
Thread-Index is a Microsoft thing, noone else uses it, as far as I know. The format of the hex blob is not specified, but copying that will help probably help Exchange, if the original message comes from Exchange.
If you just want to send an email and make sure it threads with another email in that user's inbox (and not any other gmail users that may receive the reply) then I believe you can use the Gmail API's messages.send() method and set the message.threadId to match the thread you want it to thread with.
I don't think that e-mails delivered to your gmail account have no message id. My evidence is that I just tried sending one to myself via telnet without a message id, and gmail's mx server added this
Message-Id: <54412844.63bbb40a.0772.ffffcbdcSMTPIN_ADDED_MISSING#mx.google.com>
It may be that copying a message into gmail's imap store can result in a missing message id. Eg see https://productforums.google.com/forum/#!topic/gmail/w5kgRivwbIg (though that is very old, it shows that synchronising mail to a gmail IMAP account can have this result).
The basic rule of e-mail is that if an e-mail doesn't have a message id for whatever reason, one is created for it, which is what has happened here. Hence, when you reply, the made-up message id is used in the in-reply-to header.

Script to check whether all mails replied in Lotus Notes

We use Lotusnotes 6.5 as email client. We wil have around 1600+ mails for 9 hrs. If a mail not checked , we have face serious issues with our client. Can any script can be written to check whether all mails are checked and replied?
Update:
We have already tried moving the mails to another folder.But has this mailbox handled by team of persons, we noticed lot of human error happening like moving a unread mail, sometimes they would have read mail but forget to reply it etc.etc.
So I was looking out for a script solution, will your other options. Also one more thing we do is we cc our mailbox mail id for all outgoing emails to have a track of all replied mails, will this could help in any way to find out which mails was missed?
If you need to track unread marks, I second the aforementioned nsftools solution, which works in Domino 7.x too. However, this is very much Notes ID-dependent. A folder would be better.
Note that 6.5x is well out of support, and that Domino 7.x officially died this week: use something at least vaguely modern!
There's an easier non-programmatic way. Just move the email from the inbox into another folder once the email has been responded to. That is more reliable than any programmatic solution, and keeps your inbox tidy (which will certainly be necessary if you get nearly 200 emails per hour!)
That said, here are some other ideas.
Determining if the document was read
Unread marks are not your friend here, unless you'll be accessing the mail file from the same client. Also they tend to get out of sync and would likely prove unreliable at some point, especially given the number of incoming emails. Instead you'll need to have some information that is saved within the individual mail document, such as the last accessed property or a custom item you manage via scripts/formulas.
You can see if an email has been read by checking the Last Accessed property of the mail document. According to IBM's technote (https://www-304.ibm.com/support/docview.wss?uid=swg21086670), the property will be updated when the document is read.
You could write a script in the QueryOpen event that stamps a value on the document and saves it.
Determining if the email was responded to
First off, I'd suggest you save all sent emails in case you need a record of what was sent to the client. That won't give you a way to see which emails have not been responded to, however.
Instead you could add script to the reply action within the memo form. When someone click's reply it could update the current memo, stamping an item on it to say who replied and at what time, for instance. Then you can create a view to show any emails that don't have that item, and another view to show emails that do grouped by who responded. The second view could even show how many emails each person responded to, something that might be used as a measurement of performance perhaps.
"Unread mark" checking is not exposed in the API.
I did find 2 links, this one is a basic implementation, where as this link does have more robust code and is implemented as an object in LotusScript. It should be compatible with Notes 6.5+.
I found the second link through nsftools website which has lots of great snippets that solve various problems. You should at least be able to detect if a mail has been read or not. Note that it requires making API level calls. You should be able to create a new script library and copy/paste the code into it.

Resources