https://github.com/lieut-data/slash-command-random
A serverless function serving as a proof-of-concept for a Mattermost tech talk on slash commands.
https://github.com/lieut-data/slash-command-random
mattermost serverless slash-commands
Last synced: about 1 year ago
JSON representation
A serverless function serving as a proof-of-concept for a Mattermost tech talk on slash commands.
- Host: GitHub
- URL: https://github.com/lieut-data/slash-command-random
- Owner: lieut-data
- Created: 2018-03-06T04:23:09.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-07T15:26:01.000Z (about 8 years ago)
- Last Synced: 2025-01-26T06:43:48.643Z (about 1 year ago)
- Topics: mattermost, serverless, slash-commands
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slash-command-random
This repository contains a [serverless](https://serverless.com/) function exposing an HTTP endpoint
to generate random integers. It was designed as a proof-of-concept for a Mattermost tech talk on
slash commands.
## Deployment
### Serverless
See [Getting Started with Serverless](https://serverless.com/framework/docs/getting-started/) for
instructions on how to deploy this function to the compute provider of your choice.
This repository is configured to use AWS Lambda, but feel free to modify for your own purposes.
### Compiling
Simply invoke `make` to generate the requisite binaries:
make
Then deploy using serverless:
serverless deploy
Once deployed, serverless will provide the URL to an HTTP endpoint against which the function
can be invoked.
## API
The function integrates with Mattermost as a slash command, parsing a `text` query string parameter
in respond to an HTTP GET request.
## Empty or missing text parameter
The API returns a random integer between 0 and 100, inclusive.
## Single integer parameter
The API returns a random integer between 0 and the given integer, inclusive.
Note that the associated tech talk video incorrectly suggested in the autocomplete help text that
this was a minimum, not a maximum.
## Single string parameter: `die` or `dice`
The API returns a random integer between 1 and 6, inclusive.
## Two integer parameters, separated by a space
The API returns a random integer in the inclusive range given by the input parameters.