HaloMail HaloMail / Docs

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:

index.html
<!-- 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>
Automatic Field Handling: Standard inputs (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:

  1. Open your HaloMail Dashboard → Forms.
  2. Create or select a form to copy its Access Key (e.g. hl_key_9f82a17c).
Access keys are strictly scoped to submission. They cannot read past messages or modify form configurations.

3Widget DOM Events

The widget emits standard DOM events, allowing you to update your UI or display custom notifications:

JavaScript
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:

HTML
<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:

ContactForm.tsx
"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:

HTML Honeypot
<!-- 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:

HTML
<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:

HTML
<!-- 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>

API Reference & Protocol

HaloMail speaks standard ConnectRPC with JSON serialization over HTTP/1.1 and HTTP/2.

Authentication Headers

ScopeHeaderUsage
PublicNoneForms submissions, listing open slots, booking meetings.
ServerAuthorization: ApiKey hl_live_...Backend-to-backend requests using API keys.
UserAuthorization: Bearer <jwt>User session tokens from dashboard login.

Submit Message API

POST /halomail.contact.v1.MessageService/SubmitMessage Public

Parameters

FieldTypeStatusDescription
access_keystringRequiredForm access key.
sender_namestringRequiredSender full name.
sender_emailstringRequiredSender email address.
dataobjectOptionalCustom key-value form fields.
honeypotstringOptionalAnti-spam field (must be empty).

Response (200 OK)

JSON
{
  "id": "msg_01h8x9p2q5a7b1c4",
  "accepted": true,
  "redirect_url": ""
}

List Messages API

POST /halomail.contact.v1.MessageService/ListMessages ApiKey or Bearer

Request Body

JSON
{
  "unread_only": false,
  "page": { "page_size": 25 }
}

Response (200 OK)

JSON
{
  "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

POST /halomail.scheduling.v1.BookingService/ListSlots Public

Parameters

FieldTypeStatusDescription
event_type_idstringRequiredUnique event type ID.
from_datestringRequiredStart date (YYYY-MM-DD).
to_datestringRequiredEnd date (YYYY-MM-DD).
invitee_timezonestringRequiredInvitee IANA timezone name.

Response (200 OK)

JSON
{
  "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

POST /halomail.scheduling.v1.BookingService/CreateBooking Public

Parameters

FieldTypeStatusDescription
event_type_idstringRequiredEvent type identifier.
invitee_namestringRequiredFull name of attendee.
invitee_emailstringRequiredEmail for meeting invite.
invitee_timezonestringRequiredAttendee IANA timezone.
startstringRequiredISO 8601 UTC slot start time.
notesstringOptionalMeeting topic or context.

Response (200 OK)

JSON
{
  "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

POST /halomail.scheduling.v1.BookingService/RescheduleBooking Public (Token)
cURL
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

POST /halomail.scheduling.v1.BookingService/CancelBooking Public (Token)
cURL
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

Node.js / Express
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 CodeHTTP StatusDescription
invalid_argument400 Bad RequestMissing required parameter or failed validation.
unauthenticated401 UnauthorizedMissing or expired authentication token.
permission_denied403 ForbiddenAPI key lacks necessary permissions.
not_found404 Not FoundThe requested resource does not exist.
already_exists409 ConflictThe selected meeting slot is no longer free.
resource_exhausted429 Too Many RequestsRate limit exceeded.