What fires an alert
Alerts follow the issue lifecycle and the agent’s health, not individual occurrences:
New channels tick every event. A channel whose
notify_events is unset also receives every event.
More occurrences of an issue that is already open or ignored bump its counters without alerting again. This keeps incident storms from flooding every channel, and keeps “ignored” meaningful: ignoring an issue silences all its future occurrences. resolved is different: a recurrence is treated as a regression, so the agent flips the status back to open and fires issue.reopened. Set NIGHTOWL_REOPEN_COOLDOWN_HOURS (see Configuration → Issue lifecycle) to keep an issue resolved when it recurs within that many hours of being resolved. This helps with flapping issues.
The four channel types
Email (BYO SMTP)
Delivered through your own SMTP server: SendGrid, Postmark, AWS SES, Mailgun, Gmail, or your own relay. See SMTP setup.
Slack
Incoming webhook URL from a Slack app. Each alert lists the issue’s details and a View issue button.
Discord
Channel webhook URL from Discord’s Integrations settings. Each alert is an embed with the issue’s details, linked to the issue.
Webhook
Any HTTP endpoint. JSON payload, with an optional HMAC-SHA256 signature in the
X-NightOwl-Signature header.Jane@Example.com and jane@example.com are the same member. To reach an address that isn’t a person on the team (an on-call alias, a PagerDuty email trigger), invite it to the team first, or route through a Slack, Discord or webhook channel instead.
Alert emails are HTML. The badge shows the event: New Issue for a new exception, Performance Alert for a new performance issue, Reopened for a reopened one, and Resolved or Ignored for a status change. Performance alerts show the duration, the threshold and how far over it the record went. A worker saturation alert shows its concurrency numbers instead. The View issue button opens the issue in the dashboard.
Slack
- In Slack, create an app at api.slack.com/apps → Incoming Webhooks → Add New Webhook to Workspace.
- Copy the webhook URL (starts with
https://hooks.slack.com/services/…). - In Settings → Alerts → Integrations, click Connect on the Slack card, paste the URL, pick the events and click Connect.
Discord
- In Discord, open Server Settings → Integrations → Webhooks → New Webhook, pick the destination channel, and copy the URL.
- Click Connect on the Discord card in Settings → Alerts → Integrations, paste the URL and pick the events.
Webhook
For anything more custom (PagerDuty, OpsGenie, your own incident bot), add a webhook channel in Settings → Alerts → Webhooks with Add webhook: a name, the URL, an optional signing secret, and the events. Every request isPOST with a JSON body. Issue events have this shape:
null. Notes:
- For events the agent sends,
app_idcomes from the agent’sNIGHTOWL_APP_IDandview_urlis built fromNIGHTOWL_DASHBOARD_URL(defaulthttps://usenightowl.com). WithoutNIGHTOWL_APP_ID,app_idisnullandview_urlpoints at/dashboard. WithNIGHTOWL_DASHBOARD_URLempty,view_urlisnull. See agent configuration. messageis truncated to 200 characters, followed by....- Exception events fill
handled,location,php_versionandlaravel_version. Performance events fillroute,threshold_msandduration_ms, and usesubtypeto say what kind of work it was (route,job,command,query, and so on). A worker saturation issue hassubtypeworker_saturationand leavesthreshold_msandduration_msnull; its numbers are inmessage. statusandpriorityare the issue’s state when the alert is sent. A new issue is"open"withprioritynull. When a resolved issue recurs, the agent sets it back to"open"before sendingissue.reopened.typeis always"exception"or"performance".
health.recovered carries the same diagnosis with "status": "resolved". instance identifies the agent process (host and process id). view_url links to the app’s Agent Health page, following the same NIGHTOWL_APP_ID and NIGHTOWL_DASHBOARD_URL rules as above.
Signing
If you set a signing secret on the channel, NightOwl signs each request with HMAC-SHA256 over the raw JSON body:sha256= prefix. Verify by recomputing the digest with your secret and the raw body (before any JSON parsing), then comparing with hash_equals. Reject any request whose signature doesn’t match.
Agent health alerts
When a warning or critical health diagnosis becomes active, the agent sendshealth.degraded to every enabled channel that has Agent health alerts ticked, and health.recovered when it clears. Info-level diagnoses never alert.
- Email subjects read
[<app>] Agent Health: <CODE>and[<app>] Recovered: <CODE>. The body shows the app, the agent instance and the diagnosis message, adds the recommendation on a new alert, and ends with a View agent health button. - Slack and Discord messages end with a View agent health link.
- The link goes to
{NIGHTOWL_DASHBOARD_URL}/dashboard/{NIGHTOWL_APP_ID}/health, or to/dashboardwithoutNIGHTOWL_APP_ID. WithNIGHTOWL_DASHBOARD_URLempty there is no link.
<NIGHTOWL_AGENT_SQLITE_PATH>.alert-channels.json (by default storage/nightowl/agent-buffer.sqlite.alert-channels.json). It saves the list about 5 seconds after it starts, every 15 minutes after that, and each time it loads the list for a health alert. If the database can’t be reached, or doesn’t answer the channel query within 5 seconds, it sends to that saved list and logs Could not read alert channels from the database (...). Using the saved list at <path> (N channels). The file survives restarts. An agent that has never reached the database, with no file left by an earlier run, has no list to fall back on and logs ... and no saved list exists.
Stored secrets and masking
Channel settings, SMTP passwords and webhook secrets included, are stored as plain JSON in thenightowl_alert_channels table in your own database. They are stored that way on purpose, because the agent on your server reads them to send alerts. Anyone who can read that table can read them.
The dashboard and list-alert-channels-tool never show them back in full. A password or signing secret reads ••••••••, and a Slack, Discord or webhook URL keeps only its scheme and host (https://hooks.slack.com/••••••••). When you edit a channel, leave a masked value as it is to keep the stored one; anything you type replaces it.
A stored SMTP password is kept only while the channel points at the same server. If you change an email channel’s host or port, the form clears the password, and when the channel has a username you type the password again before you can save. A masked password sent with a new host or port is refused with Enter the SMTP password again. The host or port changed. Changing only the username keeps the stored password. update-alert-channel-tool follows the same rule.
Testing a channel
There are two ways to test, and they take different paths. Send test in the dashboard. Slack and Discord cards have a Send test button (the paper-plane icon), each webhook row has one, and an email channel has Send Test on its edit page. The test payload is minimal and doesn’t match the real issue schema:- Webhook:
{ "event": "test", "app": "<app name>", "timestamp": "<iso8601>" }. Noissueobject. - Slack / Discord: a “Test Notification” message saying the integration is working.
- Email: a short HTML email with the subject
[<app-name>] NightOwl Test Notification.
test-alert-channel-tool over MCP.
Send test runs on NightOwl’s servers, which only connect to public hosts. A private or local SMTP host, or a webhook URL that isn’t a public http(s) address, is refused there even though the agent could reach it. A passing test proves the credentials and the From: address work from NightOwl’s side. It does not prove that alerts sent by the agent will arrive, because new-issue, reopened and health alerts leave from your own server.
php artisan nightowl:test-alert on your server. Run it in the app where the agent is installed. It sends a test alert through every enabled channel using the agent’s own email, Slack, Discord and webhook clients, and prints PASS or FAIL per channel with the error:
NIGHTOWL_DB_* settings to check.
Toggling and disabling
Channels can be disabled without deleting them. A disabled channel is skipped for every event but keeps its settings, so you can silence it during maintenance without losing the webhook URL or SMTP credentials. Enabling is refused while a channel can’t send anything yet, or while it would email someone who isn’t on the app’s team, with one of these messages:Add a webhook URL before enabling this channel.(Slack or Discord with no URL)Add a URL before enabling this webhook.Add an SMTP host before enabling this channel.Add the SMTP password before enabling this channel.(a username is set but no password)Add a recipient before enabling this channel.(an email channel with no recipients)All recipient emails must belong to team members. Invalid: ...(a recipient who isn’t a member of the app’s team, such as someone who has left it)
No webhook URL. Add one to enable this integration. Add the missing value with the pencil, then turn the channel on. Turning a channel off skips these checks.
Under the hood
Alerts come from two places:- The agent on your server sends
issue.new,issue.reopenedwhen it reopens a resolved issue (subject toNIGHTOWL_REOPEN_COOLDOWN_HOURS), and the two health events. It sends them from your host over its own SMTP and HTTP clients, with no round trip through NightOwl’s API. A channel the agent fails to send to is logged in the agent’s error log. - NightOwl’s API sends
issue.resolved,issue.ignoredand a manualissue.reopenedfrom a queued job whenever someone changes an issue’s status in the dashboard, through MCP or through the API. A bulk action sends one message per issue.