Developers

Guide

Newsletter and form subscriptions

Three ways to collect newsletter signups with consent: a HelpWell form on your page, your own form through the API, or a consent record you already hold.

Pick the one that matches the form you have. All three put the person in Contacts with the source of their consent, and none of them subscribes anyone who did not ask.

HelpWell formYour own formConsent you recorded
Where the form livesEmbedded on your page by HelpWellYour page, your markupAnywhere you already capture opt-in
Who calls HelpWellThe browser, through the widget scriptYour server: POST /forms/submitYour server: POST /contacts with consent
Confirmation emailHelpWell sends it (double opt-in, the default)HelpWell sends it when the form uses double opt-inNone: you vouch for the opt-in
Subscribed whenThey click the confirmation linkThey click the link (or at once with double opt-in off and a ticked box)At once, from your timestamp
Bot protectionBuilt inYours, before you submitYours

#1. A HelpWell form, embedded

Build the form in Outreach → Forms (newsletter, lead magnet, waitlist and more). Each form has a consent checkbox and double opt-in on by default. Put the widget script tag (Settings → Widget → Install) on the page, then place the form where it should appear:

<div data-helpwell-form="newsletter"></div>
<!-- The widget script tag from the Install page, once per page -->

The script draws the form into every element with data-helpwell-form, including ones a single-page app adds later. Submissions appear under the form's results, raise form.submitted (and form.confirmed after double opt-in) for journeys, and only confirmed signups are ever enriched.

#2. Your own form, submitted by your server

Keep your markup and send each submission from your server after your own checks (bot protection, rate limits). HelpWell applies the form's rules as if it were its own: a ticked box gets a confirmation email and the person is subscribed when they click.

curl -X POST "$HELPWELL_API_URL/forms/submit" \
  -H "Authorization: Bearer $HELPWELL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: form-7f3a91" \
  -d '{
  "productId": "'"$HELPWELL_PRODUCT_ID"'",
  "formId": "footer-newsletter",
  "formName": "Footer newsletter",
  "formType": "newsletter",
  "email": "ada@example.com",
  "name": "Ada Lovelace",
  "consent": {
    "state": "granted",
    "text": "Email me product news. Unsubscribe any time."
  },
  "attributes": {
    "company": "Analytical Engines",
    "role": "Founder"
  },
  "page": {
    "url": "https://example.com/blog/launch"
  },
  "utm": {
    "source": "newsletter",
    "campaign": "october"
  }
}'
// env: your server runtime’s environment (process.env, Deno.env, a Worker’s env).
const response = await fetch(`${env.HELPWELL_API_URL}/forms/submit`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'form-7f3a91',
  },
  body: JSON.stringify({
    productId: env.HELPWELL_PRODUCT_ID,
    formId: 'footer-newsletter',
    formName: 'Footer newsletter',
    formType: 'newsletter',
    email: 'ada@example.com',
    name: 'Ada Lovelace',
    consent: {
      state: 'granted',
      text: 'Email me product news. Unsubscribe any time.',
    },
    attributes: { company: 'Analytical Engines', role: 'Founder' },
    page: { url: 'https://example.com/blog/launch' },
    utm: { source: 'newsletter', campaign: 'october' },
  }),
});
const data = await response.json();
if (!response.ok) throw new Error(`HelpWell: ${data.error.code}`);
const response = await fetch(`${process.env.HELPWELL_API_URL}/forms/submit`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'form-7f3a91',
  },
  body: JSON.stringify({
    productId: process.env.HELPWELL_PRODUCT_ID,
    formId: 'footer-newsletter',
    formName: 'Footer newsletter',
    formType: 'newsletter',
    email: 'ada@example.com',
    name: 'Ada Lovelace',
    consent: {
      state: 'granted',
      text: 'Email me product news. Unsubscribe any time.',
    },
    attributes: { company: 'Analytical Engines', role: 'Founder' },
    page: { url: 'https://example.com/blog/launch' },
    utm: { source: 'newsletter', campaign: 'october' },
  }),
});
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']}/forms/submit",
    headers={
        "Authorization": f"Bearer {os.environ['HELPWELL_API_KEY']}",
        "Idempotency-Key": "form-7f3a91",
    },
    json={
        "productId": os.environ["HELPWELL_PRODUCT_ID"],
        "formId": "footer-newsletter",
        "formName": "Footer newsletter",
        "formType": "newsletter",
        "email": "ada@example.com",
        "name": "Ada Lovelace",
        "consent": {
            "state": "granted",
            "text": "Email me product news. Unsubscribe any time.",
        },
        "attributes": {"company": "Analytical Engines", "role": "Founder"},
        "page": {"url": "https://example.com/blog/launch"},
        "utm": {"source": "newsletter", "campaign": "october"},
    },
    timeout=10,
)
response.raise_for_status()
data = response.json()
  • consent.state: granted (they ticked the box), denied (they left it clear) or none (no box). A sign-up form type (newsletter, lead_magnet, waitlist, webinar, coupon, giveaway, exit_offer) without a box counts as asking.
  • fields holds the answers as typed (kept with the submission); attributes become contact fields.
  • The answer is 201 with submission.status: confirmation_sent, pending_confirmation, subscribed or received (nothing to subscribe).
  • Send externalId too when the person is signed in, so the submission joins their contact.

When people opt in somewhere HelpWell does not see (a checkout page, an event badge scan, a CRM), record it on the contact with its source, time and wording:

curl -X POST "$HELPWELL_API_URL/contacts" \
  -H "Authorization: Bearer $HELPWELL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: optin-user_123-20261005" \
  -d '{
  "productId": "'"$HELPWELL_PRODUCT_ID"'",
  "externalId": "user_123",
  "email": "ada@example.com",
  "consent": {
    "status": "subscribed",
    "source": "Checkout page checkbox",
    "timestamp": "2026-10-05T14:03:00Z",
    "text": "Email me product news"
  }
}'
// 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': 'optin-user_123-20261005',
  },
  body: JSON.stringify({
    productId: env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    email: 'ada@example.com',
    consent: {
      status: 'subscribed',
      source: 'Checkout page checkbox',
      timestamp: '2026-10-05T14:03:00Z',
      text: 'Email me product news',
    },
  }),
});
const data = await response.json();
if (!response.ok) throw new Error(`HelpWell: ${data.error.code}`);
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': 'optin-user_123-20261005',
  },
  body: JSON.stringify({
    productId: process.env.HELPWELL_PRODUCT_ID,
    externalId: 'user_123',
    email: 'ada@example.com',
    consent: {
      status: 'subscribed',
      source: 'Checkout page checkbox',
      timestamp: '2026-10-05T14:03:00Z',
      text: 'Email me product news',
    },
  }),
});
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']}/contacts",
    headers={
        "Authorization": f"Bearer {os.environ['HELPWELL_API_KEY']}",
        "Idempotency-Key": "optin-user_123-20261005",
    },
    json={
        "productId": os.environ["HELPWELL_PRODUCT_ID"],
        "externalId": "user_123",
        "email": "ada@example.com",
        "consent": {
            "status": "subscribed",
            "source": "Checkout page checkbox",
            "timestamp": "2026-10-05T14:03:00Z",
            "text": "Email me product news",
        },
    },
    timeout=10,
)
response.raise_for_status()
data = response.json()

Use this only for a real, recorded choice. Never fake a timestamp or a source: the consent record is what you show if anyone asks how a person was subscribed. Every consent change made with a key is in the audit log.

#Existing contacts in bulk

To record consent for contacts you already have (a list that opted in before you moved to HelpWell, say), send them all at once with POST /contacts/consent: by contactIds, emails or a saved segmentId, with the source where they agreed. It never subscribes anyone who unsubscribed, bounced, complained or is suppressed (they are skipped and counted), and it starts no journey unless you send "startAutomations": true.

curl -X POST "$HELPWELL_API_URL/contacts/consent" \
  -H "Authorization: Bearer $HELPWELL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: consent-backfill-2026-10" \
  -d '{
  "segmentId": "seg_123",
  "status": "subscribed",
  "source": "Existing customer, opted in at signup",
  "expected": 10327
}'
// env: your server runtime’s environment (process.env, Deno.env, a Worker’s env).
const response = await fetch(`${env.HELPWELL_API_URL}/contacts/consent`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'consent-backfill-2026-10',
  },
  body: JSON.stringify({
    segmentId: 'seg_123',
    status: 'subscribed',
    source: 'Existing customer, opted in at signup',
    expected: 10327,
  }),
});
const data = await response.json();
if (!response.ok) throw new Error(`HelpWell: ${data.error.code}`);
const response = await fetch(`${process.env.HELPWELL_API_URL}/contacts/consent`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.HELPWELL_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'consent-backfill-2026-10',
  },
  body: JSON.stringify({
    segmentId: 'seg_123',
    status: 'subscribed',
    source: 'Existing customer, opted in at signup',
    expected: 10327,
  }),
});
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']}/contacts/consent",
    headers={
        "Authorization": f"Bearer {os.environ['HELPWELL_API_KEY']}",
        "Idempotency-Key": "consent-backfill-2026-10",
    },
    json={
        "segmentId": "seg_123",
        "status": "subscribed",
        "source": "Existing customer, opted in at signup",
        "expected": 10327,
    },
    timeout=10,
)
response.raise_for_status()
data = response.json()

Up to 1,000 contacts finish in the request (200); a larger change runs in the background (202): read its progress with GET /contacts/consent/{jobId}. expected refuses the change (409 selection_changed) if the selection no longer has that many contacts. In the app, the same change is Contacts → Select all → Set marketing consent.

#Unsubscribes

Every marketing email has a one-click unsubscribe link that HelpWell handles. To mirror an opt-out from your own preferences page, send "consent": { "status": "unsubscribed", "source": "Preferences page" } with POST /contacts. See also Send signups from your app.