Connect your forms to Matrix
Example
<form method="POST" action="http://localhost:3000" enctype="multipart/form-data">
<div>
<label for="name">Name</label>
<input type="text" name="name" required>
</div>
<div>
<label for="link">Link</label>
<input type="text" name="link" required>
</div>
<div>
<label for="file">File</label>
<input type="file" name="file" required>
</div>
<input type="submit">
</form>
In Matrix
- Server-side, no additional JavaScript
- Rich formatting
- Many forms on same instance
- File uploads
- Templates
- CORS
- Access with bots
Consider sponsoring me if you want to see new features
- Create new account
- In Element, go to "All settings" > "Help & About" and copy the "Access Token" from the "Advanced" section
- For each form, create a new (unencrypted) room and then go to "Room Settings" > "Advanced" and copy the "Internal room ID"
- Follow the installation proccess below
docker run ghcr.io/mishushakov/matrix-forms:latest
See the configuration options below
- Clone and enter the repository
git clone https://github.com/mishushakov/matrix-forms && cd matrix-forms
- Install the dependencies
npm i
-
Configure using environment variables
-
Start the server
npm start
PORT
- Port to listen to
HOMESERVER
- Matrix Homeserver
ACCESS_TOKEN
- User access token
DEFAULT_ROOM
- Default room for submissions if no room is specified in query params
CORS
- CORS Origin
to
- Matrix room to submit the form
return
- Return URL (rendered in template)
redirect
- Redirect to return
URL (Boolean)
templates/message.handlebars
- Message template
templates/success.handlebars
- Success template
The messages should contain matrix.forms
field to help you parse submission contents with bots
"matrix.forms": {
"fields": {
"link": "gfd",
"name": "gfd"
},
"files": [
{
"content_uri": "mxc://matrix.org/gMFeqNWiVdMnBfmxTyxDgeMP",
"name": "recording-3.ogg",
"size": 12527
}
]
}