notamitgamer

It's my profile man, there is ...
Log | Files | Refs | README

commit 13684516cbc7a4ec2a1918868ba5fabe4a85d2e3
parent 12f4b10f0edadd47a42d7e52d19f4750a2c8fe52
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Tue, 26 May 2026 19:03:03 +0530

Enhance email payload with original ID tagging

Added a hidden tag to the email payload for original email ID and updated the mapping logic to extract this ID from the tags.
Diffstat:
Mserver.js | 29++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/server.js b/server.js @@ -239,7 +239,11 @@ app.post('/api/incoming', express.text({ type: 'application/json' }), async (req to: [personalGmail], reply_to: originalSender, subject: subject, - html: notificationHtml + html: notificationHtml, + // We attach the original incoming email ID as a hidden tag + tags: [ + { name: 'original_id', value: emailData.email_id || 'unknown' } + ] }; const { data, error } = await resend.emails.send(payload); @@ -276,12 +280,23 @@ app.get('/api/emails', async (req, res) => { } // 2. Map the Sent Emails to look like Received Emails - let mappedEmails = payload.data.map(email => ({ - id: email.id, - subject: email.subject, - from: email.reply_to || "Notifier Bot", // Replace bot with real sender! - created_at: email.created_at - })); + let mappedEmails = payload.data.map(email => { + // Extract the original incoming email ID if we tagged it + let actualId = email.id; + if (email.tags && Array.isArray(email.tags)) { + const origTag = email.tags.find(t => t.name === 'original_id'); + if (origTag && origTag.value !== 'unknown') { + actualId = origTag.value; + } + } + + return { + id: actualId, + subject: email.subject, + from: email.reply_to || "Notifier Bot", + created_at: email.created_at + }; + }); // 3. Sync Logic: Only return emails newer than the requested timestamp const since = req.query.since;
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror