message-api is an api for collecting messages from an audience.
The central idea is to provide an api that is not dependent on registration on website or the installation of an app. Messages can be posted using dynamic qr-codes containing a link to the message submission form including a secret. Once a qr-code is used, a new one will be generated.
The endpoint to generate a qr code requires authentication. Hence the api can be used at an event for participants to post messages, everything can be available online but only physically present people can post messages using the qr codes that are displayed at the event. Everyone can read the messages posted.
There are rudimentary frontends for the message api built in dash. The messages_frontend displays all posted messages and the qr_frontend displays the qr-codes containing the secrets for posting messages. There is an example on how the form can be embedded into a wordpress homepage.
Install python >=3.10, poetry and docker-compose.
Run
poetry installto install dependencies.
Change into the virtual environment
poetry shellSetup the .env-file by copying the .env.example to .env
cp .env.example .envand filling the JWT_SECRET_KEY and ADMIN_PASSWORD.
Choose a password for the admin account and generated the hashed admin password by exectuting
make generate-admin-pwA JWT_SECRET_KEY can be generated by executing
openssl rand -hex 32Now we are ready to go!
Run
make docker-redisto start redis. This holds the messages and tokens.
Run
make run-apito start the api.
The swagger-ui / redoc describes the under localhost:8000/docs respectively localhost:8000/redoc.
Run
make build-base-image
make build-imagesto build the base image with dependencies and build the message api and the 2 frontend services.
Run
make docker-runto start the api, frontends and redis.
The qr frontend is served under localhost:8050, the messages-frontend under localhost:8051 and the api under localhost:8000.
Remark: The docker-compose definition does not include an access token for redis. The api will read the environment variable ACCESS_TOKEN (or ACCESS_TOKEN directly from .env).
A rudimentary nginx configuration is available under etc/nginx for deploying the docker-compose docker/message-api.yaml.