added Home Assistant documentation

This commit is contained in:
Bernhard B
2019-11-03 19:21:58 +01:00
parent 214a3fba12
commit fb6b964857
3 changed files with 46 additions and 18 deletions

View File

@@ -4,23 +4,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends wget default-jre software-properties-common git \
&& rm -rf /var/lib/apt/lists/*
#RUN add-apt-repository ppa:gophers/archive
#RUN apt-get update
#RUN apt-get install -y golang-1.11-go
# ARM
#RUN wget -P /tmp/ https://dl.google.com/go/go1.12.5.linux-armv6l.tar.gz \
# && tar -C /usr/local -xzf /tmp/go1.12.5.linux-armv6l.tar.gz \
# && rm -rf /tmp/go1.12.5.linux-armv6l.tar.gz
#RUN wget -P /tmp/ https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz \
# && tar -C /user/local -xzf /tmp/go1.12.5.linux-amd64.tar.gz \
# && rm -rf /tmp/go1.12.5.linux-amd64.tar.gz
#ENV PATH /usr/lib/go-1.11/bin/:$PATH
RUN wget -P /tmp/ https://github.com/AsamK/signal-cli/releases/download/v0.6.2/signal-cli-0.6.2.tar.gz \
&& tar -C /usr/bin -xzf /tmp/signal-cli-0.6.2.tar.gz \
&& rm -rf /tmp/signal-cli-0.6.2.tar.gz

View File

@@ -30,7 +30,7 @@ services:
Sample REST API calls:
* Register a number (with SMS verification)
```curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/register/<number>'```
```curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/register/<number>'```
e.g:
```curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/register/+431212131491291'```

45
doc/HOMEASSISTANT.md Normal file
View File

@@ -0,0 +1,45 @@
# README
This document describes how to use the Signal Messenger REST API together with Home Assistant.
prerequisites:
* docker + docker-compose
* a phone number to spare
## Set up the docker container
* Create a `docker-compose.yml` file with the following contents:
```
version: "3"
services:
signal-cli-rest-api:
image: bbernhard/signal-cli-rest-api:latest
ports:
- "8080:8080" # map docker port 8080 to host port 8080.
network_mode: "host"
volumes:
- "./signal-cli-config:/home/.local/share/signal-cli" # map "signal-cli-config" folder on host system into docker container. the folder contains the password and cryptographic keys when a new number is registered
```
* start the docker container with `docker-compose up`
## Register phone number
In order to send signal messages to other users, you first need to register your phone number. This can be done via REST requests with:
```curl -X POST -H "Content-Type: application/json" 'http://<ip>:<port>/v1/register/<number>'```
e.g:
This registers the number `+431212131491291` to the Signal network.
```curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/register/+431212131491291'```
After you've sent the registration request, you will receive a token via SMS for verfication. In order to complete the registration process you need to send the verification token back via the following REST request:
```curl -X POST -H "Content-Type: application/json" 'http://<ip>:<port>/v1/register/<number>/verify/<verification code>'```
e.g:
```curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/register/+431212131491291/verify/123-456'```