knchst / redashbot-serverless

Slack Bot for Redash on AWS Lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slack Bot for Redash on AWS Lambda

This is Slack bot for Redash.

Features

  • Running on AWS Lambda (so low-cost).
  • Made with Bolt framework (Non-Socket Mode).
  • Take a screenshot of query visualization or dashboard.

How to develop

On your machine with Docker

First, run local.js to start Slack bot. (customized app.js to work locally since we can't emulate the API Gateway)

$ make setup
$ docker compose up
(Other Terminal)
$ open http://localhost:5000/users/me
# Login admin@example.com/password and get User API Key
$ make REDASH_API_KEY=your-redash-api-key sample_query_and_dashboard

Next, use ngrok to forward Slack events to your local machine.

$ ngrok http 3000

Deploy to AWS Lambda

First, deploy to AWS by serverless framework.

$ npm install
$ cp .env.sample .env.dev
$ npx serverless deploy --stage dev

Next, edit a function as necessary on aws web console.

https://docs.aws.amazon.com/lambda/latest/dg/code-editor.html

Lambda function to access resources in a VPC

In most cases, Redash is located in a VPC. If Slack bot needs to access the VPC, uncomment vpc section of serverless.yml.

About

Slack Bot for Redash on AWS Lambda

License:MIT License


Languages

Language:JavaScript 62.9%Language:Makefile 37.1%