I am trying to make a chrome extension for gmail and am currently tinkering around with InboxSDK but I am unable to figure out how do I access email body from the inbox list itself(without opening the email) to add labels depending on the content.
I get the threadRowView object but I am unsure what to do after that to get more details of the mail. I think getElement() might be able to help somehow but I am unable to make sure how do I extract the mail from raw gmail DOM. https://inboxsdk.github.io/inboxsdk-docs/lists/
I am yet to find a way to do this directly only by using InboxSDK but there is a workaround which can help you get shorter descriptive text from the email which is seen on the inbox list.
InboxSDK.load('1.0', 'YOUR_APP_ID').then(function(sdk) {
sdk.Lists.registerThreadRowViewHandler(function(threadRowView) {
var threadElement = threadRowView.getElement();
var descriptiveText = threadElement.textContent;
// do something based on the text
});
});
I will update the answer if I am able to a better solution but I think one way to this properly should be using Official Gmail API and get the message using messageID.