Accessing Compose HTML Body In 'sent' Event

154 views
Skip to first unread message

jac...@twied.com

unread,
Feb 3, 2017, 1:47:20 AM2/3/17
to InboxSDK
Hi there,

After an email has been sent, I need to look at the HTML body to detect some identifiers in it that I have placed.  I then send these identifiers to an external API along with the Gmail MessageID.

Is there a way I can access both the HTML body of a sent email as well as the Gmail MessageID at the same time?

It seems like I can only get the HTML body in 'presending' (but can't access MessageID yet as it doesn't exist), and can only get the MessageID in 'sent' (but can't access the HTML body as the compose window has been destroyed).

I was previously using gmail.js and was able to access the raw HTTP request data (which includes the HTML body) in the observer.after('send_message') function, but I can't find a way to replicate this in InboxSDK.

Any help would be greatly appreciated!

Chris Cowan

unread,
Feb 3, 2017, 1:59:27 PM2/3/17
to InboxSDK
You can copy the compose body to a variable in a higher scope when the presending event fires:

let body;
composeView
.on('presending',() => {
  body
= composeView.getHTMLContent();
});
composeView
.on('sent', event => {
  console
.log('sent', event.messageID, body);
});

Reply all
Reply to author
Forward
0 new messages