项目作者: c-bata

项目描述 :
LINE BOT on AWS Lambda + API Gateway built with Chalice
高级语言: Python
项目地址: git://github.com/c-bata/chalice-linebot.git
创建时间: 2016-10-17T05:26:49Z
项目社区:https://github.com/c-bata/chalice-linebot

开源协议:MIT License

下载


title

LINE BOT on AWS Lambda + API Gateway using Chalice.

Functions

Command Image
Greeting greeting
Choice choice
Shuffle shuffle
Weather weather
News news
Echo echo

Developing

Chalice-Bot depends a Pillow - Python Imaging Library.
So If you want to create deploy package for AWS Lambda, you must prepare the Amazon Linux.
However, it is very inconvenient to create an instance of EC2 for that.
So please use Dockerfile.deploy.

Setup

Create .chalice/config.json :

  1. $ cat .chalice/config.json
  2. {
  3. "app_name": "linebot",
  4. "stage": "dev"
  5. }

Environment Variables on your local machine

  1. export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxx
  2. export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  3. export AWS_DEFAULT_REGION=ap-northeast-1
  4. export S3_BUCKET_NAME=xxxxxxxxxxx
  5. export LINE_BOT_CHANNEL_ACCESS_TOKEN=
  6. export LINE_BOT_CHANNEL_ACCESS_SECRET=

Deploy to AWS Lambda and API Gateway

Deploying by chalice cli:

  1. $ make deploy

Environment variables on your AWS Console

Set environment variables on your AWS console.

  1. export LINE_BOT_CHANNEL_ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  2. export LINE_BOT_CHANNEL_ACCESS_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Configuration on LINE DEVELOPERS

Open your line bot setting’s page and Set WebHook url.

https://hoge.execute-api.ap-northeast-1.amazonaws.com/dev/callback

Success! :tada:

Others

Other commands for developing are written in Makefile:

  1. $ make help
  2. Commands:
  3. build Build docker container
  4. deploy Deploy to AWS Lambda and API Gateway
  5. lint Check coding styles
  6. test Run tests
  7. functions Show the list of AWS Lambda functions
  8. help Show help text

LICENSE

MIT. See LICENSE