This is an Encore starter application for a Slack bot. It brings the greatness of the cowsay utility to Slack!
If you prefer to built it yourself, check out the written tutorial to learn how to build this application from scratch.
Install Encore:
brew install encoredev/tap/encore
curl -L https://encore.dev/install.sh | bash
iwr https://encore.dev/install.ps1 | iex
Slack Workspace:
Create a local app from this template:
encore app create my-app-name --example=ts/slack-bot
The first step is to create a new Slack app:
Enter the following manifest (replace $APP_ID
in the URL below with your Encore app id):
_metadata:
major_version: 1
display_information:
name: Encore Bot
description: Cowsay for the cloud age.
features:
slash_commands:
- command: /cowsay
# Replace $APP_ID below
url: https://staging-$APP_ID.encr.app/cowsay
description: Say things with a flair!
usage_hint: your message here
should_escape: false
bot_user:
display_name: encore-bot
always_online: true
oauth_config:
scopes:
bot:
- commands
- chat:write
- chat:write.public
settings:
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
Next, head over to the configuration section for your Slack app (go to Your Apps → select your app → Basic Information).
Copy the Signing Secret and then run the following command and paste the secret to store it using Encore's built-in secrets manager:
encore secret set --type local,dev,pr,prod SlackSigningSecret
Run this command from your application's root folder:
encore run
Note: This app doesn't do much when running locally, you need to deploy it (see below) for Slack to be able to communicate with the program and for the bot to work.
While encore run
is running, open http://localhost:9400/ to access Encore's local developer dashboard.
Here you can see traces for all requests that you made while using the frontend, see your architecture diagram, and view API documentation in the Service Catalog.
See the self-hosting instructions for how to use encore build docker
to create a Docker image and configure it.
Deploy your application to a free staging environment in Encore's development cloud using git push encore
:
git add -A .
git commit -m 'Commit message'
git push encore
You can also open your app in the Cloud Dashboard to integrate with GitHub, or connect your AWS/GCP account, enabling Encore to automatically handle cloud deployments for you.
Follow these steps to link your app to GitHub:
To run tests, configure the test
command in your package.json
to the test runner of your choice, and then use the command encore test
from the CLI. The encore test
command sets up all the necessary infrastructure in test mode before handing over to the test runner. Learn more
encore test