
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
gmail-api-parse-message-ts
Advanced tools
forked from https://github.com/EmilTholin/gmail-api-parse-message v2.1
npm install --save gmail-api-parse-message-ts --latest
or add to package.json
"dependencies": {
"gmail-api-parse-message-ts": "~2.2.5"
}
import { ParseGmailApi } from 'gmail-api-parse-message-ts';
import { iGmail } from 'gmail-api-parse-message-ts/dist/iface/iGmail';
export class ParseEmailService {
/** fetch single email from Gmail API */
async getGmail(id: string): Promise<gapi.client.gmail.Message> {
const email: gapi.client.gmail.Message = await gapi.client.gmail.users.messages.get({
userId: 'me',
id: id, // format: 'metadata'
format: 'full'
});
return email;
}
/** Parses Email */
async parseEmail() {
const parse = new ParseGmailApi();
const gmailResponse = await getEmail('[id of your gmail message]');
const iGmail = parse.parseMessage(gmailResponse);
console.log(iGmail); // see iGmail below
}
}
running parseEmail() which returns an iGmail object
interface iGmail {
id: string;
threadId: string;
labelIds: string[];
snippet: string;
historyId: string;
internalDate: number;
textHtml: string;
textPlain: string;
attachments: IAttachment[];
inline?: IAttachment[];
headers: Map<string, string>;
}
interface IAttachment {
filename: string;
mimeType: string;
size: number;
attachmentId: string;
headers?: any;
/** data must be URLsafe base64 encoded */
data?: string;
dataEncoding?: string;
}
/**
* Takes a response from the Gmail API's GET message method and extracts all the relevant data.
* @param {object} gmail api response - The response from the Gmail API parsed to a JavaScript object.
* @return {iGmail object}
*/
parseMessage(response);
MIT
FAQs
Parses Gmail API's GET method to iGmail object. Typescript
The npm package gmail-api-parse-message-ts receives a total of 4,540 weekly downloads. As such, gmail-api-parse-message-ts popularity was classified as popular.
We found that gmail-api-parse-message-ts 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.