<p>You can trigger a shell script with them, and more.<br />
This is related to the plugin functionalities provided by <code>lightningd</code> and not <code>bitcoind</code>.</p>
<p><code>lightningd</code> allows you to run <a href="https://lightning.readthedocs.io/PLUGINS.html" rel="nofollow noreferrer">plugins</a> to deeply modify its behaviour, or extend its possibilities. It idiomatically (small and robust core, customizable functionalities) relies a lot on them and therefore directed the event mechanisms toward them as well.<br />
This is the reason why you don't see <code>[*]notify=</code> startup options for <code>lightningd</code>.</p>
<p>To use <a href="https://lightning.readthedocs.io/PLUGINS.html#event-notifications" rel="nofollow noreferrer"><code>lightningd</code>'s notifications</a> you have to write a plugin, but it can be a pretty simple script. For example, here is the handler of the <code>invoice_payment</code> notification in the <a href="https://github.com/ElementsProject/lightning/blob/master/contrib/plugins/helloworld.py" rel="nofollow noreferrer">HelloWorld showcase plugin</a>:</p>
<pre><code>@plugin.subscribe(&quot;invoice_payment&quot;)
def on_payment(plugin, invoice_payment, **kwargs):
    plugin.log(&quot;Received invoice_payment event for label {label}, preimage {preimage},&quot;
               &quot; and amount of {msat}&quot;.format(**invoice_payment))
</code></pre>
<p>The previous example used the Python library, but the communication is pretty straightforward (JSONRPC 2.0) so you can technically <a href="https://github.com/ElementsProject/lightning/blob/master/contrib/plugins/cowsay.sh" rel="nofollow noreferrer">use a shell script :-)</a>.</p>
<p>For reference, there is an available and curated <a href="https://github.com/lightningd/plugins/#available-plugins" rel="nofollow noreferrer">list of community plugins</a>.</p>

CC BY-SA 4.0
2020-11-04T16:20:24.020Z
Ah, I understand now. It's not there because the ability to add new functionality through plugins is instead.
Fibericon
CC BY-SA 4.0
2020-11-04T15:57:20.873Z
2020-11-04T16:10:05.433Z
2020-11-04T16:10:05.433Z
Antoine Poinsot
<p>I'm looking at the docs, and I see they have lightning-notifications, but it looks like you can't configure where they go, and you can't trigger a shell script with them. Does this mean I have to have all notifications sent to a shell script and filter them, or is there a method/configuration I'm overlooking?</p>

<lightning-network><core-lightning>
Is there a lightningd equivalent to bitcoind's -walletnotify or -blocknotify?
Fibericon
# Is there a lightningd equivalent to bitcoind's -walletnotify or -blocknotify?

(Asked by: username_0 on 2020-11-04)

I'm looking at the docs, and I see they have lightning-notifications, but it looks like you can't configure where they go, and you can't trigger a shell script with them. Does this mean I have to have all notifications sent to a shell script and filter them, or is there a method/configuration I'm overlooking?

**Tags:** lightning-network, core-lightning


---

## 1 answers

### Answer by username_1 on 2020-11-04. Score: 4 | Accepted answer

You can trigger a shell script with them, and more.
This is related to the plugin functionalities provided by lightningd and not bitcoind.
lightningd allows you to run plugins to deeply modify its behaviour, or extend its possibilities. It idiomatically (small and robust core, customizable functionalities) relies a lot on them and therefore directed the event mechanisms toward them as well.
This is the reason why you don't see [*]notify= startup options for lightningd.
To use lightningd's notifications you have to write a plugin, but it can be a pretty simple script. For example, here is the handler of the invoice_payment notification in the HelloWorld showcase plugin:
@plugin.subscribe("invoice_payment")
def on_payment(plugin, invoice_payment, **kwargs):
    plugin.log("Received invoice_payment event for label {label}, preimage {preimage},"
               " and amount of {msat}".format(**invoice_payment))

The previous example used the Python library, but the communication is pretty straightforward (JSONRPC 2.0) so you can technically use a shell script :-).
For reference, there is an available and curated list of community plugins.

> **Comments:**
> **username_0**: Ah, I understand now. It's not there because the ability to add new functionality through plugins is instead.  

---

