Setup Line app integration on your local machine

Please follow the steps if you are trying to work with the Line integration on your local machine.

Prerequisites

  • Line Developer Account
  • Access to Line Developer Console
  • Ngrok or similar tunneling service
  • Running Chatwoot development environment

Setup Steps

1. Start Ngrok Server

Start a Ngrok server listening at port 3000 or the port you will be running the Chatwoot installation:

# Install ngrok if you haven't already
# Download from https://ngrok.com/download

# Start ngrok tunnel
ngrok http 3000

2. Update Environment Variables

Update the .env variable FRONTEND_URL in Chatwoot with the https version of the Ngrok URL:

# In your .env file
FRONTEND_URL=https://your-ngrok-subdomain.ngrok.io

3. Configure Line Developer Console

  1. Access Line Developer Console: Go to Line Developer Console
  2. Create a Provider (if you don’t have one)
  3. Create a New Channel and select “Messaging API”
  4. Configure Basic Settings:
    • Channel name
    • Channel description
    • Category
    • Subcategory

4. Get Required Credentials

From the Line Developer Console under the “Messaging API” channel, collect the following values:

  1. Channel Name
  2. LINE Channel ID
  3. LINE Channel Secret
  4. LINE Channel Token

5. Start Chatwoot Server

Start the Chatwoot server and create a new Line channel with the values obtained from Line Developer Console:

# Start the development server
make run
# or
foreman start -f Procfile.dev

6. Create Line Channel in Chatwoot

  1. Access Chatwoot: Go to your Chatwoot instance (http://localhost:3000)
  2. Navigate to SettingsInboxesAdd Inbox
  3. Select Line as the channel type
  4. Enter Line Credentials:
    • Channel Name
    • LINE Channel ID
    • LINE Channel Secret
    • LINE Channel Token
  5. Save Configuration

Configure Webhook in Line Developer Console

After creating the channel, Chatwoot will provide a webhook URL for the channel. You need to configure this webhook URL in the Line Developer Console:

Steps to Configure Webhook

  1. Go to Line Developer Console → Your Channel → Messaging API
  2. Find Webhook Settings
  3. Set Webhook URL: Use the URL provided by Chatwoot
    https://your-ngrok-subdomain.ngrok.io/webhooks/line/your-channel-id
  4. Enable Webhook: Toggle the webhook to “Enabled”
  5. Verify Webhook: Use the “Verify” button to test the connection

Additional Line Settings

Configure these settings in the Line Developer Console:

  • Auto-reply messages: Disable (so Chatwoot can handle responses)
  • Greeting messages: Optional
  • Webhook redelivery: Enable for reliability

Testing the Integration

If the webhook is registered correctly with Line, your Ngrok server should receive events for new Line messages, and new conversations will be created in Chatwoot.

Test Steps

  1. Add your Line bot as a friend using the QR code or bot ID
  2. Send a message to your Line bot
  3. Check Ngrok logs to see if the webhook request is received
  4. Check Chatwoot to see if a new conversation is created
  5. Reply from Chatwoot to test bidirectional communication

Troubleshooting

Line API Features

Line offers various features you can integrate:

  • Rich Messages: Cards, carousels, quick replies
  • Flex Messages: Custom layouts
  • LIFF (Line Frontend Framework): Web apps within Line
  • Line Login: User authentication

Next Steps

After successful setup:

  1. Test message flow between Line and Chatwoot
  2. Configure agent assignments for Line conversations
  3. Set up automated responses if needed
  4. Explore rich message features for enhanced user experience
  5. Review webhook logs for debugging

Getting Help

If you encounter issues:

Useful Resources


Your Line integration is now ready for development and testing! 💬