line-rails-app-sandbox
This repository is the setup and integration steps for incorporating LINE Login and LINE Messaging into a Ruby on Rails application.
Dependency versions
- rails (7.0.8)
- devise (4.9.2)
- line-bot-api (1.28.0)
- typhoeus (1.4.0)
- Line Login (v2.1)
Line Login
line-rails-app-sandbox.mp4
Setting Up Environment Variables
Before proceeding, ensure that you have filled in the following environment variables in your server environment from LINE Developers:
LINE_CHANNEL_ID
LINE_CHANNEL_SECRET
LINE_LOGIN_CALLBACK_URL=https://xxxx.ngrok-free.app/line_login_api/callback
Running the Local Environment
Launch a local Rails server:
bin/rails s
Create a publicly accessible URL for your local server using Ngrok:
ngrok http 3000
Ngrok will generate a publicly accessible URL, e.g., https://xxxx.ngrok-free.app.
Open the generated URL for external access:
URL=https://xxxx.ngrok-free.app
open URL
LINE Login Integration
- Navigate to your Rails application's root page.
- Click on the LINE Login link.
- On the Line authentication page, click Log in.
- You will then receive a representation displaying your LINE user ID.
LINE Messaging
RPReplay_Final1695886747.MP4
Setting Up Environment Variables
Before proceeding, ensure that you have filled in the following environment variables in your server environment from LINE Developers:
LINE_CHANNEL_MESSAGE_ID
LINE_CHANNEL_MESSAGE_SECRET
LINE_CHANNEL_MESSAGE_TOKEN
Setting up the Webhook URL in LINE Developers Console
Set the Webhook URL to https://xxx.ngrok-free.app/line_message_api/callback.
LINE Messaging API Integration
- Establish a connection with your LINE Official Account within your Line app.
- Receive a welcome greeting message from the LINE Official Account.
- Submit a message the letter 'A'.
- Expect to receive a response message in return.
Contributing
Bug reports and pull requests are welcome on Github at https://github.com/smapira. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Changelog
Available here.
Code of Conduct
Everyone interacting in the project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.