Skip to content

Commit c4cee82

Browse files
committed
docs: revisit README
1 parent 0f25a8c commit c4cee82

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# signal-mqtt
2-
signal-mqtt - An adapter between MQTT and the
3-
[JSON RPC](https://github.com/AsamK/signal-cli/wiki/JSON-RPC-service)
4-
API of signal-cli.
2+
signal-mqtt - An adapter between MQTT and signal-cli
3+
[JSON RPC](https://github.com/AsamK/signal-cli/wiki/JSON-RPC-service).
54

6-
This project allows to send arbitrary command requests to Signal messengers and receive responses.
5+
This project allows to send and receive messages between MQTT clients and Signal messengers.
76
This includes, but is not limited to, sending and receiving of text messages,
8-
quotations and emojis to Signal accounts and groups.
7+
quotations and emojis to/from Signal accounts and groups.
98
The signal-cli documentation contains a list of all
109
[supported commands](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli.1.adoc#commands).
1110

@@ -57,7 +56,7 @@ The signal-cli documentation contains a list of all
5756
## Usage
5857
There are two different ways to use this service:
5958
- Send and receive complete JSON RPC messages including content and metadata.
60-
- Send and receive simple text messages whereas metadata is part of the MQTT topic.
59+
- Send and receive simple text messages and handle metadata as part of the MQTT topic (aka "parameter topics").
6160

6261
### Lifecycle commands
6362
| Action | Command
@@ -75,7 +74,7 @@ Incoming and outgoing JSON RPC messages are published to a topic per direction.
7574
| Receive | `signal/in` | `MQTT_PUBLISH_TOPIC`
7675

7776
#### Send
78-
To send a JSON RPC command, publish the JSON message to the send topic (default: `signal/out`).
77+
To send a JSON RPC command, publish a JSON message to the send topic (default: `signal/out`).
7978

8079
Example:
8180
```sh
@@ -113,7 +112,6 @@ Example:
113112
### Send and receive messages via parameter topics
114113
Parameter topics have been designed for use cases
115114
where handling of complete JSON RPC messages is not suitable.
116-
117115
They allow to send and receive commands in form of simple text messages,
118116
whereas all required metadata is managed in the MQTT topic.
119117

@@ -127,10 +125,10 @@ It is composed of:
127125
defaulting to `signal/out` for outgoing and `signal/in` for incoming messages
128126
- The JSON RPC method, e.g. `send` or `receive`
129127
- An optional list of parameters. Each parameter is composed of a name and a value.
130-
The parameters may be in any order.
128+
Parameters may be in any order.
131129

132130
#### Value encoding
133-
Some parameter values, e.g. an international account number or a base64 encoded group id,
131+
Some parameter values, e.g. an international account number or a group id,
134132
include special characters which are forbidden as part of an MQTT topic.
135133
Thus, all values in parameter topics are percent-encoded (aka URL-encoded).
136134

@@ -224,10 +222,12 @@ Type Rules:
224222
| Boolean[] | `boolean[]` | `[true, false]` | `true,false:b` or `true,false:b[]`
225223
| | | `[true]` | `true:b[]`
226224

227-
Example:
228-
- Topic: `signal/out/method/send/recipient/%2B491713920000,%2B491713920001/quoteTimestamp/1577882096000:n`
229-
- Parameter _recipient_ contains a `string` array of the two phone numbers `+491713920000` and `+491713920001`;
230-
parameter _quoteTimestamp_ is explicitely typed as `number` (although the default would work here, too).
225+
Example: topic
226+
`signal/out/method/send/recipient/%2B491713920000,%2B491713920001/quoteTimestamp/1577882096000:n`
227+
contains a parameter _recipient_ holding a `string` array
228+
of the two phone numbers `+491713920000` & `+491713920001`,
229+
and parameter _quoteTimestamp_ is explicitely typed as `number`
230+
(although the default would work here, too).
231231

232232
#### Receive
233233
To receive messages on parameter topics,
@@ -323,12 +323,12 @@ services:
323323

324324
###### Use an environment variable
325325
The filter may be configured without file
326-
by setting the environment variable `MQTT_TOPIC_PARAMETERS_PATTERN`
326+
by setting the environment variable `MQTT_TOPIC_PARAMETERS_PATTERN`.
327327
The variable must contain a regular expression of named capturing groups.
328328
The group name corresponds to the filter key, the content of the group to the filter value.
329329

330330
Example:
331-
```
331+
```yaml
332332
services:
333333
signal-mqtt:
334334
[...]
@@ -337,38 +337,39 @@ services:
337337
```
338338

339339
### Run signal-cli commands from the command line
340-
* Syntax:
341-
```sh
342-
$ docker-compose run signal-mqtt signal-cli <command>
343-
```
344-
* Example:
345-
```sh
346-
$ docker-compose run --rm -ti signal-mqtt signal-cli listContacts
347-
Number: +491713920000 Name: Profile name: Sally Sender Blocked: false Message expiration: disabled
348-
Number: +491713920001 Name: Profile name: Rudy Receiver Blocked: false Message expiration: disabled
349-
```
350-
* Note: Most signal-cli commands require that no container is running.
340+
Syntax:
341+
```sh
342+
$ docker-compose run signal-mqtt signal-cli <command>
343+
```
344+
Most signal-cli commands require that no container is running.
345+
346+
Example:
347+
```sh
348+
$ docker-compose run --rm -ti signal-mqtt signal-cli listContacts
349+
Number: +491713920000 Name: Profile name: Sally Sender Blocked: false Message expiration: disabled
350+
Number: +491713920001 Name: Profile name: Rudy Receiver Blocked: false Message expiration: disabled
351+
```
351352

352353
## Configuration
353354
The configuration is based on environment variables.
354355

355356
|Variable|Description|Allowed values|Default|Example
356357
|--------|-----------|-----|-------|-------
357-
|`MQTT_TOPIC_PREFIX`|Prefix for MQTT topics|[Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106)|`signal`|`chats`
358-
|`MQTT_TOPIC_PARAMETERS_FILE`|Custom filter file for topic parameters|File paths|_none_|`/home/custom-topic-parameters`
359-
|`MQTT_TOPIC_PARAMETERS_PATTERN`|Custom pattern for topic parameters|A regular expression containing named capturing groups|_none_|`(?<method>method)|(?<source_number>params.envelope.sourceNumber)|(?<group_id>params.envelope.dataMessage.groupInfo.groupId)`
360358
|`MQTT_PUBLISH_OPTIONS`|MQTT publish options|All options [supported by `mosquitto_pub`](https://mosquitto.org/man/mosquitto_pub-1.html) except `-t` and `-m`|_none_|`-h broker -id signal-publisher`
361359
|`MQTT_PUBLISH_TOPIC`|MQTT topic for publishing messages received from Signal|[Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106)|`${MQTT_TOPIC_PREFIX}/in`|`chats/from`
362360
|`MQTT_PUBLISH_JSON_RESPONSE`|Publish JSON RPC responses from signal-cli?|`true` / `false`|`false`|`true`
363-
|`MQTT_PUBLISH_TO_PARAMETER_TOPIC`|Publish received messages to a topic created from the message parameters?|`true` / `false`|`true`|`false`
361+
|`MQTT_PUBLISH_TO_PARAMETER_TOPIC`|Publish received messages to a parameter topic?|`true` / `false`|`true`|`false`
364362
|`MQTT_SUBSCRIBE_OPTIONS`|MQTT subscribe options|All options [supported by `mosquitto_sub`](https://mosquitto.org/man/mosquitto_sub-1.html) except `-t` and formatting-related options like `-F` & `-N`|_none_|`-h broker -i signal-subscriber`
365363
|`MQTT_SUBSCRIBE_TOPIC`|MQTT topic to listen for messages that are sent to a Signal receiver|[Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106)|`${MQTT_TOPIC_PREFIX}/out`|`chats/to`
364+
|`MQTT_TOPIC_PREFIX`|Prefix for MQTT topics|[Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106)|`signal`|`chats`
365+
|`MQTT_TOPIC_PARAMETERS_FILE`|Custom filter file for topic parameters|File paths|_none_|`/home/custom-topic-parameters`
366+
|`MQTT_TOPIC_PARAMETERS_PATTERN`|Custom pattern for topic parameters|A regular expression containing named capturing groups|_none_|`(?<method>method)\|(?<source_number>params.envelope.sourceNumber)\|(?<group_id>params.envelope.dataMessage.groupInfo.groupId)`
366367
|`MQTT_LOG`|Enable logging via MQTT?|`true` / `false`|`false`|`true`
367368
|`MQTT_LOG_TOPIC`|MQTT topic to publish the log to|`${MQTT_TOPIC_PREFIX}/log`|`chats/logs`
368-
|`SIGNAL_ACCOUNT`|Phone number of the signal account|International phone number format with leading `+`|Account from signal-cli configuration|`+493023125000`
369369
|`LOG_JSON_MESSAGES`|Enable logging of JSON RPC messages?|`true` / `false`|`false`|`true`
370370
|`DEBUG`|Enable debug logging?|`true` / `false`|`false`|`true`
371371
|`TRACE`|Enable trace logging?|`true` / `false`|`false`|`true`
372+
|`SIGNAL_ACCOUNT`|Phone number of the signal account|International phone number format with leading `+`|Account from signal-cli configuration|`+493023125000`
372373

373374
## References
374375
* This project is an integration of

0 commit comments

Comments
 (0)