This is a slack bot that will convert any sentence to a Yoda style sentence. For example:
Input: This app is so cool.
Output: So cool this app is.
To get this app running, you need to have:
- hasura CLI tool
- A project on Google Cloud Platform. You can create one for free :)
- Some Slack workspace
The app will be ready and working in just 9 steps. This app requires several secret tokens to be set up. If you are stuck anywhere for more than 5 minutes, just raise an issue in the git repo, I will get to it asap
- Get this project.
$ hasura quickstart jaison/yoda-translate-slackbot
- Make an app in your slack workspace. Copy your slack token and add it to your hasura project secrets so that you do not have to explicitly mention it in the code.
$ hasura secret update slack.token '<slack_token>'
- Add a slash command to your workspace (say /yodify). Add the URL to be
https://yoda.<cluster-name>.hasura-app.io/echo
. Runhasura cluster status
to get your cluster name. - Go to interactive components. Add the URL as
https://yoda.<cluster-name>.hasura-app.io/confirm
. - Add a bot user. Name it whatever you want; preferably Yoda.
- Go to
OAuth and Permissions
and add the following permission scope.
- Scroll up and install the app to the workspace. Once you install, copy the Bot-Access-Token and add it to your secrets.
$ hasura secret update bot.access.token '<bot_access_token>'
- Finally, enable the Google Cloud Natural Language API for your project and get your API key. Add this to your secrets. Check how to get API key
$ hasura secret update google.api.key <google_api_key>
- Just push this project to your Hasura cluster and you are set. Run the following from project directory.
$ git add . && git commit -m "First commit"
$ git push hasura master
Once the app is live, you can see it in action in any of your channels of your slack workspace. Just run /yodify This app is so cool
. You will get your result :)
If you want to make any changes to the code, the source code for this application lives in microservices/yoda/app/src
directory. Modify whatever you wish to and repeat step 9 of the deployment guide to see the changes live.
If you find a bug or an error, you can raise an issue here.