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:
+6
-2
@@ -204,12 +204,16 @@ function htmlMail(intro, blocks, link, linkLabel, brand) {
|
||||
+ '<p><a href="' + link + '" style="display:inline-block;background:#043b2f;color:#fff;padding:10px 16px;border-radius:8px;text-decoration:none">' + escH(linkLabel) + '</a></p>'
|
||||
+ '<p style="font-size:12px;color:#777">' + escH(b.name) + ' support. ' + escH(b.footer) + '</p></div>';
|
||||
}
|
||||
// email intake (2026-10-16): the requester's replies come back through SendGrid Inbound Parse. The reply-to carries the ticket
|
||||
// ref (reply+iap-1042@help.instantadpay.com, reply+ls-1003@linkspin.app); Auto-Submitted keeps other robots from answering.
|
||||
const replyTo = t => 'reply+' + String(t.ref).toLowerCase() + (t.platform === 'linkspin' ? '@linkspin.app' : '@help.instantadpay.com');
|
||||
const mailOpts = t => ({ transactional: true, replyTo: replyTo(t), headers: { 'Auto-Submitted': 'auto-replied' } });
|
||||
function confirmRequester(t, m) {
|
||||
if (!deps.mailer || !deps.mailer.hasKey()) return;
|
||||
const link = linkFor(t), b = brandOf(t);
|
||||
const text = 'Hi' + (t.name ? ' ' + t.name : '') + ',\n\nWe got your message and opened ticket ' + t.ref + '. Marty reads every one and will reply as soon as he can.\n\n'
|
||||
+ 'Subject: ' + t.subject + '\n\n' + m.body + '\n\nView the ticket or add more detail here (no sign-in needed):\n' + link + '\n\n' + b.name + ' support';
|
||||
deps.mailer.send(t.email, '[' + t.ref + '] ' + t.subject, text, htmlMail('We got your message and opened ticket ' + t.ref + '. Marty reads every one and will reply as soon as he can.', [m.body], link, 'View your ticket', b), { transactional: true })
|
||||
deps.mailer.send(t.email, '[' + t.ref + '] ' + t.subject, text, htmlMail('We got your message and opened ticket ' + t.ref + '. Marty reads every one and will reply as soon as he can.', [m.body], link, 'View your ticket', b), mailOpts(t))
|
||||
.catch(e => console.error('support confirm mail', e.message));
|
||||
}
|
||||
function notifyRequester(t, m) {
|
||||
@@ -220,7 +224,7 @@ function notifyRequester(t, m) {
|
||||
if (deps.mailer && deps.mailer.hasKey()) {
|
||||
const text = 'Hi' + (cur.name ? ' ' + cur.name : '') + ',\n\nMarty replied to your support ticket ' + cur.ref + ':\n\n' + bodies.join('\n\n---\n\n')
|
||||
+ '\n\nRead the whole thread and reply here:\n' + link + (cur.platform === 'linkspin' ? '\n\nOr open Help in your LinkSpin Control Room: ' + b.help(cur.ref) : '') + '\n\n' + b.name + ' support';
|
||||
deps.mailer.send(cur.email, '[' + cur.ref + '] ' + cur.subject, text, htmlMail('Marty replied to your support ticket ' + cur.ref + ':', bodies, link, 'Read and reply', b), { transactional: true })
|
||||
deps.mailer.send(cur.email, '[' + cur.ref + '] ' + cur.subject, text, htmlMail('Marty replied to your support ticket ' + cur.ref + ':', bodies, link, 'Read and reply', b), mailOpts(cur))
|
||||
.catch(e => console.error('support reply mail', e.message));
|
||||
}
|
||||
// members also get it in their on-site inbox, as a notice: it never pops the sign-in modal. InstantAdPay tickets only:
|
||||
|
||||
Reference in New Issue
Block a user