Developers

Guide

Send signups from your app

Add every new account to HelpWell from your server, with its tags and custom fields, and subscribe people only when they asked.

When someone signs up in your app, your server tells HelpWell with one call: create or update the contact. HelpWell keeps one contact per person per product, so send the same call again whenever their plan, tags or fields change.

#Before you start

  • An API key from Settings → API keys with the contacts:write scope (owners and admins create keys; the key is shown once). Keep it in your server's secret settings as HELPWELL_API_KEY.
  • HELPWELL_API_URL = https://app.helpwell.ai/api/v1 and HELPWELL_PRODUCT_ID = your product's id (Settings → API keys shows both).
  • Your user id: a stable string such as user_123. Send it as externalId. If you also identify people in the chat widget, use the same value as the identity token's sub (Identify widget visitors).

#1. Upsert the contact after signup

Run it after the signup transaction commits, from a background job that retries. A retry with the same Idempotency-Key is answered once.

curl -X POST "$HELPWELL_API_URL/contacts" \
  -H "Authorization: Bearer $HELPWELL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-user_123" \
  -d '{
  "productId": "'"$HELPWELL_PRODUCT_ID"'",
  "externalId": "user_123",
  "email": "ada@example.com",
  "name": "Ada Lovelace",
  "tags": {
    "add": [
      "app-user",
      "trial"
    ]
  },
  "attributes": {
    "plan": "trial",
    "seats": 1,
    "signed_up_at": "2026-10-05"
  }
}'
// env: your server runtime’s environment (process.env, Deno.env, a Worker’s env).
const response = await fetch(`${env.HELPWELL_API_URL}/contacts`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'signup-user_123',
  },
  body: JSON.stringify({
    productId: env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    email: 'ada@example.com',
    name: 'Ada Lovelace',
    tags: { add: ['app-user', 'trial'] },
    attributes: { plan: 'trial', seats: 1, signed_up_at: '2026-10-05' },
  }),
});
const data = await response.json();
if (!response.ok) throw new Error(`HelpWell: ${data.error.code}`);
const { contact } = data; // contact.id is HelpWell’s id for this person
const response = await fetch(`${process.env.HELPWELL_API_URL}/contacts`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'signup-user_123',
  },
  body: JSON.stringify({
    productId: process.env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    email: 'ada@example.com',
    name: 'Ada Lovelace',
    tags: { add: ['app-user', 'trial'] },
    attributes: { plan: 'trial', seats: 1, signed_up_at: '2026-10-05' },
  }),
});
const data = await response.json();
if (!response.ok)
  throw new Error(`HelpWell ${response.status} ${data.error.code}: ${data.error.message} (${data.requestId})`);
const { contact } = data; // contact.id is HelpWell’s id for this person
import os

import requests

response = requests.post(
    f"{os.environ['HELPWELL_API_URL']}/contacts",
    headers={
        "Authorization": f"Bearer {os.environ['HELPWELL_API_KEY']}",
        "Idempotency-Key": "signup-user_123",
    },
    json={
        "productId": os.environ["HELPWELL_PRODUCT_ID"],
        "externalId": "user_123",
        "email": "ada@example.com",
        "name": "Ada Lovelace",
        "tags": {"add": ["app-user", "trial"]},
        "attributes": {"plan": "trial", "seats": 1, "signed_up_at": "2026-10-05"},
    },
    timeout=10,
)
response.raise_for_status()
data = response.json()

The answer is 200 with { "contact": { "id", "email", "consent", "tags", "attributes", … } }. Store contact.id if you want to call /contacts/{contactId} later; externalId works everywhere too.

What it does:

  • Creates the contact, or updates the one with this externalId. A contact imported from a CSV with the same email is linked, keeping its history.
  • Merges attributes into the contact's custom fields. null removes one. See Custom fields for types and limits.
  • Adds and removes tags with tags.add and tags.remove.
  • Never subscribes anyone and never sends email. New contacts have unknown email consent; an existing opt-out stays.

#2. Subscribe only people who asked

A signup or a purchase is not consent to marketing email. If your signup form has an unticked "Email me product news" box and the person ticks it, add one of these to the same call:

"subscribe": { "method": "double_opt_in", "consentText": "Email me product news" }

HelpWell emails a confirmation link from your support address and subscribes them only when they click it. Needs email marketing (Growth, or a trial); otherwise 402 plan_limit. The answer's subscription.status is confirmation_sent, pending_confirmation (held until email is set up) or received.

"consent": {
  "status": "subscribed",
  "source": "Signup form checkbox",
  "timestamp": "2026-10-05T14:03:00Z",
  "text": "Email me product news"
}

For a choice you already recorded with its time and wording. timestamp is required and cannot be in the future. An existing opt-out always wins (409 opted_out), even when the request supplies a newer timestamp. Any suppressed address is refused (409 suppressed). API updates cannot restore an unsubscribed, bounced or complained address.

To record an opt-out from your own settings page, send "consent": { "status": "unsubscribed", "source": "Account settings" }: marketing email to that address stops at once.

New API contacts without a consent record. A new contact you send without consent or subscribe is recorded as subscribed, with the statement "Added through the REST API" and the time. It never overrides an unsubscribe or a suppression, sends no email, and leaves existing contacts as they are. An owner or admin can turn this off or change the statement by asking an AI assistant connected to HelpWell (Settings → Integrations → AI assistants) to update the marketing consent settings.

#3. Start onboarding with an event

Updating a contact never starts a journey. A new contact raises the journey trigger Contact created with the source REST API, which starts only journeys that tick that source (off by default, so a sync or a backfill starts nothing by accident). To start an onboarding journey on purpose, send an event once the contact exists (Track events):

curl -X POST "$HELPWELL_API_URL/events" \
  -H "Authorization: Bearer $HELPWELL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "productId": "'"$HELPWELL_PRODUCT_ID"'",
  "externalId": "user_123",
  "name": "signed_up",
  "id": "signup-user_123"
}'
// env: your server runtime’s environment (process.env, Deno.env, a Worker’s env).
const response = await fetch(`${env.HELPWELL_API_URL}/events`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    productId: env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    name: 'signed_up',
    id: 'signup-user_123',
  }),
});
const data = await response.json();
if (!response.ok) throw new Error(`HelpWell: ${data.error.code}`);
const response = await fetch(`${process.env.HELPWELL_API_URL}/events`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    productId: process.env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    name: 'signed_up',
    id: 'signup-user_123',
  }),
});
const data = await response.json();
if (!response.ok)
  throw new Error(`HelpWell ${response.status} ${data.error.code}: ${data.error.message} (${data.requestId})`);
import os

import requests

response = requests.post(
    f"{os.environ['HELPWELL_API_URL']}/events",
    headers={
        "Authorization": f"Bearer {os.environ['HELPWELL_API_KEY']}",
    },
    json={
        "productId": os.environ["HELPWELL_PRODUCT_ID"],
        "externalId": "user_123",
        "name": "signed_up",
        "id": "signup-user_123",
    },
    timeout=10,
)
response.raise_for_status()
data = response.json()

#Retries and errors

AnswerWhat to do
Network error, 5xxRetry with backoff and the same Idempotency-Key.
429 rate_limitedWait Retry-After seconds, then retry.
409 conflictThe email belongs to another verified person. Fix the duplicate; it is never merged for you.
400 validation_failedFix the field named in error.details (often a value that does not match a locked field type).
Other 4xxDo not retry unchanged; log error.code and requestId.

#Checklist

  • The key lives only on the server. Search your browser bundle for hwk_: it must not be there.
  • Sign up a test user twice: Contacts shows one contact with your tags and fields, consent unknown (or subscribed, with your statement, when the workspace opts in new API contacts).
  • Tick the email box on a test signup: the confirmation email arrives, and consent turns subscribed only after the click.