Skip to main content
Version: 7.x

Ntfy Recipe

require 'contrib/ntfy.php';

Source

Installing

Require ntfy.sh recipe in your deploy.php file:

Setup:

  1. Setup deploy.php Add in header:
require 'contrib/ntfy.php';
set('ntfy_topic', 'ntfy.sh/mytopic');

Add in content:

before('deploy', 'ntfy:notify');
after('deploy:success', 'ntfy:notify:success');
after('deploy:failed', 'ntfy:notify:failure');

9.) Sip your coffee

Configuration

  • ntfy_server – ntfy server url, default ntfy.sh
    set('ntfy_server', 'ntfy.sh');
  • ntfy_topic – ntfy topic, required
    set('ntfy_topic', 'mysecrettopic');
  • ntfy_title – the title of the message, default {{application}}
  • ntfy_text – notification message template
    set('ntfy_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*');
  • ntfy_tags – notification message tags / emojis (comma separated)
    set('ntfy_tags', `information_source`);
  • ntfy_priority – notification message priority (integer)
    set('ntfy_priority', 5);
  • ntfy_success_text – success template, default:
    set('ntfy_success_text', 'Deploy to *{{target}}* successful');
  • ntfy_success_tags – success tags / emojis (comma separated)
    set('ntfy_success_tags', `white_check_mark,champagne`);
  • ntfy_success_priority – success notification message priority
  • ntfy_failure_text – failure template, default:
    set('ntfy_failure_text', 'Deploy to *{{target}}* failed');
  • ntfy_failure_tags – failure tags / emojis (comma separated)
    set('ntfy_failure_tags', `warning,skull`);
  • ntfy_failure_priority – failure notification message priority

Usage

If you want to notify only about beginning of deployment add this line only:

before('deploy', 'ntfy:notify');

If you want to notify about successful end of deployment add this too:

after('deploy:success', 'ntfy:notify:success');

If you want to notify about failed deployment add this too:

after('deploy:failed', 'ntfy:notify:failure');

Configuration

ntfy_server

Source

Default value
'ntfy.sh'

ntfy_title

Source

Title of project

Default value
return get('application', 'Project');

ntfy_text

Source

Deploy message

Default value
'_{{user}}_ deploying `{{branch}}` to *{{target}}*'

ntfy_success_text

Source

Default value
'Deploy to *{{target}}* successful'

ntfy_failure_text

Source

Default value
'Deploy to *{{target}}* failed'

ntfy_tags

Source

Message tags

ntfy_success_tags

Source

ntfy_failure_tags

Source

Tasks

ntfy:notify

Source

Notifies ntfy server.

ntfy:notify:success

Source

Notifies ntfy server about deploy finish.

ntfy:notify:failure

Source

Notifies ntfy server about deploy failure.