boybundit / linebot

🤖 SDK for the LINE Messaging API for Node.js
https://www.npmjs.com/package/linebot
MIT License
217 stars 93 forks source link

Using AWS lambda #18

Open tkforce opened 7 years ago

tkforce commented 7 years ago

Hello, This is not an issue really, It just I'm currently using this SDK and deploy to AWS lambda using Serverless, but I'm unable to trigger any event when I send message from line app. How am I able to get bot.listen() to work when I'm using microservices like Lambda?

boybundit commented 7 years ago

@tkforce We cannot start any server on AWS Lambda (as you know, it is 'serverless'). What you can do is to add AWS API Gateway as a trigger of your Lambda function. I'm not an expert on this, but I found this guide which might be useful for you to get started. Then, in your lambda function, you can use LineBot.parse to process the message, similar to this example.

If you can make it worked on AWS lambda, PR of example usage will be greatly appreciated! 😄