﻿# Notification channels and templates

> WorkSmartHub notifies users about events, for example when a ticket's status changes, when they are assigned to a ticket, or when their personal access token is about to expire. Notifications are sent through notification channels (értesítési csatornák): e-mail, Slack or Microsoft Teams.

Source: https://workwise-solutions.net/docs/features/notifications/ · Language: en · Hungarian version: https://workwise-solutions.net/hu/docs/features/notifications/

WorkSmartHub notifies users about events, for example when a ticket's status changes, when they are assigned to a ticket, or when their personal access token is about to expire. Notifications are sent through **notification channels** (*értesítési csatornák*): e-mail, Slack or Microsoft Teams.

E-mails to **clients** (ticket registration, delay, delivery, invoices) and some system e-mails (password reset, new-user details, low-stock and service-user warnings, inactivity reminders) do not use channels: they go through the SMTP server in `EmailSettings` of `appsettings.json` ([Configuration](https://workwise-solutions.net/docs/installation/configuration/)).

## Two levels

| Level | Menu | Who manages | Used by |
|---|---|---|---|
| Workspace | **Adminisztráció → Értesítési Csatornák** | *Értesítési Csatorna Admin* role in the workspace | Tickets of that workspace |
| Application | **Alkalmazás → App Értesítési Csatornák** | Application permission *Notification channel admin* | Tickets of every workspace; personal access token expiry warnings |

Who can open the application-level page is described on [Permissions and roles](https://workwise-solutions.net/docs/permissions-and-roles/#pages-that-standard-users-can-be-allowed-to-see).

![Workspace notification channels](https://workwise-solutions.net/docs/images/notifications-workspace.png)
*The channels of the Szerviz workspace. The Státusz column shows whether the channel can connect; the refresh icon checks it again.*

![Application notification channels](https://workwise-solutions.net/docs/images/notifications-app.png)
*Application-level channels are available in every workspace.*

## Creating a channel

**Új csatorna hozzáadása** (Add channel) opens the dialog. Choose the **Típus** (Type), give a **Név** (Name) and an optional **Leírás** (Description), then fill in the settings of the type. **Teszt** checks the connection before saving.

### E-mail

![E-mail channel settings](https://workwise-solutions.net/docs/images/notifications-email-edit.png)
*An e-mail channel. The password is not shown; tick Jelszó módosítása to change it.*

| Field | Notes |
|---|---|
| Smtp host, Smtp port | The SMTP server. Use the STARTTLS port (usually 587); implicit TLS (port 465) is not supported. |
| Biztonságos kommunikáció (SMTPS) használata | Use an encrypted connection. With it on, the test switches to STARTTLS and checks the server certificate before sending the user name and password. Without it, the test does not send the password and does not test authentication, and says so. |
| Smtp felhasználó, Smtp jelszó, Smtp felhasználó domain | The channel always signs in with a user name and password; the Windows identity of the service is never used. |
| Smtp időtúllépés (másodperc) | Timeout in seconds. |
| Emailről, Névvel | Sender address and name. |
| Ne ellenőrizze a hitelesítési adatokat | Skip the credential check (SSL servers only). |

### Slack

Enter the **Bot User OAuth Access Token** of a Slack app with the `chat:write` scope, and a request timeout. The dialog links to the built-in guide; see [Setting up Slack and Microsoft Teams](https://workwise-solutions.net/docs/guides/slack-and-teams/).

### Microsoft Teams

Enter the **Application (client) ID** and the **Bot AppPassword** (client secret) of an Azure Bot registration, the **Link a Teamhez** (link to the team), and a request timeout.

![Teams channel dialog](https://workwise-solutions.net/docs/images/notifications-create.png)
*Adding a Teams channel. The link at the top opens the built-in setup guide.*

### Secrets

Passwords, tokens and secrets are **write-only**. After saving they are never shown again, and leaving the field empty keeps the stored value. When you change where the secret is sent (for example the SMTP host or port, or the channel type) or turn SSL off, you must enter the secret again in the same save. Testing an edited channel needs the secret again too.

## Who receives notifications

Notifications about a ticket go through the channels added to that ticket (**Értesítési beállítások** in the ticket editor), to:

- the users assigned to the ticket, and the members of the assigned groups;
- the workspace admins of the ticket's workspace;
- for an assignment change, both the old and the new assignees.

Each user decides on their **Profil** page where they want to be reached: the e-mail address, the Slack user name and the Teams e-mail, each with a *Ne küldj nekem…* (Do not send me…) switch. An empty field means no notification on that channel ([Profile and password](https://workwise-solutions.net/docs/features/profile-and-password/)). E-mail notifications contain an *unsubscribe from all emails* link that turns off e-mails for that user.

A ticket without channels sends no notifications to users. Client e-mails are sent regardless.

![How notifications and e-mails are sent](https://workwise-solutions.net/docs/images/diagram-notification-flow-en.png)
*Ticket events go out through the ticket's notification channels; client and system e-mails go through the SMTP server of appsettings.json.*

## Templates

The texts of the e-mails and notifications are Razor templates (`.cshtml` files). There is no editor in the user interface: an operator edits the files on the server.

- Default templates ship in `wwwroot/DefaultEmailTemplates` and `wwwroot/DefaultNotificationTemplates`.
- At start-up they are copied to the live folders `LiveEmailTemplates` and `LiveNotificationTemplates` (under `data/` if that folder exists, otherwise under `wwwroot/`; in Docker this is the data volume). Missing templates are added. A live template that is identical to an earlier default is replaced with the new default; an edited template is never overwritten.
- An edited live template is used from its next use, without a restart.

| E-mail templates (SMTP from appsettings) | Notification templates (per channel type: Email_, Slack_, Teams_) |
|---|---|
| TicketRegistrationConfirm, TicketDelay, DeliveryPresenceInformation (to clients) | TicketStatusChanged |
| TicketHasNotChange (inactivity reminder) | TicketAclChanged (assignees changed) |
| ComponentQuantity (low stock) | PatExpiration (token expiry) |
| ServiceUserCatalogWarning | InvoiceOverdue |
| ResetPassword, UserCreatedDetails | |

![Overdue invoice notification](https://workwise-solutions.net/docs/images/notifications-invoice-overdue.png)
*An e-mail made from the InvoiceOverdue template: invoice, client, amount still due, payment deadline and ticket.*

Keep a copy of edited templates before upgrades and before recreating containers ([Upgrading, backup and restore](https://workwise-solutions.net/docs/installation/upgrade-backup-restore/)).
