diff --git a/README.md b/README.md index 76fdadf..b29a473 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,24 @@ Send a message: ```sh $ signal-cli --dbus-system send -m "hey test" ``` +## Receive messages from signal-cli daemon + +The signal-cli daemon publishes new messages to dbus. +Here's an example using python: +```python +def msgRcv (timestamp, source, groupID, message, attachments): + print ("Message", message, "received in group", signal.getGroupName (groupID)) + return + +from pydbus import SystemBus +from gi.repository import GLib + +bus = SystemBus() +loop = GLib.MainLoop() + +signal = bus.get('org.asamk.Signal') + +``` + +signal.onMessageReceived = msgRcv +loop.run()