Giter VIP home page Giter VIP logo

aws-lambda-bot's Introduction

aws-lambda-bot

Slack chat bot running on Node, built using the Slack Bolt javascript framework

Development

Prerequisites

  • If you haven't already, install serverless with npm install -g serverless
  • If you don't have ngrok, install with choco install ngrok

Local Development

To run the bot locally, first clone the repo, then set the following environment variables:

  • SLACK_BOT_TOKEN - this is found in the Slack API under OAuth & Permissions
  • SLACK_SIGNING_SECRET - this is found in the Slack API under Signing Secret

Setting local env vars on Mac

On the terminal from the app's root directory once you have found the appropriate values, run: export SLACK_BOT_TOKEN=xoxb-tokenvalue

export SLACK_SIGNING_SECRET=signingsecretvalue

Setting local env vars on Windows

On the terminal from the app's root directory once you have found the appropriate values, run: set SLACK_BOT_TOKEN=xoxb-tokenvalue

set SLACK_SIGNING_SECRET=signingsecretvalue

Running locally

It's recommended that you use VS Code during local development.This will let you use Prettier to keep formatting and syntax consistent when you save a file.

You can take advantage of a local development server (with hot reloading) to avoid restarting the app for every change:

# Don't use npm! Only use yarn: https://yarnpkg.com/en/
yarn install
serverless offline --noPrependStageInUrl

In a different admin console, run ngrok http 3000

Copy the ngrok local URL (looks like https://123-123-123.ngrok.io) and update the slack bot request and event URLs at api.slack.com

  • Interactivity & Shortcuts > Request URL - paste the ngrok URL and save
  • Event Subscriptions > Request URL - paste the {ngrok URL}/slack/events and save

Adding a new script

To add a new script/function to the bot, create a new script in the src/scripts folder. Then, in app.js, add a call to your new function to pass the app object into it.

aws-lambda-bot's People

Contributors

erinknight242 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.