What you need
- A backend where sign-ups happen. The examples are Express, a Next.js route handler and Django; any language works, since it’s one HTTP request.
- An Ahem account (the free plan is enough), a project for your app, and an API key for it.
- The Ahem app on your phone, or browser notifications turned on.
Step by step: a notification for every new user sign-up
Create a project and a key. In Ahem, create a project for your app and an API key for it. Note the project’s address: addresses are unique across Ahem, so yours may be
my-app-48213rather thanmy-app. The app shows it in the example request next to the key. Put both in your server’s environment:AHEM_KEY=ak_live_… AHEM_PROJECT=my-app-48213 # your project's addressAdd a small helper (Node 18 or later; for Django, skip to the next step):
// ahem.js: tells Ahem about a new sign-up. An ES module (in a CommonJS project, name it ahem.mjs). const TIME_ZONE = 'America/Toronto' // yours: sign-ups between 22:00 and 07:00 here arrive silent function isNight() { const hour = Number(new Intl.DateTimeFormat('en-US', { hour: 'numeric', hourCycle: 'h23', timeZone: TIME_ZONE }).format(new Date())) return hour >= 22 || hour < 7 } /** Never throws and never takes more than 5 seconds: a notification must not break a sign-up. */ export async function notifySignup(user) { try { const response = await fetch(`https://api.useahem.com/v1/channels/${process.env.AHEM_PROJECT}/signups`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.AHEM_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ title: `New sign-up: ${user.name || user.email || user.id}`, type: 'user.registered', level: 'success', user: { id: String(user.id), email: user.email, name: user.name }, notify: isNight() ? 'silent' : 'default', }), signal: AbortSignal.timeout(5000), }) if (!response.ok) console.error(`Ahem refused the sign-up event: ${response.status} ${await response.text()}`) } catch (error) { console.error(`Could not reach Ahem: ${error.message}`) } }The new user goes in
user, which files the event under that person in Ahem. It gives up after 5 seconds and never throws, andnotifyissilentat night in your time zone.Call it once the user is saved. Not before: a sign-up that fails halfway must not buzz your phone.
import express from 'express' import { notifySignup } from './ahem.js' const app = express() app.use(express.json()) app.post('/signup', async (req, res) => { const user = await createUser(req.body) // your code: validate and save the user res.status(201).json({ id: user.id }) notifySignup(user) // after the answer is sent, so the sign-up never waits for it }) app.listen(3000)// app/api/signup/route.ts import { after } from 'next/server' import { notifySignup } from '@/lib/ahem' export async function POST(request: Request) { const user = await createUser(await request.json()) // your code: validate and save the user // after() runs once the response is sent, and keeps a serverless function alive until it's done. after(() => notifySignup(user)) return Response.json({ id: user.id }, { status: 201 }) }# yourapp/signals.py. Load it in yourapp/apps.py: def ready(self): from . import signals import json import logging import os import urllib.error import urllib.request from datetime import datetime from zoneinfo import ZoneInfo from django.conf import settings from django.db import transaction from django.db.models.signals import post_save from django.dispatch import receiver log = logging.getLogger(__name__) TIME_ZONE = ZoneInfo("America/Toronto") # yours: sign-ups between 22:00 and 07:00 here arrive silent @receiver(post_save, sender=settings.AUTH_USER_MODEL) def user_saved(sender, instance, created, **kwargs): if created: # Only once the sign-up is committed: a rolled-back sign-up sends nothing. transaction.on_commit(lambda: notify_signup(instance)) def notify_signup(user): try: # a notification must never break a sign-up, whatever goes wrong here email = getattr(user, "email", None) name = user.get_full_name() if hasattr(user, "get_full_name") else None hour = datetime.now(TIME_ZONE).hour event = { "title": f"New sign-up: {name or email or user.pk}", "type": "user.registered", "level": "success", "user": {"id": str(user.pk), "email": email, "name": name or None}, "notify": "silent" if hour >= 22 or hour < 7 else "default", } request = urllib.request.Request( f"https://api.useahem.com/v1/channels/{os.environ['AHEM_PROJECT']}/signups", data=json.dumps(event).encode(), headers={"Authorization": f"Bearer {os.environ['AHEM_KEY']}", "Content-Type": "application/json"}, ) urllib.request.urlopen(request, timeout=5).close() except urllib.error.HTTPError as error: log.warning("Ahem refused the sign-up event: %s %s", error.code, error.read().decode()) except Exception as error: log.warning("Could not tell Ahem about the sign-up: %r", error)In Express the request goes out after
res.json(), so the user doesn’t wait for it. In Next.js,after()(stable since Next.js 15.1) does the same, and keeps a serverless function running until the request is done. In Django, apost_savesignal catches every new user, however it was created, andtransaction.on_commitwaits until the sign-up is saved for good.Sign up once yourself. Your phone shows “New sign-up: …”, and the person appears under People in Ahem.
Make it quieter: silent at night, loud when it matters
- Silent at night. The helper sends
"notify": "silent"between 22:00 and 07:00 inTIME_ZONE. A silent event is stored like any other and never buzzes. Quiet hours set in the app, which still let errors through, are coming Soon. - Loud for the ones that matter.
"loud"buzzes even on a channel set to errors only (never on one you switched off), so a big customer gets through while ordinary sign-ups stay quiet:notify: user.plan === 'business' ? 'loud' : isNight() ? 'silent' : 'default', - Or no buzz at all. Set
#signupsto Off in the app and add a counter ofuser.registeredfor today and this week to the project overview instead. - A burst of sign-ups as one notification (“9 new sign-ups” instead of 9 pushes) is coming Soon.
Follow each new user from here
Because the event carries user.id, everything else you send about that person, such as an upgrade, a failed payment or their feedback, lands on the same user timeline. Where they came from fits in properties_once, which fills a detail only the first time (see People in the API reference):
user: {
id: String(user.id),
email: user.email,
name: user.name,
properties_once: { signed_up_with: 'google', referrer: 'producthunt' },
},Person details are kept on Maker; on Free they’re accepted and not stored, and the timeline works on every plan.
Troubleshooting
- Sign-ups got slower. The request is awaited before the answer. Send it after the response, as above. Django’s
on_commitstill runs inside the request; on a busy site, handnotify_signupto your task queue (Celery, RQ) instead. - Nothing arrives from a serverless function. On Vercel or Lambda, a request started without
awaitis cut off when the function returns. Useafter()in Next.js, orwaitUntilwhere your platform has it. - A notification for a sign-up that failed. The event was sent before the user was saved, or inside a transaction that rolled back. Send it after the insert, and in Django keep
on_commit. - The log says
Ahem refused the sign-up event: 404 …AHEM_PROJECTmust be your project’s exact address, and the key must belong to that project. A401is a wrong or missing key. - Bots signing up all night. Each one is an event. Send the event when the email address is confirmed instead of at sign-up, and the bots stay out of your inbox.
A note on privacy: the title shows on your lock screen, and the email address you send is your user’s personal data, kept in Ahem. Say so in your privacy policy, or send only the id. You can erase a person and all their events in Ahem at any time.
Other ways to do it
- Email yourself from the sign-up code. Free, and it works until the sign-up emails get lost among the rest.
- A Slack incoming webhook into a
#signupschannel. Free and good for a team; a busy channel ends up muted. - Your auth service’s webhook. If sign-ups happen in a service such as Clerk or Auth0, use its webhook or post-sign-up hook for new users, and send the same request from there.
- Product analytics counts sign-ups on a chart, but doesn’t tell you about each one as it happens.
- A Telegram bot. Free and on your phone, with every app in one chat. See Ahem vs a Telegram bot.
What Ahem adds: sign-ups in their own channel next to payments and errors, silent or loud per event, a counter for the week, and a timeline for every person. For payments, failed jobs and anything else, it’s the same request from any script.