This is a simple echo bot on LINE bot. (python), built with line-bot-sdk v3.
- LINE developer account
- LINE Messaging API
- Install serverless via npm
$ npm install -g serverless- Setup your AWS credentials
$ export AWS_ACCESS_KEY_ID=<your-key-here>
$ export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>- Setup your LINE bot secret & access token as environment variables (used by
serverless.ymlto populate the Lambda environment):
$ export CHANNEL_ACCESS_TOKEN=<your-channel-access-token>
$ export CHANNEL_SECRET=<your-channel-secret>- Deploy the webhook function
$ npm install
$ serverless deployThe webhook validates the X-Line-Signature header on every request (via WebhookParser) and replies to text messages using the Messaging API v3 client.
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.