notamitgamer

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

commit 640263665452d094e37756162ed9f145db59b73f
parent bcfc9fb1531da543e40821e749bef12663d40703
Author: Amit Dutta <mail@amit.is-a.dev>
Date:   Thu,  3 Sep 2026 07:31:09 +0530

Merge pull request #8 from notamitgamer/revert-7-fix/fetch-full-email-body

Revert "fix: fetch full email body from Resend (webhook only sends metadata)"
Diffstat:
Mserver.js | 19++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/server.js b/server.js @@ -88,28 +88,13 @@ app.post('/api/incoming', express.text({ type: 'application/json' }), async (req return res.status(200).json({ success: true, message: 'Alias ignored' }); } - // The webhook payload only carries metadata (from/to/subject/email_id) — - // it does NOT include the actual html/text body. Fetch the full email - // via Resend's Retrieve Received Email endpoint using that ID. - let fullHtml = null; - let fullText = null; - if (emailData.email_id) { - const { data: fullEmail, error: getError } = await resend.emails.receiving.get(emailData.email_id); - if (getError) { - console.error('Failed to fetch full email body:', getError.message); - } else { - fullHtml = fullEmail?.html || null; - fullText = fullEmail?.text || null; - } - } - // --- 1. Store the full email as a real mailbox entry --- const mailDoc = { from: originalSender, to: originalRecipient, subject, - html: fullHtml, - text: fullText, + html: emailData.html || null, + text: emailData.text || null, resendEmailId: emailData.email_id || null, read: false, receivedAt: admin.firestore.FieldValue.serverTimestamp(),
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror