go-lambda-linebot

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2018 License: Apache-2.0

README

go-lambda-linebot

GitHub release CircleCI License

go-lambda-linebot provides a functionality to parse event.APIGatewayProxyRequest and turn it into an array of linebot.Event. This is useful especially when you create LINE bot using their Messaging API with AWS Lambda and API Gateway.

Example

package main

import (
	"os"

	"github.com/aws/aws-lambda-go/events"
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/shuheiktgw/go-lambda-linebot/parser"
)

func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
	lineEvents, err := parser.ParseRequest(os.Getenv("CHANNEL_SECRET"), &request)
	
	# Do something useful...
}

func main() {
	lambda.Start(handler)
}

The implementation of parser.ParseRequest follows webhook.go in line/line-bot-sdk-go.

Install

$ go get github.com/shuheiktgw/go-lambda-linebot/parser

Author

Shuhei Kitagawa

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL