doc(README): add a qickstart tutorial

This commit is contained in:
Benjamin Schmid
2022-02-05 11:01:09 +01:00
parent 9e8487857a
commit 358813d1ab

View File

@@ -15,6 +15,42 @@ At the moment, the following functionality is exposed via REST:
and [many more](https://bbernhard.github.io/signal-cli-rest-api/) and [many more](https://bbernhard.github.io/signal-cli-rest-api/)
## Getting started
1. Create a directory for the configuration
This allows you to update `signal-cli-rest-api` by just deleting and recreating the container without the need to re-register your signal number
```bash
$ mkdir $HOME/.local/share/signal-cli
```
2. Start a container
```bash
$ sudo docker run -d --name signal-api --restart=always -p 8080:8080 \
-v $HOME/.local/share/signal-cli:/home/.local/share/signal-cli \
-e 'MODE=native' bbernhard/signal-cli-rest-api
```
3. Register or Link you Signal Number
In this case we'll register our container as secondary device, assuming that you already have your primary number running / assigned to your mobile.
Therefore open http://localhost:8080/v1/qrcodelink?device_name=signal-api in your browser, open Signal on your mobile phone, Go to _Settings > Linked devices_ and scan the QR code using the _+_ button.
4. Test your new REST API
Call the REST api endpoint and send a test message: Replace `+4412345` with your signal number in international number format, and `+44987654` with the recipients number
```bash
$ curl -X POST -H "Content-Type: application/json" 'http://localhost:8080/v2/send' \
-d '{"message": "Test via Signal API!", "number": "+4412345", "recipients": [ "+44987654" ]}'
```
You should now have send a message to `+44987654`.
## Execution Modes ## Execution Modes
The `signal-cli-rest-api` supports three different modes of execution, which can be controlled by setting the `MODE` environment variable. The `signal-cli-rest-api` supports three different modes of execution, which can be controlled by setting the `MODE` environment variable.