Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
node-gmail-api
Advanced tools
Interacts with the gmail api, fetching emails
Weekly downloads
Readme
Node module to interact with the gmail api.
Why not the google official library? Well it does too much and doesn't implement batching. Which means fetching a bunch of email is insanely painful. This module exposes a function which will query the api searching for messages and hit the google batch api to fetch all the messages that are returned.
To use this module, you'll need an oauth access token key. See more details here: https://developers.google.com/gmail/api/overview#auth_and_the_gmail_api.
You may use passport-google-oauth to get an access key for a user, then use this module to make requests on behalf of the authenticated user.
Example authentication call (cf. passport-google-oauth for more complete usage examples):
passport.use(new GoogleStrategy({
clientID: config.googleApp.clientId
, clientSecret: config.googleApp.clientSecret
, userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo'
, callbackURL: config.baseurl + '/oauth2callback'
}
, function(accessToken, refreshToken, profile, done) {
// do your thing here
}
))
// assuming access token has already been retrieved inside variable `accessToken`
var Gmail = require('node-gmail-api')
, gmail = new Gmail(accessToken)
, s = gmail.messages('label:inbox', {max: 10})
s.on('data', function (d) {
console.log(d.snippet)
})
cf. gmail API performance guide.
var Gmail = require('node-gmail-api')
, gmail = new Gmail(accessToken)
, s = gmail.messages('label:inbox', { fields: ['id', 'internalDate', 'labelIds', 'payload']})
s.on('data', function (d) {
console.log(d.id)
})
var Gmail = require('node-gmail-api')
, gmail = new Gmail(accessToken)
, s = gmail.messages('label:inbox', {format: 'raw'})
s.on('data', function (d) {
console.log(d.raw)
})
ISC
FAQs
Interacts with the gmail api, fetching emails
The npm package node-gmail-api receives a total of 2,389 weekly downloads. As such, node-gmail-api popularity was classified as popular.
We found that node-gmail-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.