├── README.md └── render.yaml /README.md: -------------------------------------------------------------------------------- 1 | # Deploy LINE Bot Python Examples on Render 2 | 3 | This repo can be used to deploy python examples in the [line-bot-sdk-python](https://github.com/line/line-bot-sdk-python/tree/master/examples) on [Render](https://render.com/). 4 | ## Prerequisites 5 | Make sure you have the following: 6 | - A dedicated [Messaging API channel](https://developers.line.biz/en/docs/messaging-api/getting-started/) for your bot. 7 | - A [Render account](https://dashboard.render.com/register) that doesn't require credit card to sign up. 8 | 9 | ## Deployment 10 | 1. Fork this repo. 11 | 2. Update `render.yaml` to comment/uncomment the services of LINE bot examples you want to deploy. 12 | 3. Cieck to deploy 13 | 14 | [![Deploy to Render](http://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy) 15 | 16 | 4. You will be prompted to input LINE channel secret and [access token](https://developers.line.biz/en/docs/messaging-api/channel-access-tokens/). You can find them on the [LINE Developers Console](https://developers.line.biz/console/). Channel secret is on the channel's `Basic settings` tab. Channel access token is on the channel's `Messaging API` tab. 17 | 5. Once the bot servcie is live, find the service `onrender` URL (e.g., `https://line-bot-python-.onrender.com`) on the Dashboard. Append `/callback` to the service URL to build the webhook URL (e.g., `https://line-bot-python-.onrender.com/callback`). Paste the webhook URL to the `Webhook settings` section on the LINE channel's `Messaging API` tab on the [LINE Developers Console](https://developers.line.biz/console/). Also enable `Use webhook` on the same section. 18 | 6. Add the LINE Official Account associated with your bot as a friend on LINE by scanning the QR code on the `Messaging API` tab of your channel settings on the [LINE Developers Console](https://developers.line.biz/console/). 19 | 7. That's it. Send your LINE Official Account a text message on LINE and confirm that it responds with the same message. 20 | 21 | ## Notes 22 | - If your LINE bot app files are in the same repo as `render.yaml`, you don't need to specify `repo` in the `render.yaml`. You can find more information in the [Render Blueprint spec](https://render.com/docs/blueprint-spec#repo--branch). 23 | -------------------------------------------------------------------------------- /render.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | - type: web 3 | name: line-bot-python-flask 4 | env: python 5 | repo: https://github.com/line/line-bot-sdk-python.git 6 | buildCommand: cd examples/flask-echo;pip install gunicorn -r requirements.txt 7 | startCommand: cd examples/flask-echo;gunicorn app:app 8 | plan: free 9 | autoDeploy: false 10 | envVars: 11 | - key: LINE_CHANNEL_ACCESS_TOKEN 12 | sync: false 13 | - key: LINE_CHANNEL_SECRET 14 | sync: false 15 | # - type: web 16 | # name: line-bot-python-flask-with-handler 17 | # env: python 18 | # repo: https://github.com/line/line-bot-sdk-python.git 19 | # buildCommand: cd examples/flask-echo;pip install gunicorn -r requirements.txt 20 | # startCommand: cd examples/flask-echo;gunicorn app_with_handler:app 21 | # plan: free 22 | # autoDeploy: false 23 | # envVars: 24 | # - key: LINE_CHANNEL_ACCESS_TOKEN 25 | # sync: false 26 | # - key: LINE_CHANNEL_SECRET 27 | # sync: false 28 | # - type: web 29 | # name: line-bot-python-flask-kitchensink 30 | # env: python 31 | # repo: https://github.com/line/line-bot-sdk-python.git 32 | # buildCommand: cd examples/flask-kitchensink;pip install gunicorn -r requirements.txt 33 | # startCommand: cd examples/flask-kitchensink;gunicorn app:app 34 | # plan: free 35 | # autoDeploy: false 36 | # envVars: 37 | # - key: LINE_CHANNEL_ACCESS_TOKEN 38 | # sync: false 39 | # - key: LINE_CHANNEL_SECRET 40 | # sync: false 41 | # - type: web 42 | # name: line-bot-python-simple-server 43 | # env: python 44 | # repo: https://github.com/line/line-bot-sdk-python.git 45 | # buildCommand: cd examples/simple-server-echo;pip install -r requirements.txt 46 | # startCommand: cd examples/simple-server-echo;python app.py 47 | # plan: free 48 | # autoDeploy: false 49 | # envVars: 50 | # - key: LINE_CHANNEL_ACCESS_TOKEN 51 | # sync: false 52 | # - key: LINE_CHANNEL_SECRET 53 | # sync: false 54 | # - type: web 55 | # name: line-bot-python-aiohttp 56 | # env: python 57 | # repo: https://github.com/line/line-bot-sdk-python.git 58 | # buildCommand: cd examples/aiohttp-echo;pip install -r requirements.txt 59 | # startCommand: cd examples/aiohttp-echo;python app.py 60 | # plan: free 61 | # autoDeploy: false 62 | # envVars: 63 | # - key: LINE_CHANNEL_ACCESS_TOKEN 64 | # sync: false 65 | # - key: LINE_CHANNEL_SECRET 66 | # sync: false 67 | --------------------------------------------------------------------------------