Slack bot that works with slash commands and a URL shortener, namely vhl.ink.
- First, install packages in the directory of this repository running in the terminal:
npm i
- Read through Cloudflare's Getting started guide to begin setting up wrangler.
- Configure development and secret keys by running
wrangler loginand replacing theaccount_idin wrangler.toml with youraccount_idas mentioned in the getting started guide.
You will need some secrets in order to make everything run properly. We use GitHub repository secrets, and you can use Cloudflare Wrangler Secrets for local secret development.
- Cloudflare API key with Wrangler permissions, as described here.
- The
SECRET_KEYof the URL shortener - Slack Signing Secret to verify requests. Refer to the section in the block kit documentation linked above.
- Begin development on your local machine with:
wrangler dev
- Generally, we followed this Slack bot on Workers tutorial published by Cloudflare, but using TypeScript rather than vanilla JavaScript. Some of its information on Slack's slash commands are deprecated – an article updated in January 2020 on Slack's Block Kit is more up-to-date.
- Slack's reference on slash commands also is very useful.
/shortenor/shorten helpprints out slash command usage information./shorten <path> <url>tells the link shortener to makevhl.ink/pathgo tourl./shorten listlists out all existing link paths./shorten delete <path> <key>deletesvhl.ink/path, given that the correct secretkeyis passed in.