Files
riposte-marketplace/integrations/mail-templates/scripts/test_connection.py
T
f3nris dcf257d887 feat(mail-templates): render ACKnowledge SOC emails from markdown (1.0.0)
render-mail-template turns a template, a subject and a markdown
description into the dark ACKnowledge SOC mail (header badge, optional
callout and action button, signature with the logo, SOC or client
footer, fr/en). Nothing is sent: subject, html_body and text_body go to
exchange-send-mail or mail-sender, which embed the data-URI logo.

Eight templates (sla_breach, incident_notification, incident_update,
incident_closure, action_required, escalation, threat_bulletin, info).
The markdown covers GFM tables, code blocks and {{level}} pills; raw
HTML in the inputs is escaped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJu1jvaug4qY1kMgz8wx41
2026-10-19 08:40:32 +00:00

28 lines
975 B
Python

import json, os, sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
SAMPLE = "## Sample\n\n**1 ticket** waiting.\n\n| Ticket | Priority |\n|---|---|\n| SOC-1 | {{medium}} |\n\n```\n8.8.8.8\n```"
def main():
try:
import render_mail_template as r
except ImportError:
# The runner ships one script per command: say so instead of failing the Test button.
print(json.dumps({"ok": True, "detail": "No connection to test; render a template to check the output."}))
return
try:
cfg = json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
sizes = {}
for name in r.TEMPLATES:
out = r.render(cfg, {"template": name, "subject": "Test", "description": SAMPLE, "severity": "high"})
sizes[name] = out["html_bytes"]
print(json.dumps({"ok": True, "templates": sizes}))
except Exception as e:
print(json.dumps({"error": str(e)}))
sys.exit(1)
main()