Giter Site home page Giter Site logo

line-bot-chalice's Introduction

LINE Bot example on AWS serverless services Build Status

This is a sample implementation of LINE Bot that detects labels on sent images by Amazon Rekognition.

image

Workflow Overview

image

  1. User sends a picture to the Bot
  2. LINE server make a callback request to the associated endpoint
  3. Amazon API Gateway invokes the associated AWS Lambda function
  4. AWS Lambda validates the request, and then enqueues the payload into Amazon SQS
  5. Responsing 200 OK
  6. Ditto
  7. Invoking the function triggered by SQS events
  8. Download the image that user sent from LINE server
  9. Calling the detect label API of Amazon Rekognition
  10. Replying the labels of the sent image

Dependencies

Prerequisite

LINE Messaging API

https://developers.line.biz/en/services/messaging-api/

You need to sign up and register your API via the site above.
And take a copy of channel secret and channel access token.

AWS Services

AWS CLI

Install and configure AWS CLI referring the following guides.
AWS Chalice depends on the credential settings configured by the procedre.

Amazon SQS

Create Amazon SQS queue, and take a copy of its queue name.
Note that the visivility timeout of the queue have to be more than 60, otherwise the queue cannot integrate with AWS Lambda function.

Deployment

Configuration

This sample project has an example configuration file.
You need to copy (or rename) the file and configure appropriately.

$ cp .chalice/config.json.exapmle .chalice/config.json
$ cat .chalice/config.json
{
  "version": "2.0",
  "app_name": "LINEBotWorkshop",
  "autogen_policy": false,
  "iam_policy_file": "policy.json",
  "stages": {
    "dev": {
      "api_gateway_stage": "api",
      "environment_variables": {
        "SQS_QUEUE_NAME": "",
        "LINE_CHANNEL_SECRET": "",
        "LINE_CHANNEL_ACCESS_TOKEN": ""
      }
    }
  }
}

Installing dependencies

Activate the virtual environment as needed before performing this procedure

$ pip install requirements.txt

Deploy

Once dependencies are successfully installed, you can run chalice deploy command

$ chalice deploy

License

This library is licensed under the MIT-0 License. See the LICENSE file.

line-bot-chalice's People

Contributors

amazon-auto avatar studio3104 avatar

Stargazers

 avatar  avatar

Watchers

 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.