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_…
| Permission | Lets it |
|---|---|
conversations:read | Read conversations (who wrote, when, their state and tags) |
conversations:create | Start conversations, as if a visitor wrote in |
conversations:update | Assign, tag, snooze, close and reopen conversations |
messages:read | Read what visitors and your team wrote |
messages:create | Add a visitor's message to a conversation |
messages:send | Reply to visitors as your team (it may email or text them) ⚠ sensitive |
notes:read | Read internal notes |
notes:create | Write internal notes |
visitors:read | Read visitors' names, emails and phone numbers |
visitors:update | Correct visitors' names, emails and phone numbers |
team:read | See your team, who is on and the ring list |
replies:read | Read saved replies |
replies:create | Create saved replies |
replies:update | Change saved replies |
replies:delete | Delete saved replies ⚠ sensitive |
widgets:read | Read websites and chat settings |
articles:read | Read articles |
articles:create | Create articles |
articles:update | Change articles |
articles:delete | Delete articles ⚠ sensitive |
reports:read | Read reports and common questions |
webhooks:manage | Add, 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_key | 401 | This API key is not valid. Check you copied all of it. |
key_revoked | 401 | This API key was revoked. Create a new one in Settings > Integrations. |
key_disabled | 401 | This API key is disabled. An admin can enable it again in Settings > Integrations. |
key_expired | 401 | This API key has expired. Create a new one in Settings > Integrations. |
invalid_token | 401 | This connection has ended or expired. Connect the app again. |
permission_missing | 403 | This key or connection isn't allowed to do that. An admin can add the permission in Settings > Integrations. |
not_found | 404 | No such record, or it isn't visible to this key. |
validation_failed | 400 | Some fields aren't valid. Fix the fields named and try again. |
rate_limited | 429 | Too many requests. Wait for the time given in Retry-After, then try again. |
too_many_auth_failures | 429 | Too many failed sign-ins from this address. Try again in 15 minutes. |
confirmation_required | MCP only | This change needs its preview first: call the _preview tool, check it, then send its confirmation_token. |
too_many_records | 400 | Too many records in one call. Split it into smaller calls. |
body_too_large | 413 | The request is too large. Send at most 1 MB. |
idempotency_key_reused | 422 | This Idempotency-Key was already used for a different request. Use a new key. |
invalid_cursor | 400 | This 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"}'GET/conversationsconversations:readLists conversations, newest first, 50 at most per page. Filter by state (open or closed), website, tag or words they contain; pass next_cursor to get the next page.
statestring (open, closed)site_idstringtagstringqstringlimitintegercursorstring
GET/conversations/:idconversations:read + messages:readOne conversation with what the visitor and the team wrote (internal notes are left out; see notes_list).
POST/conversationsconversations:createStarts a conversation as if a visitor wrote in from another channel (a form, a booking tool). Give an email or a phone so the team can reply; the team is rung as for any new chat.
messagestring, requirednamestringemailstringphonestringpage_urlstringsite_idstring
PATCH/conversations/:idconversations:updateAssigns it (assignee_id, null for nobody), sets its tags, snoozes it (an ISO time, "reply" until the visitor writes, or null), sets a due date, marks it waiting on the visitor, or marks it won.
assignee_idstring or nulltagsarraysnoozed_untilstring or nulldue_atstring or nullwaitingbooleanwonboolean
POST/conversations/:id/closeconversations:updateCloses a conversation, optionally with a one-line summary of what it was about.
summarystring
POST/conversations/:id/messagesmessages:createAdds a message the visitor wrote on another channel to their open conversation.
bodystring, required
POST/conversations/:id/repliesmessages:sendSends a reply to the visitor as your team. It shows in their chat and, if they left, goes by email or text. Preview it first.
bodystring, requiredclient_idstring
GET/conversations/:id/notesnotes:readThe team's internal notes on a conversation. Visitors never see these.
POST/conversations/:id/notesnotes:createAdds an internal note to a conversation for the team. Visitors never see it.
bodystring, required
GET/conversations/:id/visitorvisitors:readThe visitor of a conversation: the name, email and phone they gave (not verified), their country and their earlier conversations on that website.
PATCH/conversations/:id/visitorvisitors:updateCorrects the name, email or phone on a conversation's visitor (null clears one).
namestring or nullemailstring or nullphonestring or null
GET/teamteam:readEveryone on the team, with their role and whether their phone is on the ring list.
GET/repliesreplies:readThe team's saved replies ("/shortcut" in the reply box), for every website or one.
site_idstring
POST/repliesreplies:createAdds a saved reply with its shortcut, for every website (no site_id) or one.
shortcutstring, requiredbodystring, requiredsite_idstring
PATCH/replies/:idreplies:updateChanges a saved reply's shortcut, text or website.
shortcutstring, requiredbodystring, requiredsite_idstring or null
DELETE/replies/:idreplies:deleteDeletes a saved reply for good. Preview it first.
GET/widgetswidgets:readThe websites the chat runs on that this key may use, with their addresses.
GET/articlesarticles:readA website's articles: what the assistant answers from, and the help center when it is on.
site_idstring
GET/articles/:idarticles:readOne article with its text.
POST/articlesarticles:createAdds an article to a website. published puts it on the public help center too; draft keeps the assistant from using it until someone saves it in the app.
site_idstringtitlestring, requiredbodystring, requiredpublishedbooleandraftboolean
PATCH/articles/:idarticles:updateChanges an article's title, text or whether it is on the help center. Saving it this way makes a draft live for the assistant.
titlestringbodystringpublishedboolean
DELETE/articles/:idarticles:deleteDeletes an article for good; the assistant stops using it at once. Preview it first.
GET/reports/summaryreports:readHow chats went over the last 7, 30 or 90 days: how many, answered by the team, by the assistant, unreached, and how fast.
daysinteger (7, 30, 90)site_idstring
GET/reports/common-questionsreports:readWhat visitors asked most in the last 30 days, grouped by meaning, with how those chats went and whether an article covers them.
site_idstring
GET/eventsthe read permission of each event typeEvents from the last 90 days, oldest first, in the webhook body's shape. Pass next_cursor as since to continue; each event needs its resource's read permission.
sincestringtypesarraylimitinteger
GET/webhookswebhooks:manageThe account's webhooks with their status and recent deliveries.
POST/webhookswebhooks:manageAdds a webhook for the events named. The answer holds its signing secret, once.
urlstring, requirednamestringdescriptionstringsite_idstringeventsarray, required
PATCH/webhooks/:idwebhooks:manageChanges a webhook's address, name, website or events.
urlstring, requirednamestringdescriptionstringsite_idstring or nulleventsarray, required
DELETE/webhooks/:idwebhooks:manageDeletes a webhook and its delivery log.
POST/webhooks/:id/rotate-secretwebhooks:manageMakes a new signing secret; the old one keeps signing beside it for 24 hours. The answer holds the new secret, once.
POST/webhooks/:id/testwebhooks:manageQueues a webhook.test event to the webhook.
POST/webhooks/deliveries/:id/retrywebhooks:manageSends a finished delivery again with the same webhook-id, while its body is kept (7 days).
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.
- Claude: Settings → Connectors → Add custom connector, and paste the address.
- ChatGPT: Settings → Connectors (developer mode) → Create, and paste the address.
- Claude Code:
claude mcp add --transport http helpnera https://helpnera.com/mcp - Others: an MCP client config with
{ "url": "https://helpnera.com/mcp" }.
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.
conversations_listread only · conversations:readLists conversations, newest first, 50 at most per page. Filter by state (open or closed), website, tag or words they contain; pass next_cursor to get the next page.
conversations_getread only · conversations:read + messages:readOne conversation with what the visitor and the team wrote (internal notes are left out; see notes_list).
conversations_createchanges data · conversations:createStarts a conversation as if a visitor wrote in from another channel (a form, a booking tool). Give an email or a phone so the team can reply; the team is rung as for any new chat.
conversations_updatechanges data · conversations:updateAssigns it (assignee_id, null for nobody), sets its tags, snoozes it (an ISO time, "reply" until the visitor writes, or null), sets a due date, marks it waiting on the visitor, or marks it won.
conversations_closechanges data · conversations:updateCloses a conversation, optionally with a one-line summary of what it was about.
messages_createchanges data · messages:createAdds a message the visitor wrote on another channel to their open conversation.
messages_sendneeds its preview first · messages:sendSends a reply to the visitor as your team. It shows in their chat and, if they left, goes by email or text. Preview it first.
notes_listread only · notes:readThe team's internal notes on a conversation. Visitors never see these.
notes_createchanges data · notes:createAdds an internal note to a conversation for the team. Visitors never see it.
visitors_getread only · visitors:readThe visitor of a conversation: the name, email and phone they gave (not verified), their country and their earlier conversations on that website.
visitors_updatechanges data · visitors:updateCorrects the name, email or phone on a conversation's visitor (null clears one).
team_listread only · team:readEveryone on the team, with their role and whether their phone is on the ring list.
replies_listread only · replies:readThe team's saved replies ("/shortcut" in the reply box), for every website or one.
replies_createchanges data · replies:createAdds a saved reply with its shortcut, for every website (no site_id) or one.
replies_updatechanges data · replies:updateChanges a saved reply's shortcut, text or website.
replies_deleteneeds its preview first · replies:deleteDeletes a saved reply for good. Preview it first.
widgets_listread only · widgets:readThe websites the chat runs on that this key may use, with their addresses.
articles_listread only · articles:readA website's articles: what the assistant answers from, and the help center when it is on.
articles_getread only · articles:readOne article with its text.
articles_createchanges data · articles:createAdds an article to a website. published puts it on the public help center too; draft keeps the assistant from using it until someone saves it in the app.
articles_updatechanges data · articles:updateChanges an article's title, text or whether it is on the help center. Saving it this way makes a draft live for the assistant.
articles_deleteneeds its preview first · articles:deleteDeletes an article for good; the assistant stops using it at once. Preview it first.
reports_summaryread only · reports:readHow chats went over the last 7, 30 or 90 days: how many, answered by the team, by the assistant, unreached, and how fast.
reports_common_questionsread only · reports:readWhat visitors asked most in the last 30 days, grouped by meaning, with how those chats went and whether an article covers them.
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.started | A visitor starts a conversation |
conversation.answered | Someone on the team answers for the first time |
conversation.assigned | A conversation is assigned, or unassigned |
conversation.message_taken | The assistant takes a message |
conversation.unreached | A visitor leaves before anyone answered |
conversation.closed | A conversation is closed |
conversation.won | Someone marks a conversation won |
message.received | A visitor writes |
message.sent | The team replies to a visitor |
visitor.identified | A visitor gives their name, email or phone |
visitor.requested_call | A visitor asks to be called, and how the call went |
visitor.booked | A visitor books a time in the chat (the appointment is in Dealnera) |
webhook.test | Someone 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) }
endWebhooks 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.
- Create the website's identity secret on Settings → Integrations. Keep it on your server, like an API key.
- On each page view for a signed-in user, make a JWT signed with it (HS256).
sub(your user id, up to 200 characters) andexp(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) andiss(your app's name) are optional, and shown to your team on the chat.iatandnbfare checked when present. - Give the token to the chat: on the tag as
data-user-token, or from your script withhelpnera('identify', token). On sign-out callhelpnera('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");- A chat started while signed in is shown again only to that same user. After a sign-out, or when someone else signs in on the same computer, the old chat stays hidden and the next message starts a new one.
- A chat started before signing in becomes the signed-in user's chat once a token arrives (same browser, same person).
- A token that doesn't check out (wrong secret, expired, no
sub) is treated as signed out; the chat still works. Visitors who aren't signed in are told apart by browser, as before: the inbox shows their earlier chats from the same browser.
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.