30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { google } from 'googleapis';
|
|
import { loadAuthorizedOAuthClient } from './src/gmailApi.js';
|
|
import { getMailAccount } from './src/mailConfig.js';
|
|
|
|
async function check() {
|
|
const account = await getMailAccount('vjoati-gmail');
|
|
const auth = await loadAuthorizedOAuthClient({ account });
|
|
const gmail = google.gmail({ version: 'v1', auth });
|
|
|
|
const msgId = '19de22e8637bfecf'; // ZEIT SPRACHEN from May 1
|
|
try {
|
|
const res = await gmail.users.messages.get({ userId: 'me', id: msgId });
|
|
console.log('--- Message Metadata ---');
|
|
console.log('ID:', res.data.id);
|
|
console.log('Snippet:', res.data.snippet);
|
|
console.log('Label IDs:', JSON.stringify(res.data.labelIds));
|
|
|
|
const labelsRes = await gmail.users.labels.list({ userId: 'me' });
|
|
const labels = labelsRes.data.labels;
|
|
console.log('\n--- Label Mapping for this Message ---');
|
|
res.data.labelIds.forEach(id => {
|
|
const match = labels.find(l => l.id === id);
|
|
console.log(id + ' -> ' + (match ? match.name : 'Unknown'));
|
|
});
|
|
} catch (e) {
|
|
console.error('Error:', e.message);
|
|
}
|
|
}
|
|
check();
|