Team Alerts

Designing alert types

Build the forms: field types, the special title, body and status fields, what is validated, and how to retire a type.

An alert type is a form. This page is for the people who build those forms — hotline admins and dashboard admins. It covers where the editor lives, what each field type is for, the two field names the rest of the app treats specially, what the app checks and what it does not, and how to retire a type you no longer want. It ends with a worked example you can copy.

If you have not read Team Alerts, start there — it explains how types and alerts relate.

One type per kind of request

An alert type answers the question what do we need to know when somebody asks for this? Make one type for each distinct kind of request your hotline handles, not one per situation and not one for everything.

Good: Accompaniment Request, Court Support, Attorney Call-Out. Each has a different set of things the responder needs to know.

Not good: a single Alert type with fifteen optional fields, ten of which are blank every time. If half your fields are irrelevant to half your alerts, you have two types.

Types belong to one hotline. Two hotlines that both need accompaniment requests each get their own type, and they can differ.

Getting there

Open the Admin menu in the dashboard header and choose Team Alerts. That is the cross-hotline alert list; the Alert types button in its filter row takes you the rest of the way. The direct URL is:

/d/alert-types

The Admin menu appears for anyone who can view team alerts, which is everybody — operators and attorneys included. Alert types themselves are admin-only, so pressing Alert types without the permission gets you a 403 rather than the list. See Who can do this.

The list shows every alert type across every hotline, with filters for hotline, active state, and a search over the name and slug.

Creating a type

From /d/alert-types, press New alert type, or go straight to /d/alert-types/new. You supply three things:

  • Hotline (required) — which hotline this type belongs to. It cannot be moved later.
  • Name (required) — what senders will see in the type picker, and what recipients see in their notification. Write it the way your team says it: Accompaniment Request, not accomp_req.
  • Description (optional) — shown above the form when somebody fills it in. Use it for the one sentence a sender needs before they start typing: who this is for, or what to do instead if this is not the right form.

A URL-safe slug is generated from the name automatically, and made unique within the hotline if it collides. You never have to think about it.

Saving takes you straight to the schema editor with an empty form.

Designing the form

The editor is at /d/alert-types/<uuid>/edit. Fields are listed on the left, a live preview of the form your senders will see is on the right. + Add field adds one to the bottom; the arrows on each field move it up and down; Save schema writes the whole form at once.

Nothing is saved until you press Save schema. If the button is disabled, there is a validation error on one of the fields — the message is printed under the offending field, in red.

The five field types

Type Use it for Extra options
text A single-line answer: a location, a name, a time Max length
textarea A paragraph: what happened, what is needed Max length
select One choice from a fixed list: language, precinct, urgency Options — at least one, one per line
checkbox A yes/no: transportation needed, minor involved none
number A count or quantity: how many people, how many hours Min, Max

Every field, whatever its type, has four settings in common.

Name versus label

Each field has two names, and the difference matters.

  • Name (key) is the internal identifier. It must match ^[a-z][a-z0-9_]*$ — lowercase, starting with a letter, digits and underscores allowed. It must be unique within the type. Nobody sending an alert ever sees it.
  • Label is what humans read: the text above the box on the form, in the email, and on the PDF. Write it in plain words with normal capitalization.

So meeting_location is the name and Meeting location is the label.

Required

Ticking Required means the sender cannot submit the form without answering this field. For a checkbox, "required" means the box must be ticked, which is usually only what you want for a confirmation ("I have confirmed the address").

Be sparing. A required field that a sender genuinely cannot answer at 2am — because they simply do not know yet — turns into a field full of unknown.

Help text

Optional, and it does more work than it looks like it does. Help text shows up in three places: as the greyed-out placeholder inside the box, as a small line underneath the box, and — for checkboxes — as the text next to the box itself. A checkbox with no help text renders with nothing beside it, so always give checkboxes help text.

Order

Fields render in the order they appear in the editor, everywhere: the send form, the alert detail page, the email, and the PDF. Put the fields a responder reads first at the top.

The special field names: title, body, and status

This is the single most important thing on this page.

Two field names are treated specially by the rest of the app:

  • A field named title is used as the row heading everywhere alerts are listed, and as the heading on the alert's own page.
  • A field named body is used as the one-line preview under that heading in the cross-hotline alert list.

Nothing enforces this and nothing warns you about it. If your type has no field named title, every alert of that type shows up in the list as (untitled), and your team has to open each one to find out what it is.

So: give every alert type a field whose name is exactly title. Its label can be anything — Subject, What is needed, Who needs support — and it can be any text type. Only the name has to be title. Make it required, and put it first.

A body field is optional but worth having. Make it the textarea where the sender describes the situation, and the alert list gets a useful preview line for free.

status — the progress tracker

A select field named status turns into a progress tracker across the top of the alert's page: the pizza-delivery bar, one segment per option, with the finished stages ticked off and the current one highlighted.

Your options are the stages, and their order is the sequence. Everything above the current answer reads as done, everything below it as still to come. So write them in the order the work actually happens:

Received
Dispatched
On scene
Cleared

Not alphabetically, and not by importance. Cleared, Dispatched, On scene, Received describes the same four stages and draws a tracker that lies about every one of them.

A few things worth knowing:

  • The tracker replaces the ordinary row for this field — the answer is shown once, in the bar, not twice.
  • It is a picture, not a control. Advancing an alert means editing it and changing the answer, the same as any other field.
  • Only a field named exactly status does this, and names are unique, so a type has at most one tracker. A select named stage or progress stays an ordinary field.
  • If you rename an option after alerts exist, alerts still answered with the old wording match no stage. The tracker shows every stage as upcoming and the old answer stays visible in the field list below, so nothing is lost — but Field names are permanent applies to option wording too.

status is optional. Add it for work that moves through stages a responder would otherwise have to ask about; skip it for a type that is a one-shot request.

Field names are permanent

Answers are stored against the field name, not the label. Renaming a field after alerts exist does not migrate anything — the values already recorded on past alerts stay filed under the old name, and stop appearing on those alerts.

The UI will let you do this and will not warn you.

In practice:

  • Renaming a label is always safe. Change Meeting location to Where to meet freely; past alerts are unaffected.
  • Renaming a name is not. Treat the name as permanent from the moment the first alert is sent.
  • Deleting a field hides its past answers the same way. The data is still in the database, but no screen will show it.
  • Adding a field is always safe. Past alerts simply have no answer for it, and it shows blank.

If you must restructure a live type, it is usually cleaner to deactivate it and create a new one.

What is checked, and where

The editor validates the form's design thoroughly. The app validates a sender's answers very little. Be aware of the gap when you design.

Rule Checked in the editor Checked in the browser when sending Checked on the server
Field name matches ^[a-z][a-z0-9_]*$ Yes — No
Field names are unique Yes — No
Label is present Yes — No
A select has at least one option Yes — No
Min is not greater than Max Yes — No
At least one field exists Yes — No
Required field is answered — Yes Yes
Max length — Yes No
Min / Max on a number — Yes No
Answer is one of a select's options — Yes No

Read the last four rows carefully. Max length, Min, Max, and the option list are enforced by the browser only. They are real guardrails for somebody filling in the form normally, and they are the right thing to set — but they are hints, not guarantees. Anything reaching the API directly can store a number outside your range or a value outside your list. Design so that a slightly out-of-range answer is a nuisance, not a disaster.

Retiring a type

Two options, and only one of them usually works.

Deactivate it. An inactive type disappears from the type picker on the send form and from the type filter on the alert list, while every past alert keeps working — its answers still display, its PDF still exports. This is the right way to retire a type.

Delete it. Only possible if no alerts reference the type. The confirmation page at /d/alert-types/<uuid>/delete counts them and, if there are any, shows a Blocked: notice and disables the delete button. In practice this means you can only delete a type you created by mistake and never used.

One gap to know about: the active state is shown and filterable on /d/alert-types, but there is no button in the dashboard to flip it. Until there is, deactivating a type has to be done through the Django admin or the API.

Blank PDFs for field teams

From the schema editor, Blank PDF exports the form with every field empty at:

/d/alert-types/<uuid>/blank.pdf

Each field becomes a box that can be typed into in a PDF reader and printed and written into by hand. It is a useful thing to hand somebody heading somewhere without reliable signal: they fill in the paper copy, and whoever is at a laptop enters it afterwards.

Since it is only an export, anybody who can view alert types can download one — you do not need edit rights.

Who can do this

From the roles shipped with the app:

Role Alert types Alerts
operators View Create, edit, delete, view
Attorneys View Create, edit, view
hotline_admins Create, edit, delete, view Create, edit, delete, view
dashboard_admins Create, edit, delete, view Create, edit, delete, view

Everything under /d/alert-types enforces these. Note that sending an alert from a hotline workspace at /h/<slug>/alerts/new currently checks only that you are attached to that hotline — so treat hotline membership, rather than the table above, as what actually gates sending.

A worked example

An accompaniment request: somebody needs another person with them at a check-in appointment. Here is the whole type, field by field.

Type: name Accompaniment Request, hotline Northside Hotline, description For requests to accompany a community member to an appointment. For anything happening right now, call the hotline instead.

Name Label Type Required Help text
title Who needs accompaniment text Yes First name or initials — no full names
body What is happening textarea Yes Where they need to go, and why
location Meeting location text Yes Street address or nearest intersection
meet_at Meet at text Yes Date and time to be there, e.g. Tue 14 Oct, 8:30am
language Language needed select Yes Options: English, Spanish, Mandarin, Other
interpreter Interpreter required checkbox No Tick if an interpreter needs to come too
people_needed People needed number Yes How many accompaniers, 1 to 6

people_needed has Min 1 and Max 6. title has Max length 80 to keep list rows readable.

Note the first two rows: the field a sender thinks of as "who needs accompaniment" is named title, so alerts of this type list themselves by the person's initials rather than as (untitled), and "what is happening" is named body, so the cross-hotline list shows a preview of the situation.

Saved, that is the following form definition — visible in the editor under Wire format (JSON) if you want to check your work:

{
  "title": {
    "type": "text",
    "label": "Who needs accompaniment",
    "required": true,
    "order": 0,
    "help_text": "First name or initials — no full names",
    "max_length": 80
  },
  "body": {
    "type": "textarea",
    "label": "What is happening",
    "required": true,
    "order": 1,
    "help_text": "Where they need to go, and why"
  },
  "location": {
    "type": "text",
    "label": "Meeting location",
    "required": true,
    "order": 2,
    "help_text": "Street address or nearest intersection"
  },
  "meet_at": {
    "type": "text",
    "label": "Meet at",
    "required": true,
    "order": 3,
    "help_text": "Date and time to be there, e.g. Tue 14 Oct, 8:30am"
  },
  "language": {
    "type": "select",
    "label": "Language needed",
    "required": true,
    "order": 4,
    "options": ["English", "Spanish", "Mandarin", "Other"]
  },
  "interpreter": {
    "type": "checkbox",
    "label": "Interpreter required",
    "required": false,
    "order": 5,
    "help_text": "Tick if an interpreter needs to come too"
  },
  "people_needed": {
    "type": "number",
    "label": "People needed",
    "required": true,
    "order": 6,
    "help_text": "How many accompaniers",
    "min": 1,
    "max": 6
  }
}

Once it is saved, anybody on the Northside Hotline can send one — see Sending an alert.

Previous
Team Alerts