[PYTHON] I tried to create a linebot (preparation)

(1.First of all

Create a linebot. (The theme is Butler BOT) This article is about preparations for development, environment settings, etc. It was difficult to research various articles, so I summarized it as my own memo.

Implementation: https://qiita.com/maihamada/items/009f6b37baf34f9b7c6c

Contents to be explained

My environment

mac os 10.14.6 python 3.8.1

reference

--Search for LINE Developers terms below
https://developers.line.biz/ja/docs/glossary/

(2) Channel preparation (LINE Developers)

First, log in to LINE Developers.

Create a provider with LINE Developers

Press the create button on the screen that displays the provider. You can do this by entering the provider name (team name, etc.) and pressing the create button. スクリーンショット 2020-05-04 16.45.19.png

Create a channel

Fill in according to the screen for creating a channel. Select "Messaging API" as the channel type. スクリーンショット 2020-05-04 17.09.17.png スクリーンショット 2020-05-04 17.10.06.png スクリーンショット 2020-05-04 17.10.34.png

When you press the create button, channel creation is complete.

Get the required settings

Make a note somewhere as you will use it later. -Channel secret: Channel basic setting-> Channel secret -Channel access token: Messaging API settings-> Channel access token (to be issued)

(3) Preparation for GitHub

Heroku git is fine, but I used it because I wanted to organize the code on GitHub. Log in to GitHub.

Creating a remote repository

Press new repository. スクリーンショット 2020-05-04 17.54.36.png Describe the Repository name and set python to gitignore. 68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3633313535342f31333533363966352d356533302d663965302d303432392d6536393230346231343030352e706e67.png

SSH key settings

I referred to the following site. https://qiita.com/shizuma/items/2b2f873a0034839e47ce

Get remote repository

In the terminal, do the following:

$ cd [Working directory] 
$ git clone [Git hub SSH key([email protected]:~)]
Cloning into '[Repository name]'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

(4) Server preparation (HEROKU)

Create app

After logging in to HEROKU, select Dashboard on the upper left. スクリーンショット 2020-05-04 17.28.23.png

When you press the NEW-> Create new app button, the following screen will appear. Enter the App name and press Create App. スクリーンショット 2020-05-04 17.35.30.png

Works with GitHub

On the Deploy tab, specify GitHub. Specify the branch name and press connect to complete the link. スクリーンショット 2020-05-04 18.14.46.png

Enable automatic deployment from GitHub

Just press the button surrounded by red below. スクリーンショット 2020-05-09 13.53.16.png

(4) Put the library in python

I will put in the library used this time. Do the following in your terminal:

$ pip install flask
$ pip install line-bot-sdk

Check the library with the following command, and if it is written, it's OK.

$ pip freeze

This is the end of preparation. Go into the implementation.

Recommended Posts

I tried to create a linebot (preparation)
I tried to create a linebot (implementation)
I tried to create a table only with Django
I tried to create Quip API
I tried to automatically create a report with Markov chain
I tried to create a bot for PES event notification
I tried to make a Web API
I tried to create a server environment that runs on Windows 10
I tried to create a simple credit score by logistic regression.
I tried to create a list of prime numbers with python
I tried to create Bulls and Cows with a shell program
I tried to debug.
I tried to paste
I tried to build a super-resolution method / ESPCN
I want to easily create a Noise Model
I tried to build a super-resolution method / SRCNN ①
I want to create a window in Python
I want to create a plug-in type implementation
I tried to generate a random character string
I tried to build a super-resolution method / SRCNN ③
I tried to build a super-resolution method / SRCNN ②
I tried to make a ○ ✕ game using TensorFlow
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I tried to create a plug-in with HULFT IoT Edge Streaming [Development] (2/3)
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
[Outlook] I tried to automatically create a daily report email with Python
I tried to create a plug-in with HULFT IoT Edge Streaming [Setup] (1/3)
I tried to create a sample to access Salesforce using Python and Bottle
I tried to make a "fucking big literary converter"
I tried to learn PredNet
I tried to create a class that can easily serialize Json in Python
I tried to draw a route map with Python
I tried to organize SVM.
I tried to implement a pseudo pachislot in Python
When I tried to create a virtual environment with Python, it didn't work
I tried to implement a recommendation system (content-based filtering)
I tried to implement PCANet
I tried to easily create a fully automatic attendance system with Selenium + Python
[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
[Go + Gin] I tried to build a Docker environment
I tried to automatically generate a password with Python3
I tried to reintroduce Linux
I want to manually create a legend with matplotlib
I tried to introduce Pylint
I tried to create a button for Slack with Raspberry Pi + Tact Switch
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to draw a configuration diagram using Diagrams
I tried to create a model with the sample of Amazon SageMaker Autopilot
I tried to create a reinforcement learning environment for Othello with Open AI gym
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried to create a class to search files with Python's Glob method in VBA
I tried scraping food recall information with Python to create a pandas data frame
I tried to implement a volume moving average with Quantx
I tried to implement a basic Recurrent Neural Network model
I tried to create API list.csv in Python from swagger.yaml
I tried to implement a one-dimensional cellular automaton in Python
[Markov chain] I tried to read a quote into Python.
I made a tool to create a word cloud from wikipedia
I tried to solve a combination optimization problem with Qiskit