Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

AWS-python-line-echo-bot

This is a simple echo bot on LINE bot. (python), built with line-bot-sdk v3.

Before you start

  1. LINE developer account
  2. LINE Messaging API

Get Started

  1. Install serverless via npm
$ npm install -g serverless
  1. Setup your AWS credentials
$ export AWS_ACCESS_KEY_ID=<your-key-here>
$ export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>
  1. Setup your LINE bot secret & access token as environment variables (used by serverless.yml to populate the Lambda environment):
$ export CHANNEL_ACCESS_TOKEN=<your-channel-access-token>
$ export CHANNEL_SECRET=<your-channel-secret>
  1. Deploy the webhook function
$ npm install
$ serverless deploy

The webhook validates the X-Line-Signature header on every request (via WebhookParser) and replies to text messages using the Messaging API v3 client.

Notes on packaging

line-bot-sdk v3 pulls in pydantic / pydantic-core, a native (Rust) extension. The Lambda runtime is pinned to python3.13 because pydantic-core has no manylinux wheel for python3.14 yet — packaging on a non-Linux host would otherwise silently bundle the host's native wheel into the deployment artifact, crashing the function at cold start. custom.pythonRequirements also pins pipCmdExtraArgs to --platform manylinux2014_aarch64 --only-binary=:all: (with useUv: false, since uv doesn't accept pip's --platform flag) so packaging always fetches prebuilt Linux wheels for the deployed architecture, and fails loudly instead of silently if a compatible wheel isn't available.

Echo bot