Help desk email intake: SendGrid Inbound Parse -> /api/inbound/email (secret key) creates tickets or threads replies; robots, bounces, auto-replies and our own mail dropped; ticket mail carries reply+<ref>@ reply-to and Auto-Submitted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-16 18:10:53 -05:00
parent 524ce843dc
commit ad17017250
4 changed files with 86 additions and 2 deletions
+2
View File
@@ -44,6 +44,8 @@ async function send(to, subject, text, html, opts) { // html optional (2026-10-0
content
};
if (unsub) msg.headers = { 'List-Unsubscribe': '<' + unsub + '>', 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click' };
if (opts && opts.replyTo) msg.reply_to = { email: String(opts.replyTo) }; // help desk: replies thread back into the ticket
if (opts && opts.headers) msg.headers = Object.assign(msg.headers || {}, opts.headers);
const body = JSON.stringify(msg);
const req = https.request({ hostname: 'api.sendgrid.com', path: '/v3/mail/send', method: 'POST',
headers: { Authorization: 'Bearer ' + key(), 'Content-Type': 'application/json',