Skip to content

Friendly library to push and receive instant notifications using ntfy.sh servers in Delphi

License

Notifications You must be signed in to change notification settings

hazzelnuts/ntfy-for-delphi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ntfy for Delphi

This library is a client-side implementation for ntfy server, made in Delphi. You can send and receive instant notifications via http. The maintainer of ntfy is Philipp C. Heckel. As he stated, this service will remain free, and every kind of support to help affording with cloud hosting will be warmly received. You too can self-host a ntfy server. Visit docs.ntfy.sh to get started and also don't forget to leave a star on his project.

Manual Installation

You need to add src folder to your library path or search path.

Quickstart

You can push notifications in topics. Topics are like channels and the name you choose will become a public url, so make sure to not choose an easy one to guess.

uses
  Notify;

begin
  Ntfy.Notification(
    New.Notification
      .Topic('your-very-secret-topic')
      .Title('⚾ Go to the game')
      .MessageContent('Tomorrow at 10:00hs ') 
  );

  Ntfy.Publish;
end;

Subscribe to a topic

You can subscribe by many ways. For instance, the Web App, Android, CLI or you can use this library this way:

uses
  Notify;

begin
  Ntfy.Subscribe('your-very-secret-topic', 
    procedure (AEvent: INotifyEvent)
    begin
      WriteLn('You received a message: ' +  AEvent.MessageContent)
    end);
end;

Supported Versions & Platforms

IOS still rely on FCM and "inteligently" decides to kill background/foreground processes when it wants. It was not properly tested yet. All other platforms have been tested and can either publish or maintain a subscription background activity suspended for long hours without having any issues. Refer to these samples to learn to use in your project. No tests have been performed on Linux at the present moment.

Built-in dependencies

Ntfy for Delphi makes use of a few libraries to subscribe and publish. There is no need to install them. Respective credit is awarded to the creators:

Wiki

Check the wiki page for specific instructions, updates or tutorials. I've created this implementation for passion and curiosity and it will remain an open source project under the MIT license. Feel free to use, contribute and improve this project!