This commit is contained in:
Bernhard B
2020-07-10 21:49:23 +02:00
2 changed files with 6 additions and 102 deletions

106
README.md
View File

@@ -6,7 +6,10 @@ At the moment, the following functionality is exposed via REST:
- Register a number - Register a number
- Verify the number using the code received via SMS - Verify the number using the code received via SMS
- Send message (+ attachment) to multiple recipients - Send message (+ attachments) to multiple recipients (or a group)
- Receive messages
- Link devices
- Create/Liste/Remove groups
## Examples ## Examples
@@ -25,106 +28,7 @@ services:
``` ```
Sample REST API calls: The API documentation can be found [here](https://bbernhard.github.io/signal-cli-rest-api/)
- Register a number (with SMS verification)
`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'`
- Register a number (with voice verification)
`curl -X POST -H "Content-Type: application/json" --data '{"use_voice": true}' 'http://127.0.0.1:8080/v1/register/<number>'`
e.g:
`curl -X POST -H "Content-Type: application/json" --data '{"use_voice": true}' 'http://127.0.0.1:8080/v1/register/+431212131491291'`
- Verify the number using the code received via SMS/voice
`curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/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'`
- Send a message to multiple recipients
`curl -X POST -H "Content-Type: application/json" -d '{"message": "<message>", "number": "<number>", "recipients": ["<recipient1>", "<recipient2>"]}' 'http://127.0.0.1:8080/v2/send'`
e.g:
`curl -X POST -H "Content-Type: application/json" -d '{"message": "Hello World!", "number": "+431212131491291", "recipients": ["+4354546464654", "+4912812812121"]}' 'http://127.0.0.1:8080/v2/send'`
- Send a message (+ base64 encoded attachment) to multiple recipients
`curl -X POST -H "Content-Type: application/json" -d '{"message": "<message>", "base64_attachments": ["<base64 encoded attachment>"], "number": "<number>", "recipients": ["<recipient1>", "<recipient2>"]}' 'http://127.0.0.1:8080/v2/send'`
- Send a message to a group
The group id can be obtained via the "List groups" REST call.
`curl -X POST -H "Content-Type: application/json" -d '{"message": "<message>", "number": "<number>", "recipients": ["<group id>"]}' 'http://127.0.0.1:8080/v2/send'`
e.g:
`curl -X POST -H "Content-Type: application/json" -d '{"message": "Hello World!", "number": "+431212131491291", "recipients": ["group.ckRzaEd4VmRzNnJaASAEsasa", "+4912812812121"]}' 'http://127.0.0.1:8080/v2/send'`
- Receive messages
Fetch all new messages in the inbox of the specified number.
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/receive/<number>'`
e.g:
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/receive/+431212131491291'`
- Create a new group
Create a new group with the specified name and members.
`curl -X POST -H "Content-Type: application/json" -d '{"name": "<group name>", "members": ["<member1>", "<member2>"]}' 'http://127.0.0.1:8080/v1/groups/<number>'`
e.g:
`curl -X POST -H "Content-Type: application/json" -d '{"name": "my group", "members": ["+4354546464654", "+4912812812121"]}' 'http://127.0.0.1:8080/v1/groups/+431212131491291'`
- List groups
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/<number>'`
e.g:
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291'`
- Delete a group
Delete the group with the given group id. The group id can be obtained via the "List groups" REST call.
`curl -X DELETE -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/<number>/<group id>'`
e.g:
`curl -X DELETE -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291/ckRzaEd4VmRzNnJaASAEsasa'`
- Link a device
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/qrcodelink?device_name=<device name>'`
e.g:
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/qrcodelink?device_name=HomeAssistant'`
This provides a QR-Code image. In case of an error a JSON object will be returned.
Due to security reason of Signal, the provided QR-Code will change with each request.
The following REST API endpoints are **deprecated and no longer maintained!**
`/v1/send`
In case you need more functionality, please **file a ticket** or **create a PR** In case you need more functionality, please **file a ticket** or **create a PR**

View File

@@ -3,7 +3,7 @@
<!-- Load the latest Swagger UI code and style from npm using unpkg.com --> <!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script> <script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/> <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
<title>My New API</title> <title>signal-cli-rest-api API documentation</title>
</head> </head>
<body> <body>
<div id="swagger-ui"></div> <!-- Div to hold the UI component --> <div id="swagger-ui"></div> <!-- Div to hold the UI component -->