Synology Chat smart home integration, free and open source

Unofficial: send Synology Chat messages from scenes, start scenes from the chat.
Unofficial external integration, not affiliated with Synology. It does two things:
- Gladys → chat: your scenes post a message in a Synology Chat channel, through an incoming webhook of the NAS;
- chat → Gladys: a message typed in Synology Chat (trigger word of an outgoing webhook, slash command or message to a bot) starts a Gladys scene. This direction goes through the Gladys Plus webhooks: without Gladys Plus, only sending works, and the status of the integration says so.
Written after the official Synology help "Using Integration in Synology Chat". It has never been tested with a real NAS: only against a fake server that follows this help. Your feedback is welcome.
1. Sending messages from scenes
- In Synology Chat, click your profile picture > Integration > Incoming Webhooks > Create, pick the
channel, then copy the Webhook URL. It looks like
https://nas:5001/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=%22…%22. - In Gladys, on the integration page, paste it in Incoming webhook URL. This URL lets anyone who knows it post in the channel: it is kept by Gladys in its database, never shown again, sent only to your NAS, and the integration writes it in no log nor status.
- Click Send a test message.
- In a scene, add the action Send a Synology Chat message and write the text; scene variables (
{{…}}) are allowed.
Sending rules:
- At most 2000 characters (beyond, the text is cut and ends with "…"); control characters are removed; links
follow the Synology Chat syntax (
<https://example.com|click here>). - One message at a time, at least one second between two; at most 10 messages waiting. A message that could not leave within 15 seconds is dropped ("Nothing sent").
- When the NAS answers HTTP 429 or 5xx, no message is sent for 1 minute, then 2, 4… up to 1 hour when it happens
again (longer when the NAS asks for it with
Retry-After, 6 hours at most). This pause is kept in/dataand survives a restart; the test button waits for it too. A message accepted resets it, and a new URL or a new fingerprint lifts it (it was the previous target's). After a 5xx the publication is not confirmed: a proxy (502, 504) may answer so after the message was posted. - The integration never sends a message twice. When the NAS does not answer after receiving the request, the scene action fails with "Message sent, without confirmation": look at the channel before sending it again.
- A redirection of the NAS is never followed (the URL holds the token): use the address and port Synology Chat shows.
Certificate of the NAS
The URL normally starts with https://. Before writing a single byte (the path of the request holds the token),
the integration checks the certificate the NAS shows:
- certificate signed by an authority (a free certificate DSM obtained for your domain name) and valid for the name of the URL: nothing to do, leave Certificate fingerprint empty;
- self-signed certificate (the default of a NAS reached by its IP address): the first try fails with "Nothing sent", and the status shows the SHA-256 fingerprint the NAS presented. Check it in DSM (Control Panel > Security > Certificate, certificate details), then copy it in Certificate fingerprint. From then on, only this certificate is accepted.
A fingerprint typed is the only reference: when the NAS shows another certificate (renewed, or another machine), nothing is sent and the status shows the new fingerprint, to check then type. The integration never learns a certificate by itself.
Allow HTTP (off by default) accepts an http:// URL (port 5000): the token and the messages then cross your
network in clear.
2. Starting a scene from the chat (Gladys Plus)
- Link Gladys Plus to your Gladys and paste your Open API key in the Gladys Plus webhooks block of the integration page: Gladys shows a public URL for the webhook "Synology Chat outgoing webhook".
- In Synology Chat > Integration, create an outgoing webhook (a channel and/or trigger words), a slash command or a bot, with this URL as its outgoing URL.
- Copy the token Synology Chat shows for this webhook (or command, or bot) in Outgoing webhook token(s) (up to 5, separated by spaces). It is kept by Gladys in its database, never shown again, never sent anywhere by the integration. The messages typed in the chat (and this token, which comes with them) go through the Gladys Plus gateway before they reach your Gladys.
- In a scene, pick the trigger Synology Chat command received.
The trigger can filter on the command (the message without the trigger word, spaces collapsed), the
trigger word, the user name and the channel. Filters are exact, case included: with the trigger
word gladys, the message gladys lights off gives the command lights off. Variables: whole message,
command, trigger word, user name and id, channel and its id, source (channel for a channel outgoing webhook,
direct for a slash command or a bot).
Security and limits:
- A request whose form field
tokenis not one of the tokens typed is ignored; with no token typed, every request is ignored. The token is never read from the URL. - Gladys never answers in the chat by itself: the webhook answers empty, and nothing is sent in reaction to a received message. When a scene started by a command sends a message that starts with the trigger word, that message, if it comes back within a minute through the outgoing webhook with exactly the same text, is recognised and ignored. Were Synology Chat to change the text (links, special characters), only the limit of 20 requests a minute would slow the loop: pick a trigger word the answers of your scenes do not repeat.
- At most 20 requests a minute; the same message (
post_id) is handled once while the integration runs; a message dated more than 10 minutes away from the clock of Gladys is ignored. - Bot messages with buttons (interactive actions) are not read.
Status
The integration page shows: ready to send, or what blocks (URL missing or unreadable, http:// without the
option, invalid fingerprint, certificate to confirm with its fingerprint, pause of the NAS, last failure), then
the state of the chat commands (active, without Gladys Plus, token missing or unreadable). The last failure
clears with the first message accepted, or when the URL, the fingerprint or the HTTP option change.
Data kept
/data/synology-chat-state.json only keeps the end of the pause the NAS asked for and its level. Never the URL,
a token nor a message. A file that cannot be read is never overwritten.
Configuration settings
These are the settings Synology Chat asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Sending messages | section | No | Unofficial connector, not affiliated with Synology. In Synology Chat, open your profile picture > Integration > Incoming Webhooks, create one for the channel, and copy its URL below. Your scenes then use the action "Send a Synology Chat message". If the NAS shows a self-signed certificate, click "Send a test message": the status shows its fingerprint, to check in DSM and copy below. |
| Incoming webhook URL | secret | Yes | The whole URL shown by Synology Chat (…/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming…&token=…). It lets anyone post in the channel: kept by Gladys in its database, never shown again, sent only to your NAS. |
| Certificate fingerprint (SHA-256) | string | No | Only for a NAS with a self-signed certificate. Empty: the certificate must be signed by an authority for the name in the URL. Typed: only that certificate is accepted. |
| Allow HTTP (no TLS) | boolean | No | Accept an http:// URL: the token of the webhook and the messages then cross your network in clear. Off by default. |
| Commands from the chat (Gladys Plus) | section | No | To start a scene from a message, link Gladys Plus and paste your Open API key in the "Gladys Plus webhooks" block: Gladys shows a public URL. In Synology Chat, create an outgoing webhook (or a slash command, or a bot) with that URL, then copy its token below. Your scenes use the trigger "Synology Chat command received". Without Gladys Plus, only sending works. Gladys never answers in the chat by itself. |
| Outgoing webhook token(s) | secret | No | The token shown by Synology Chat for the outgoing webhook, slash command or bot (up to 5, separated by spaces). A request without one of them is ignored; none typed: every request is ignored. Kept by Gladys in its database, never shown again, never sent anywhere. |
How to install Synology Chat in Gladys
- In Gladys, open Integrations: Synology Chat appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/lm1lc3n7/gladys-synology-chat:0.1.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/LM1LC3N7/gladys-synology-chat.
Synology Chat requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Synology Chat is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by LM1LC3N7, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation