0

I am creating Message Object with raw(base64 encoded) & threadID field values. By using a valid threadId (of an existing email) , i was able to create a Threaded Message in users inbox.

After the 'Threading Changes' changed by google in April 2019, the messages are not threading. Instead they appear as individual messages, despite the ThreadID of both messages being same.

Google has recommended to add 'References' & 'In-Reply-To' header with value of 'Message-Id' from existing email. The Problem is, whenever we sent a new email using gmail api, we only receive message snipped back which only has ThreadID and Label values. To Retrieve 'Message-Id' of this sent email, another GET API call needs to be made. This is adding extra load to the system and un-necessarily making the system complex.

My Questions:

  1. Is there any other way to Thread Messages using Gmail-APi?

  2. Can we retrieve Message-ID without making another API Call?

  3. Can we use any other headers /custom headers to establish a relationship between messages for them to thread.

zee
  • 502
  • 8
  • 28

1 Answers1

-1

When you send an email with Gmail API, the response contains the message id, as you can confirm with the Users.messages: send Try this API, so another API call is not necessary.

enter image description here

ziganotschka
  • 25,866
  • 2
  • 16
  • 33
  • the value contained in id is same as ThreadId and not Message_ID.Here is an example of one such response { "id": "14fd1c555a1352b7", "threadId": "14fd1c52911f0f64", "labelIds": [ "SENT", "INBOX", "IMPORTANT", "UNREAD" ]} . As you can see its just a threadID and not message-id. Threading Policy requires that you have to put value of Message-ID in references and in-reply-to header .@ziganotschka – zee Sep 05 '19 at 08:26
  • `14fd1c555a1352b7` is not the same as `14fd1c52911f0f64` , it is the message Id by which you can rtrieve a message with the Gmail API. But I see, you mean the Id that is contained in the headers and needs to be attached to 'In-Reply-To'. This data has to be retrieved indeed through a GET request as explained here: https://stackoverflow.com/a/32591614/11599789 – ziganotschka Sep 05 '19 at 09:50
  • However, the information in the documentaiton is slightly confusing. It says that "The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard" - if they are provided. However, if you do not provide this information, but only the threadId - the message will still be threaded correctly. – ziganotschka Sep 05 '19 at 09:53
  • Yes the emails used to thread only by passing the thread id in message object , but after Google has introduced new Threading Changes in April 2019, the same has stopped working. Now as per Google Policy it requires to add In-Reply-To and References Header – zee Sep 05 '19 at 10:59
  • I did not try it in Java, but with the Try this API it still works with the Thread Id only – ziganotschka Sep 05 '19 at 11:03
  • I used the same Try It Explorer and the Messages are not threaded. I sent from gsuite email to another gmail account , the mails did not thread. – zee Sep 05 '19 at 11:06
  • If you are having same sender and recipient, it appears as a thread. but not when sent to different recipients – zee Sep 05 '19 at 11:07
  • Then I would not know another workaround then retrieving the headers with a GET request – ziganotschka Sep 05 '19 at 12:27
  • message id in the response is NOT same as the Message-ID in the header. The Message-ID in the header is what is required as the 'In-Reply-To' header's value – Paullo Feb 25 '20 at 13:33