GMAIL API returns different ThreadID than inboxSDK

1,010 views
Skip to first unread message

Álvaro N. Franz

unread,
Sep 13, 2017, 11:13:03 AM9/13/17
to InboxSDK

Context: I am using the [PHP] Gmail API and InboxSDK.


When sending a message (with Gmail API), I output the message sent object (reference here).


It contains info about message ID and Thread ID.



What is happening?


Id and ThreadID is the same (ok: because it is the first message in the thread).


But if I check the received mail with InboxSDK, i see a different ThreadID than the one returned by GMAIL API.


Example of what is going on:


I send a Test email via API.

enter image description here


When checking the thread ID with InboxSDK though...


enter image description here


We can see both Thread Ids are different.


Maybe I am doing something wrong, can you please help me out with this?


Note: I tried this multiple times with multiple google accounts. The issue is constant.

Chris Cowan

unread,
Sep 18, 2017, 7:10:02 PM9/18/17
to InboxSDK
  1. Are you using the Gmail API gmail.users.messages.send or gmail.users.drafts.send?
  2. If you open the thread in Gmail, an id will be visible in the browser's address bar. Does it match the result of the send API call or does it match the thread id that the InboxSDK determined for the thread row?
  3. If you use the Gmail API gmail.users.threads.get with A) the id that the send API call returned, and with B) the id that the InboxSDK determined for the thread row, what are the results of each?

Álvaro N. Franz

unread,
Sep 19, 2017, 5:03:29 AM9/19/17
to InboxSDK
  • Are you using the Gmail API gmail.users.messages.send or gmail.users.drafts.send?


--> I used both and the same thing happens with both. But I will stick to gmail.users.drafts.send.

(Draft is generated via Web gmail, id is picked with inboxSDK getDraftID() and then sent via API with PHP)


  • If you open the thread in Gmail, an id will be visible in the browser's address bar. Does it match the result of the send API call or does it match the thread id that the InboxSDK determined for the thread row?


 --> The ID in the browser's address bar matches the id given by inboxSDK.


  • If you use the Gmail API gmail.users.threads.get with A) the id that the send API call returned, and with B) the id that the InboxSDK determined for the thread row, what are the results of each?

--> Very curious:


 - If I do gmail.users.threads.get from the mail sender account, it gives 200 OK for the API given ID and 404 not found for the inboxSDK given Id.

 - If I do gmail.users.threads.get from the mail receiver account, it gives 200 OK for the InboxSDK given ID and 404 not found for the API given Id.


Context and purpose: I need a way to match the API given id in the receiver mail account, because I need to match the DOM for specific sent mails. The API will send in background and that is the only ID I can save into the database.


Thank you.


Chris Cowan

unread,
Sep 19, 2017, 2:07:22 PM9/19/17
to InboxSDK
Are you using the InboxSDK to identify the thread in the sender's account or the receiver's account? Gmail thread ids are user-specific. I wouldn't expect the InboxSDK to ever return an id that's a valid thread id for a different user, which seems to imply you're looking at the id given by the InboxSDK in the receiver's account.
Reply all
Reply to author
Forward
0 new messages