Guide
Track events
Send the moments that matter, such as trial_started or project_created, to start journeys and branch on what people did.
An event is something a person did in your app. Journeys start on events ("An event from your app", narrowed by name), and journey conditions can ask whether, and how often, it happened.
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": "project_created",
"id": "project-981",
"data": {
"template": "blank",
"collaborators": 2
}
}'// 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: 'project_created',
id: 'project-981',
data: { template: 'blank', collaborators: 2 },
}),
});
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: 'project_created',
id: 'project-981',
data: { template: 'blank', collaborators: 2 },
}),
});
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": "project_created",
"id": "project-981",
"data": {"template": "blank", "collaborators": 2},
},
timeout=10,
)
response.raise_for_status()
data = response.json()#Naming
- A letter, then letters, digits,
_,.,:or-, at most 80 characters. Use past-tensesnake_case:signed_up,trial_started,subscription_upgraded,invited_teammate. - Names that start with
stripe,email,billing,form,contact,journey,segment,date,manual,ticket,customer,helpwellorproactivefollowed by.,_,:or-are reserved (400 reserved_event): HelpWell and verified providers raise those. - These product names HelpWell already knows are recorded as themselves:
page.visited,login.succeeded,login.failed,contact.updated,ticket.rated,ticket.unresolved,chat.answer_rated,article.viewed,article.rated,search.failed,survey.answered,roadmap.idea,roadmap.voted,roadmap.shipped,changelog.viewed. Any other name is a custom event.
#Rules
- The contact must exist: send
POST /contactsfirst (404 contact_not_foundotherwise). Name them with one ofexternalId,contactId,sourceIdoremail. idis a stable id for this occurrence (project-981). A repeat is recorded once and answered200with"duplicate": trueinstead of201. Withoutid, theIdempotency-Keydoes the same.datais a flat JSON object, at most 50 keys and 8 KB. Journey conditions read it asevent.<key>, and journey webhooks pass it on.- Events can start active journeys and send their email. Keep journeys paused while you test.
#Using events
- Journeys (Journeys → New journey → trigger "An event from your app"): pick the event name, add filters on
event.<key>. - Journey conditions (If/else, Only if, goals): "
project_createdhappened", "did not happen", "happened at least 3 times in the last 7 days". - Settings → Fields and events → Events shows every event name with its last seven days.
For signups, send signed_up right after the contact upsert (Send signups from your app).