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 login
and replacing theaccount_id
in wrangler.toml with youraccount_id
as 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_KEY
of 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.
/shorten
or/shorten help
prints out slash command usage information./shorten <path> <url>
tells the link shortener to makevhl.ink/path
go tourl
./shorten list
lists out all existing link paths./shorten delete <path> <key>
deletesvhl.ink/path
, given that the correct secretkey
is passed in.