Giter Club home page Giter Club logo

botframework-aws-lambda-slack's Introduction

botframework-aws-lambda-slack

This repo contains code and guidance to deploy Microsoft bot code to AWS Lambda and Integrate with Slack.

Screen Shot 2019-05-16 at 2 50 10 PM

I got very excited when I first saw Microsoft Bot Framework (https://dev.botframework.com). Microsoft has done a great job! You can deploy same bot to multiple channels such as MS Team, Slack, Facebook. But all the documents/tutorial I read recommend to deploy bot backend code to Azure. I have been working with AWS for few years but never used Azure before. So was looking for a solution to deploy the nodejs backend to AWS lambda as I am more comfortable. I still need to create Azure account to create the bot and deploy to channels but that's OK ( who knows in future I may migrate from AWS Lambda to Azure Function :) )

I googled but did not find a solution which just works out of the box. So I decided to poke the framework code a bit and get it deployed to lambda.

PS: If you know a better and more elegant solution, please let me know.

I used yoman builder to scaffold the bot framework following this tutorial (https://docs.microsoft.com/en-us/azure/bot-service/javascript/bot-builder-javascript-quickstart?view=azure-bot-service-4.0)

Screen Shot 2019-05-15 at 3 18 45 PM

The framwork code comes with restify webserver which does not work out of the box on AWS Lambda. But fortunately AWS released aws-serverless-express which is build on top of Express server and works with AWS Lambda. So I simply removed restify and injected aws-serverless-express & express in the framework code.

Check out the commit to find the exact code change I had to do ( https://github.com/just4give/botframework-aws-lambda-slack/commit/cb46b5b9c76cd5e6c113fe866c8ea79e363cb3d4 )

That's all !!!

Now you are ready to deploy this code to AWS Lambda and create AWS API Gateway to access the code over REST API. Once you deploy to AWS and get the API endpoint, simply update that to Azure Bot as below.

Screen Shot 2019-05-15 at 8 55 06 PM

If you are on the same boat as me and want to give a try, I have created terraform scripts to help you create AWS resources ( Lambda, Gateway ) and deploy backend code through your terminal without even log into AWS Console.

cd terraform
terraform init
terraform apply --var-file=variables.tfvars --auto-approve

At the end the script will print API Gateway endpoint on your terminal. Copy that and update in Azure.

Screen Shot 2019-05-15 at 9 38 05 PM

botframework-aws-lambda-slack's People

Contributors

just4give avatar

Watchers

 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.