Here is a simple LINE BOT that can echo back text and sticker. Back end server is AWS Lambda, and running code is Python 3.6. Let get started.

Prerequisite: LINE Business account has been registered for to use the Messaging API.

*If you didn’t register it. Go to the site.

1. Create Lambda function

Login AWS management console and select Lambda service. Click “Get Started Now“.

Select “Basic Function”

Select dotted line area and select “API Gateway” from a pull down list.

Security change to the “Open” and click “Next

Input the Name as appropriate name and Runtime change to the Python 3.6.

Role set to the “Create new role from template(s)” and input appropriate name into the Role name, and click “Next“.

Click “Create function

Create lambda function has completed. Copy the API Gateway URLs.

2. Setting LINE BOT

Go to the LINE developers ➡️ Basic information. Click “EDIT”.

Paste “API Gateway URLs” into Webhook URL and click “SAVE”.

Copy “Channel Access Token”.

3. Create a upload files

Open a Terminal. Create a working directory, install module, zip those files.

MacBook-Air:~ Tadashi$ mkdir lambda-line-bot
MacBook-Air:~ Tadashi$ cd lambda-line-bot/
MacBook-Air:lambda-line-bot Tadashi$ pip install requests -t .
MacBook-Air:lambda-line-bot Tadashi$ zip -r files.zip *

Create “lambda_function.py” file in the current directory.

4. Upload zip file

Go to the “Code” tab. Select “Code entry type” to “Upload a .ZIP file”

Click “Upload” button, (select a zip file which you made), Click “Save”.

Paste “Channel Access Token” into the ‘Authorization’: ‘Bearer ‘ + ‘ ‘, and click “Save”

5. Test

Add BOT account, and send text or sticker. you can get echo back message.