Get last mail from Gmail

Resolved :

Multiple API call and 2 iterators just to reach the target… Much faster than fetching all mails with email module, but consumes operations. This way I’m also sure that I’m getting the last mail and it’s pretty flexible.

get last mail in this label.json (136.2 KB)

Optimized solution (http mainly) with 3 operations :

get last mail in this label (optimized).json (27.8 KB)

Optimization 2 : We only needed a last date from the mail, so instead of reusing the “get email” native module, I added parameters to second HTTP URL to only include Header called “Date”.

URL : https://gmail.googleapis.com/gmail/v1/users/me/messages/1***d4?format=metadata&metadataHeaders=Date

P.S. Needs some formatting to get proper date though. Formula is

{{formatDate(addHours(parseDate(trim(first(split(25.data.payload.headers.value; “+”))); “ddd, D MMM YYYY HH:mm:ss”); 1); “DD/MM/YYYY HH:mm”)}}