mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-06-10 17:10:20 +00:00
Persistence Plugin
Plugin which writes every received message to a sqlite3 database.
Howto enable this plugin
- Download the
persist-message.def,persist-message.lua,query-message.defandquery-message.luafiles and put them in apluginsfolder on your filesystem - Create a
persistencefolder on your host system. In this folder the docker container then creates the sqlite3 database. - Adapt your
docker-compose.ymlto enable the plugin and map the required resources into the docker container
services:
signal-cli-rest-api:
image: bbernhard/signal-cli-rest-api:latest
environment:
- MODE=json-rpc #supported modes: json-rpc, native, normal (choose the mode you want; the plugin works with all modes)
- ENABLE_PLUGINS=true # enable plugins
- "./plugins:/plugins" #map "plugins" folder from the host system into the docker container
- "./persistence;/persistence" #map "persistence" folder from the host system into the docker container
- RECEIVE_WEBHOOK_URL=http://127.0.0.1:8080/v1/plugins/persistence/persist-message #register an internal webhook endpoint
- Restart your docker container
Every message that is received is then written to the messages.db inside the persistence folder.
The stored messages can then be received via the REST API with:
curl -X GET 'http://127.0.0.1:8080/v1/plugins/persistence/query-message'
Debugging and Troubleshooting
- Make sure that the docker container has write permissions to the
persistencefolder - On the host system, check if the
messages.dbgets created in thepersistencefolder - Check the logs. Do you see any error?