Gmail Command Pack idea: Access body of message

I know, this is maybe a minefield as such a command wouldn't necessarily give you plain text to work with like the subject line command does (the html is fine to work with though) but if I were able to pull the body of the message into a variable and use regex to do all sorts of context aware things in my snippet THAT WOULD BE AMAZING. Would definitely be willing to beta test it if it's something that's possible.

The first thing that comes to mind is just being able to greet a customer lead by their first name through scripting without having to copy and paste it from the body of their message but there are tons of other possibilities this feature would open up.

Hey @Joe_P

Here's the selectors I use to grab message bodies and sender emails in a Gmail conversation:

{email_subject={site: text; page=https://mail.google.com/*; select=ifneeded; selector=.hP}}
{email_bodies=map({site: text; multiple=yes; selector=.ii; page=https://mail.google.com/mail/*; select=ifneeded}, x -> trim(x))}
{sender_emails=map({site: html; multiple=yes; selector=h3.iw; page=https://mail.google.com/mail/*; select=ifneeded}, x -> extractregex(x, "span email=\"(.+?)\""))}

This gives you just the plain text message, which I personally found sufficient to do context aware analysis. Let me know if it works for you, and if you have any ideas to further enhance this.

I agree it would be cool to have this in the command pack itself.

1 Like

I will experiment with this! Thanks for the tip

The email_bodies variable worked well enough. I'm even able to use the Calendar sidebar in Gmail to add calendar events with Text Blaze that pull info from the email that's currently being shown. Unbelievable the time savings that I've been able to achieve. Thank you so much.

1 Like

Cheers! That's great to hear :smiley: