Self Hosted Push Sender
ntfy and Gotify are the two most common self-hosted push notification servers - run one on a home server or a small VPS, install the free phone app, and any script anywhere can wake your phone with no vendor account, no per-message cost and no telemetry going through a third party. Their wire formats are genuinely different, not just cosmetically different, which is where a first attempt usually goes wrong if written from memory of one of them: ntfy takes the message as the raw HTTP POST body - not JSON, not form- encoded, just the text itself - with title, priority (1-5) and tags carried as plain HTTP headers (Title:, Priority:, Tags:). This is exactly what "curl -d 'message text' ntfy.sh/mytopic" sends. Gotify instead wants everything in one JSON object - {"title":...,"message":...,"priority":...} - posted to /message?token=<appToken>, with the application token in the URL's query string rather than a header. SelfHostedPushSendNtfy and SelfHostedPushSendGotify build each format correctly, including JSON-escaping the Gotify message so a quote or backslash in the alert text does not break the payload. Both share the same WebRequest-not-whitelisted detection used throughout this catalogue, so a first-run failure explains itself instead of leaving a bare -1 in the log. Notes and limitations - No retry and no delivery confirmation beyond the HTTP status code - a 200 means the push server accepted the request, not that the phone app has displayed it. - ntfy's Tags field is passed through exactly as given; invalid emoji shortcodes are simply not rendered as icons by the client app rather than rejected by this header. - Gotify's priority is an open integer scale the client interprets (commonly 0=low, 5=default, 8+=high); Gotify itself does not enforce a range, so this header does not clamp it either. - WebRequest only reaches the network when the server's domain/IP is on the terminal's allow-list, and that list is per terminal installation - every machine this is downloaded to needs the same one-time setup. - No authentication support beyond ntfy's topic-as-secret model and Gotify's token - neither ntfy access tokens nor Basic Auth headers are wired in; add an Authorization header manually if your ntfy instance requires one.
Script · MT5 · v1.0 · Free
About Self Hosted Push Sender
Self Hosted Push Sender is a script for MetaTrader 5. It has 4 settings, such as Ntfy server, Ntfy topic and Gotify server. MQL source code included.
Files in the download: SelfHostedPushSender.mq5.mqh, SelfHostedPushSender.txt, SelfHostedPushSenderDemo.ex5, SelfHostedPushSenderDemo.mq5.
Settings
| Setting | Default | What it does |
|---|---|---|
| Ntfy server | https://ntfy.sh | ntfy server base URL (self-hosted or ntfy.sh) |
| Ntfy topic | murodillo-mql-demo-topic | ntfy topic name |
| Gotify server | https://gotify.example.internal | Gotify server base URL |
| Gotify token | AAAAAAAAAAAAAAA | Gotify application token |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code