Documentation & API Reference
Integrate contact forms, embed calendar scheduling, and interact directly with HaloMail ConnectRPC endpoints.
Overview
HaloMail provides two core capabilities backed by one unified infrastructure:
- Contact Forms: Drop a lightweight widget into your site or post JSON directly from your backend. Messages are spam-scored, encrypted, saved in your dashboard, and instantly forwarded to your inbox.
- Meeting Scheduling: Connect Google Calendar to automatically calculate availability across timezones, provision Google Meet links, and handle confirmations, rescheduling, and cancellations.
1Quickstart: 2-Line Form Embed
The fastest way to receive messages. Include the script tag and attach data-halomail with your access key to any form:
<!-- 1. Load the lightweight widget -->
<script src="https://api.halomail.app/widget.js" defer></script>
<!-- 2. Your form with access key -->
<form data-halomail="hl_key_your_access_key">
<input type="text" name="name" placeholder="Your Name" required />
<input type="email" name="email" placeholder="Your Email" required />
<textarea name="message" placeholder="Your Message" required></textarea>
<button type="submit">Send Message</button>
</form>
name, email, message) are mapped automatically. Any additional input fields are preserved and stored in custom payload data.
2Access Keys
Access keys allow client-side websites to submit forms without exposing your private server API keys:
- Open your HaloMail Dashboard → Forms.
- Create or select a form to copy its Access Key (e.g.
hl_key_9f82a17c).
3Widget DOM Events
The widget emits standard DOM events, allowing you to update your UI or display custom notifications:
const form = document.querySelector('form[data-halomail]');
form.addEventListener('halomail:sent', (e) => {
console.log('Submission received:', e.detail);
alert('Thank you! Your message has been delivered.');
});
form.addEventListener('halomail:error', (e) => {
console.error('Submission failed:', e.detail);
alert('Unable to send. Please check your connection and try again.');
});
4Plain HTML Form (No JavaScript)
If your website runs with JavaScript disabled, post directly to the endpoint using HTML form attributes:
<form action="https://api.halomail.app/halomail.contact.v1.MessageService/SubmitMessage" method="POST">
<input type="hidden" name="access_key" value="hl_key_your_access_key" />
<input type="text" name="sender_name" placeholder="Your Name" required />
<input type="email" name="sender_email" placeholder="Your Email" required />
<textarea name="data[message]" placeholder="Your Message" required></textarea>
<button type="submit">Send Message</button>
</form>
5React & Next.js
Build a bespoke contact form with native React state management and Tailwind CSS:
"use client";
import { useState } from "react";
export function ContactForm() {
const [status, setStatus] = useState<"idle" | "sending" | "success" | "error">("idle");
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
setStatus("sending");
const data = new FormData(e.currentTarget);
try {
const res = await fetch("https://api.halomail.app/halomail.contact.v1.MessageService/SubmitMessage", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
access_key: "hl_key_your_access_key",
sender_name: data.get("name"),
sender_email: data.get("email"),
data: { message: data.get("message") },
honeypot: data.get("_hl_hp") || "",
}),
});
if (!res.ok) throw new Error("Submission rejected");
setStatus("success");
e.currentTarget.reset();
} catch {
setStatus("error");
}
}
return (
<form onSubmit={handleSubmit} className="flex flex-col gap-4 max-w-md">
<input name="name" placeholder="Your Name" required className="border p-2 rounded" />
<input name="email" type="email" placeholder="Your Email" required className="border p-2 rounded" />
<textarea name="message" placeholder="Message" required className="border p-2 rounded" />
{/* Honeypot field */}
<input name="_hl_hp" tabIndex={-1} style={{ display: "none" }} autoComplete="off" />
<button type="submit" disabled={status === "sending"}>
{status === "sending" ? "Sending..." : "Send Message"}
</button>
{status === "success" && <p className="text-emerald-500">Message delivered successfully!</p>}
{status === "error" && <p className="text-red-500">Failed to send message. Please try again.</p>}
</form>
);
}
6Honeypot Anti-Spam Defense
Protect your forms from automated spam bots without adding intrusive CAPTCHAs by adding an off-screen input named _hl_hp:
<!-- Humans never see or fill this field; bots fill it automatically -->
<input type="text" name="_hl_hp" style="position: absolute; left: -9999px;" tabIndex="-1" autoComplete="off" />
7Custom Thank-You Redirects
Redirect visitors to a custom confirmation page after submitting by specifying data-redirect:
<form data-halomail="hl_key_your_access_key" data-redirect="https://yoursite.com/thanks">
<!-- Fields -->
</form>
8Modal Booking Widget
Attach a clean scheduling modal to any button with our meetings script:
<!-- 1. Include the booking script -->
<script src="https://api.halomail.app/embed.js" async></script>
<!-- 2. Trigger button with your handle -->
<button data-halomail-book="your-handle">
Book a Consultation
</button>
9Hosted Booking Links
Every user has a dedicated public scheduling URL:
https://halomail.app/book/{your-handle}
API Reference & Protocol
HaloMail speaks standard ConnectRPC with JSON serialization over HTTP/1.1 and HTTP/2.
Authentication Headers
| Scope | Header | Usage |
|---|---|---|
| Public | None | Forms submissions, listing open slots, booking meetings. |
| Server | Authorization: ApiKey hl_live_... | Backend-to-backend requests using API keys. |
| User | Authorization: Bearer <jwt> | User session tokens from dashboard login. |
Submit Message API
Parameters
| Field | Type | Status | Description |
|---|---|---|---|
access_key | string | Required | Form access key. |
sender_name | string | Required | Sender full name. |
sender_email | string | Required | Sender email address. |
data | object | Optional | Custom key-value form fields. |
honeypot | string | Optional | Anti-spam field (must be empty). |
Response (200 OK)
{
"id": "msg_01h8x9p2q5a7b1c4",
"accepted": true,
"redirect_url": ""
}
List Messages API
Request Body
{
"unread_only": false,
"page": { "page_size": 25 }
}
Response (200 OK)
{
"messages": [
{
"id": "msg_01h8x9p2q5a7b1c4",
"form_id": "form_01h7a4e9b2c3",
"sender_name": "Jane Visitor",
"sender_email": "jane@example.com",
"data": { "message": "Can we schedule a call?" },
"spam_score": 0.02,
"is_spam": false,
"read": true,
"created_at": "2026-06-15T14:32:00Z"
}
],
"page": { "next_page_token": "" }
}
List Available Slots API
Parameters
| Field | Type | Status | Description |
|---|---|---|---|
event_type_id | string | Required | Unique event type ID. |
from_date | string | Required | Start date (YYYY-MM-DD). |
to_date | string | Required | End date (YYYY-MM-DD). |
invitee_timezone | string | Required | Invitee IANA timezone name. |
Response (200 OK)
{
"slots": [
{
"start": "2026-06-15T13:00:00Z",
"end": "2026-06-15T13:30:00Z"
},
{
"start": "2026-06-15T14:30:00Z",
"end": "2026-06-15T15:00:00Z"
}
]
}
Create Booking API
Parameters
| Field | Type | Status | Description |
|---|---|---|---|
event_type_id | string | Required | Event type identifier. |
invitee_name | string | Required | Full name of attendee. |
invitee_email | string | Required | Email for meeting invite. |
invitee_timezone | string | Required | Attendee IANA timezone. |
start | string | Required | ISO 8601 UTC slot start time. |
notes | string | Optional | Meeting topic or context. |
Response (200 OK)
{
"booking": {
"id": "bkg_01ha4e2c91b8",
"event_type_id": "evt_30min_intro",
"invitee_name": "Alex Smith",
"invitee_email": "alex@example.com",
"invitee_timezone": "America/New_York",
"start": "2026-06-15T13:00:00Z",
"end": "2026-06-15T13:30:00Z",
"status": "BOOKING_STATUS_CONFIRMED",
"location": "https://meet.google.com/xyz-abcd-efg",
"reschedule_token": "tok_resched_89a1b2c3",
"cancel_token": "tok_cancel_45d6e7f8"
}
}
Reschedule & Cancel API
Invitees can modify or cancel appointments using opaque tokens delivered in their confirmation emails.
Reschedule Booking
curl -X POST https://api.halomail.app/halomail.scheduling.v1.BookingService/RescheduleBooking \
-H "Content-Type: application/json" \
-d '{
"reschedule_token": "tok_resched_89a1b2c3",
"new_start": "2026-06-16T15:00:00Z"
}'
Cancel Booking
curl -X POST https://api.halomail.app/halomail.scheduling.v1.BookingService/CancelBooking \
-H "Content-Type: application/json" \
-d '{
"cancel_token": "tok_cancel_45d6e7f8",
"reason": "Scheduling conflict"
}'
Webhooks & HMAC Verification
Deliver real-time HTTP POST alerts for events: booking.created, booking.cancelled, booking.rescheduled, and message.received.
Verifying Signatures
import crypto from "node:crypto";
function verifyWebhook(payloadRaw, signatureHeader, secret) {
const hmac = crypto.createHmac("sha256", secret);
const digest = "sha256=" + hmac.update(payloadRaw).digest("hex");
return crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(signatureHeader));
}
Error Codes
| Connect Code | HTTP Status | Description |
|---|---|---|
invalid_argument | 400 Bad Request | Missing required parameter or failed validation. |
unauthenticated | 401 Unauthorized | Missing or expired authentication token. |
permission_denied | 403 Forbidden | API key lacks necessary permissions. |
not_found | 404 Not Found | The requested resource does not exist. |
already_exists | 409 Conflict | The selected meeting slot is no longer free. |
resource_exhausted | 429 Too Many Requests | Rate limit exceeded. |