Contact Form Notifications
Get instant contact form notifications in Slack, SMS, or other channels instead of email, with a webhook implementation and routing examples.
Contact form submissions traditionally go to an email inbox where they get buried. Route them through Alphorn instead and get instant alerts in Slack, Telegram, or wherever your team actually works.
Why not just email?
- Emails get lost in spam folders or cluttered inboxes
- No priority routing - a partnership inquiry looks the same as a spam message
- Multiple team members need access, requiring shared inboxes or forwarding rules
- No real-time alerting - you check email when you check email
With Alphorn, a contact form submission hits Slack immediately, pages someone for urgent requests, and still archives everything via email.
Implementation
Send the notification from your backend, not from the browser: Alphorn doesn't allow cross-origin (CORS) requests, and the API key must stay secret.
Backend handler (Node.js)
Assumes an Express app with app.use(express.json()) so req.body is parsed:
app.post("/contact", async (req, res) => {
const { name, email, subject, message, type } = req.body;
// Determine priority based on inquiry type
const priority = type === "enterprise" ? 4 : type === "support" ? 3 : 2;
try {
const r = await fetch("https://app.alphorn.dev/n/V1StGXR8_Z5jdHi6B-myT", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.ALPHORN_API_KEY}`,
},
body: JSON.stringify({
title: `Contact: ${subject}`,
message: `From: ${name} (${email})\n\n${message}`,
priority,
tags: ["contact", type || "general"],
}),
});
if (!r.ok) throw new Error(`Alphorn responded ${r.status}`);
} catch (err) {
console.error("Contact notification failed:", err);
return res.status(502).json({ ok: false });
}
res.json({ ok: true });
});Backend handler (Python / Flask)
import os
import requests
from flask import request
@app.route("/contact", methods=["POST"])
def contact():
data = request.json
priority = {"enterprise": 4, "support": 3}.get(data.get("type"), 2)
r = requests.post(
"https://app.alphorn.dev/n/V1StGXR8_Z5jdHi6B-myT",
headers={"Authorization": "Bearer " + os.environ["ALPHORN_API_KEY"]},
json={
"title": f"Contact: {data['subject']}",
"message": f"From: {data['name']} ({data['email']})\n\n{data['message']}",
"priority": priority,
"tags": ["contact", data.get("type") or "general"],
},
timeout=10,
)
r.raise_for_status() # surfaces 4xx/5xx instead of silently dropping the submission
return {"ok": True}Routing examples
| Channel | Filter | Purpose |
|---|---|---|
| Slack (#leads) | Tags has any of enterprise | Enterprise inquiries go to sales |
| Slack (#support) | Tags has any of support | Support requests go to the support team |
| Telegram | Priority greater than 2 | Personal alert for high-priority contacts |
| No filter | Archive every submission |
Cron Job & Script Monitoring
Monitor cron jobs and scripts: send success or failure notifications from crontab with curl, a reusable bash wrapper, and failure-only alerts.
Server & Infrastructure Monitoring
Server monitoring alerts with a shell script and cron: disk space, memory usage, CPU load, and SSL certificate expiry, routed to Slack, email, or SMS.