API, MCP and webhooks

For connecting a booking tool, a CRM, another channel or an AI assistant. A conversation you create here rings the team like a chat and lands in the same inbox.

Keys and permissions

An owner creates keys under Settings → Integrations → API keys and ticks exactly what each may do, on every website or some. Keys start with hn_live_ (your real chats) or hn_test_ (test mode). A key acting as the account keeps working when people leave; a personal key acts as its person and never does more than they can do right now. Send it on every request, from your server only (browsers can't call the API):

Authorization: Bearer hn_live_…
PermissionLets it
conversations:readRead conversations (who wrote, when, their state and tags)
conversations:createStart conversations, as if a visitor wrote in
conversations:updateAssign, tag, snooze, close and reopen conversations
messages:readRead what visitors and your team wrote
messages:createAdd a visitor's message to a conversation
messages:sendReply to visitors as your team (it may email or text them) ⚠ sensitive
notes:readRead internal notes
notes:createWrite internal notes
visitors:readRead visitors' names, emails and phone numbers
visitors:updateCorrect visitors' names, emails and phone numbers
team:readSee your team, who is on and the ring list
replies:readRead saved replies
replies:createCreate saved replies
replies:updateChange saved replies
replies:deleteDelete saved replies ⚠ sensitive
widgets:readRead websites and chat settings
articles:readRead articles
articles:createCreate articles
articles:updateChange articles
articles:deleteDelete articles ⚠ sensitive
reports:readRead reports and common questions
webhooks:manageAdd, change and remove webhooks ⚠ sensitive

Accounts not on a paid plan (or trial) can read but not change anything. webhooks:manage is for account keys only.

Errors and limits

Errors come back as { "error": { "code": "…", "message": "…" } }, with permission when one is missing and retry_after when you should wait. An id from another account is always 404.

invalid_key401This API key is not valid. Check you copied all of it.
key_revoked401This API key was revoked. Create a new one in Settings > Integrations.
key_disabled401This API key is disabled. An admin can enable it again in Settings > Integrations.
key_expired401This API key has expired. Create a new one in Settings > Integrations.
invalid_token401This connection has ended or expired. Connect the app again.
permission_missing403This key or connection isn't allowed to do that. An admin can add the permission in Settings > Integrations.
not_found404No such record, or it isn't visible to this key.
validation_failed400Some fields aren't valid. Fix the fields named and try again.
rate_limited429Too many requests. Wait for the time given in Retry-After, then try again.
too_many_auth_failures429Too many failed sign-ins from this address. Try again in 15 minutes.
confirmation_requiredMCP onlyThis change needs its preview first: call the _preview tool, check it, then send its confirmation_token.
too_many_records400Too many records in one call. Split it into smaller calls.
body_too_large413The request is too large. Send at most 1 MB.
idempotency_key_reused422This Idempotency-Key was already used for a different request. Use a new key.
invalid_cursor400This cursor isn't valid. Start again without one.

Limits per key: 600 requests a minute (60 for replies to visitors), 120 MCP tool calls a minute (20 for ones that send or delete), bodies up to 1 MB, lists up to 50 per page. Over a limit: 429 with Retry-After. 50 failed authentications in 5 minutes from one address block it for 15 minutes.

REST endpoints

Base: https://helpnera.com/api/public/v1. JSON in and out. Writes take an Idempotency-Key header: the same key with the same request within 24 hours returns the first answer (Idempotent-Replayed: true) instead of doing it twice. Lists return next_cursor; pass it back as cursor.

curl -X POST "https://helpnera.com/api/public/v1/conversations" \
  -H "Authorization: Bearer $HELPNERA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: booking-4821" \
  -d '{"message":"Can you quote for a new boiler?","name":"Maria","email":"maria@example.com"}'

AI assistants (MCP)

Helpnera is a remote MCP server at https://helpnera.com/mcp (Streamable HTTP). Add it to your assistant as a custom connector; it sends you here to sign in and choose what it may do (OAuth). An agent on your own server can send an API key as Authorization: Bearer instead.

Tools that send something to a visitor or delete come in pairs: …_preview shows what would happen and returns a confirmation_token, good for 5 minutes and once, which the tool itself then needs. Text people wrote comes back as { "source": "user_content", "content": "…" }: data, never instructions.

Webhooks

A delivery can arrive more than once: skip any whose webhook-id you have already handled. Add an address under Settings → Integrations → Webhooks (or POST /webhooks with an account key), choose the events, and copy the signing secret: it is shown once. We POST JSON signed the Standard Webhooks way, and count any 2xx answer within 10 seconds as delivered.

POST /your/endpoint
webhook-id: 3f9a…            (the event's id: the same on every retry)
webhook-timestamp: 1792819200
webhook-signature: v1,K5o…=  (two, space-separated, for 24 h after a new secret)

{
  "id": "3f9a…",
  "type": "conversation.started",
  "timestamp": "2026-10-24T08:00:00.000Z",
  "schema_version": 1,
  "data": { "object": "conversation", "id": "…", "version": 1792819200000, "record": { … } }
}

data.version rises with every change to a conversation or message: ignore an event older than what you hold (order isn't guaranteed). Retries after a network error, 5xx, 408 or 429: 5 s, 5 min, 30 min, 2 h, 5 h, 10 h, 10 h (8 tries in about a day). Other 4xx answers and redirects are final. A webhook whose deliveries all fail for 5 days is turned off and the owners are emailed; turned back on, it starts with new events. The delivery log keeps 30 days; a delivery can be sent again for 7.

conversation.startedA visitor starts a conversation
conversation.answeredSomeone on the team answers for the first time
conversation.assignedA conversation is assigned, or unassigned
conversation.message_takenThe assistant takes a message
conversation.unreachedA visitor leaves before anyone answered
conversation.closedA conversation is closed
conversation.wonSomeone marks a conversation won
message.receivedA visitor writes
message.sentThe team replies to a visitor
visitor.identifiedA visitor gives their name, email or phone
visitor.requested_callA visitor asks to be called, and how the call went
visitor.bookedA visitor books a time in the chat (the appointment is in Dealnera)
webhook.testSomeone pressed Send a test

Check the signature

Each example is run by our test suite against the real signer.

Node.js
import { createHmac, timingSafeEqual } from "node:crypto";

// headers: the request's headers (lower-case names); rawBody: the body exactly as received.
export function verify(secret, headers, rawBody) {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sigs = headers["webhook-signature"];
  if (!id || !ts || !sigs) return false;
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; // older than 5 minutes: refuse
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const want = createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest();
  // During a secret rotation two signatures arrive, space-separated: either may match.
  return sigs.split(" ").some((s) => {
    const [version, sig] = s.split(",");
    const got = Buffer.from(sig ?? "", "base64");
    return version === "v1" && got.length === want.length && timingSafeEqual(got, want);
  });
}
Python
import base64, hashlib, hmac, time

# headers: the request's headers (lower-case names); raw_body: the body bytes exactly as received.
def verify(secret: str, headers: dict, raw_body: bytes) -> bool:
    msg_id, ts, sigs = headers.get("webhook-id"), headers.get("webhook-timestamp"), headers.get("webhook-signature")
    if not (msg_id and ts and sigs):
        return False
    if abs(time.time() - int(ts)) > 300:  # older than 5 minutes: refuse
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    want = base64.b64encode(hmac.new(key, f"{msg_id}.{ts}.".encode() + raw_body, hashlib.sha256).digest()).decode()
    # During a secret rotation two signatures arrive, space-separated: either may match.
    return any(hmac.compare_digest(s.split(",", 1)[1], want) for s in sigs.split(" ") if s.startswith("v1,"))
Go
import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/base64"
	"fmt"
	"math"
	"strconv"
	"strings"
	"time"
)

// Verify checks a delivery: id, ts and sigs are the webhook-id, webhook-timestamp and
// webhook-signature headers; rawBody is the body exactly as received.
func Verify(secret, id, ts, sigs string, rawBody []byte) bool {
	t, err := strconv.ParseInt(ts, 10, 64)
	if err != nil || math.Abs(float64(time.Now().Unix()-t)) > 300 {
		return false
	}
	key, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(secret, "whsec_"))
	if err != nil {
		return false
	}
	mac := hmac.New(sha256.New, key)
	mac.Write([]byte(fmt.Sprintf("%s.%s.", id, ts)))
	mac.Write(rawBody)
	want := base64.StdEncoding.EncodeToString(mac.Sum(nil))
	for _, s := range strings.Split(sigs, " ") {
		if v, sig, ok := strings.Cut(s, ","); ok && v == "v1" && hmac.Equal([]byte(sig), []byte(want)) {
			return true
		}
	}
	return false
}
PHP
<?php
// $headers: the request's headers (lower-case names); $rawBody: the body exactly as received.
function verify(string $secret, array $headers, string $rawBody): bool {
    $id = $headers['webhook-id'] ?? null; $ts = $headers['webhook-timestamp'] ?? null; $sigs = $headers['webhook-signature'] ?? null;
    if (!$id || !$ts || !$sigs || abs(time() - (int)$ts) > 300) return false;
    $key = base64_decode(preg_replace('/^whsec_/', '', $secret));
    $want = base64_encode(hash_hmac('sha256', "$id.$ts.$rawBody", $key, true));
    foreach (explode(' ', $sigs) as $s) {
        [$v, $sig] = array_pad(explode(',', $s, 2), 2, '');
        if ($v === 'v1' && hash_equals($want, $sig)) return true;
    }
    return false;
}
Ruby
require "base64"
require "openssl"

# headers: the request's headers (lower-case names); raw_body: the body exactly as received.
def verify(secret, headers, raw_body)
  id, ts, sigs = headers["webhook-id"], headers["webhook-timestamp"], headers["webhook-signature"]
  return false unless id && ts && sigs
  return false if (Time.now.to_i - ts.to_i).abs > 300
  key = Base64.strict_decode64(secret.delete_prefix("whsec_"))
  want = Base64.strict_encode64(OpenSSL::HMAC.digest("sha256", key, "#{id}.#{ts}.#{raw_body}"))
  sigs.split(" ").any? { |s| v, sig = s.split(",", 2); v == "v1" && OpenSSL.secure_compare(sig.to_s, want) }
end

Webhooks added before October 2026 keep their old event names (conversation.created…) and t=…,v1=… signature until an owner changes them.

Events feed

GET /events returns the same events as webhooks, oldest first, for the last 90 days: for catching up after downtime or replaying. Pass next_cursor back as since; a cursor never skips or repeats an event. You see events your key may read, on its websites.

curl "https://helpnera.com/api/public/v1/events?types=conversation.started,message.received" -H "Authorization: Bearer $HELPNERA_KEY"

Test mode

An hn_test_ key works in a separate test account with one test website: its data never mixes with your real chats, nothing rings, no email is sent and the AI isn't used. Test webhooks may use http:// to a public address, for tunnels.

Versions

This is version 1. New fields and endpoints can appear at any time; anything that would break an integration comes as /v2, with version 1 kept at least 12 months, announced here and by email to owners of keys used in the last 30 days.

Signed-in visitors

If your website has its own sign-in, tell the chat who is signed in. Your team then sees their name, email and your user id on every chat, earlier chats count from any device, and the user_id comes back in webhooks. Your server signs a short token, so a visitor can't pretend to be someone else.

  1. Create the website's identity secret on Settings → Integrations. Keep it on your server, like an API key.
  2. On each page view for a signed-in user, make a JWT signed with it (HS256). sub (your user id, up to 200 characters) and exp (at most 30 days away; an hour is plenty) are required; name, email, role (up to 40 characters), org ({ id, name, plan }: the customer's company in your app) and iss (your app's name) are optional, and shown to your team on the chat. iat and nbf are checked when present.
  3. Give the token to the chat: on the tag as data-user-token, or from your script with helpnera('identify', token). On sign-out call helpnera('reset').
// On your server (Node; any JWT library works the same way)
import jwt from "jsonwebtoken";
const userToken = jwt.sign(
  { sub: user.id, name: user.name, email: user.email },
  process.env.HELPNERA_IDENTITY_SECRET,
  { algorithm: "HS256", expiresIn: "1h" },
);

<!-- In the page -->
<script async src="https://helpnera.com/widget/w.js" data-key="wk_…" data-user-token="{{ userToken }}"></script>

// Or from your script, for example after signing in without a page load
window.helpnera = window.helpnera || function () { (window.helpnera.q = window.helpnera.q || []).push(arguments); };
helpnera("identify", userToken);
// Signing out
helpnera("reset");

Inside your own app

When the chat is your app's support, your app can tell your team what the person was doing. Call helpnera('context', {…}) on each page and after each error; the latest one goes with the first message of a chat, folded away under it for your team (the person can open it too). Only these fields are kept, each clipped, at most 4 KB in all: app, version, page (the path; a query string is dropped), device, locale, timezone, requestIds (the last five, req_ and 12 characters) and lastError (message, the text the person saw; requestId; at). Never put form fields or page content in it.

helpnera("context", {
  app: "dealnera",
  version: "3f2a1c9",
  page: location.pathname,
  requestIds: lastRequestIds,          // oldest first
  lastError: { message: "Couldn't save the deal", requestId: "req_7K3MQ2ZP9XHD", at: new Date().toISOString() },
});

For a phone app, turn on the chat page on Settings → Integrations → Signed-in visitors and open its address in a web view, with the token and the context (JSON, base64url) after a #, which never reaches a server log: https://helpnera.com/chat/wk_…#token=…&context=…. The chat opens full screen, signed in.

Checking that the chat is on your page

The chat draws itself: you add only the script tag. The launcher is not inside <body> or an iframe. It is one <div data-helpnera> placed directly under <html>, and its contents sit in a closed shadow root so your page's CSS and scripts can't touch them. So in the console, document.querySelector("[data-helpnera]") finds it, and a search of the body finds nothing. To click it in an automated test, open shadow roots before the page runs (Playwright: page.addInitScript that wraps Element.prototype.attachShadow to force mode: "open"), then use the button named "Chat with us" (or the corner position: the host is the topmost element about 28 px from the bottom-right edges). It only appears on the website addresses listed for it in Settings → Install, and from automated browsers it skips page-view counting.

Contact forms

A plain HTML form doesn't need a key: point it at the address on Settings → Install. It only works from your own website.