---
title: Line App Integration Setup
description: Setup Line app integration on your local machine for development
sidebarTitle: Line Setup
---

# 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](https://developers.line.biz/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:

```bash
# 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:

```bash
# 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](https://developers.line.biz/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:

```bash
# 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 Settings** → **Inboxes** → **Add 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

<Accordion title="Webhook verification fails">
**Problem**: Line webhook verification fails in Developer Console

**Solution**:
- Ensure your Ngrok URL is accessible publicly
- Check that `FRONTEND_URL` is set correctly in your `.env` file
- Verify the webhook URL format is correct
- Restart Chatwoot after updating environment variables
</Accordion>

<Accordion title="Messages not appearing in Chatwoot">
**Problem**: Line messages don't create conversations in Chatwoot

**Solution**:
- Check Ngrok logs for incoming webhook requests
- Verify webhook is enabled in Line Developer Console
- Check Chatwoot logs for any error messages
- Ensure all Line credentials are entered correctly
- Verify the channel is enabled in Chatwoot
</Accordion>

<Accordion title="SSL/TLS errors">
**Problem**: SSL certificate issues with webhook

**Solution**:
- Use the `https` version of your Ngrok URL
- Ensure Ngrok is running properly
- Line requires HTTPS for webhook URLs
- Try restarting Ngrok and updating the webhook
</Accordion>

<Accordion title="Authentication errors">
**Problem**: Line API authentication failures

**Solution**:
- Verify Channel ID, Channel Secret, and Channel Token are correct
- Check that the channel is published and not in development mode
- Ensure the Messaging API is enabled for your channel
- Regenerate Channel Token if necessary
</Accordion>

## 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:

- **Check Logs**: Review both Chatwoot and Ngrok logs
- **Line Developers Documentation**: [Official Line API Docs](https://developers.line.biz/en/docs/)
- **Common Errors**: See [Common Errors](/contributing/project-setup/common-errors)
- **Community Support**: [Discord](https://discord.com/invite/cJXdrwS)

## Useful Resources

- **Line Messaging API Documentation**: [https://developers.line.biz/en/docs/messaging-api/](https://developers.line.biz/en/docs/messaging-api/)
- **Line Developer Console**: [https://developers.line.biz/console](https://developers.line.biz/console)
- **Webhook Test Tool**: Available in Line Developer Console

---

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