Skip to content

highesttt/matrix-line-messenger

Repository files navigation

matrix-line-messenger

Go Report Card Languages License

A Matrix bridge for LINE Messenger using mautrix-go.
Based on the mautrix-twilio bridge

Warning

When updating from a version released before February 14, 2026, please make sure to reset your configuration and log in again.
This is due to a change in the login flow that requires users to log in again to fetch the necessary keys for E2EE decryption.

Known issues

Note

Messages sent to the LINE Bot using Beeper Desktop may appear as indefinitely sending.
Use Beeper Mobile to send commands to the LINE Bot account after creating the chat with Beeper Desktop.

Features

  • Messages (Text, Images, Videos, voice notes and any other kind of files)
  • Read receipts
  • Reaction support (Receive ONLY)
  • Replies
  • Prefetch missed chats upon starting the bridge
  • Group chats
  • Sticker retrieval support
  • Link previews
  • Message unsending/deletion
  • Leaving chats

How to Use

  1. Prerequisites:

    • For Windows users: Install MSYS2 and gcc for mingw-w64
    # Step 1: Make sure you have MSYS2 installed and gcc for mingw-w64
    winget install MSYS2.MSYS2
    # Open MSYS2 MinGW 64-bit terminal and install necessary packages
    pacman -Syu mingw-w64-x86_64-gcc cmake

    Ensure you have Docker and Docker Compose installed on your system. If you want to build and run without Docker, ensure you have Go installed along with necessary build tools, such as the olm library.

    • For Beeper users: Compile bbctl from source if you don't have it already:
    git clone https://github.com/beeper/bridge-manager.git
    cd bridge-manager
    
    # For windows users only:
    # In cmd/bbctl/run.go, remove the following lines because MSYS2 is
    # still seen as Linux, but Windows doesn't support Setpgid:
    
    # if runtime.GOOS == "linux" {
    #     cmd.SysProcAttr = &syscall.SysProcAttr{
    #         // Don't pass through signals to the bridge.
    #         // We'll send a sigterm when we want to stop it.
    #         // Causes weird issues on macOS, so limited to Linux.
    #         Setpgid: true,
    #     }
    # }
    
    ./build.sh
  2. Clone the repository:

    git clone https://github.com/highesttt/matrix-line-messenger.git
    cd matrix-line-messenger
  3. Create a data directory for configuration and data storage:

    mkdir data
  4. Create a configuration file:

    • For Beeper users (using bbctl):
    bbctl c --type bridgev2 sh-line > data/config.yaml
    • For self-hosted Matrix servers (Synapse, Conduit, etc.):

    First, build the bridge binary (see step 5), then generate the example config and registration:

    # Generate example config
    ./matrix-line -e -c data/config.yaml
    
    # Edit data/config.yaml and set:
    #   homeserver.address: http://localhost:8008  (your Matrix server URL)
    #   homeserver.domain: your.domain.com         (your Matrix server domain)
    #   appservice.database.uri: sqlite:///data/matrix-line.db  (or a postgres URI)
    
    # Generate appservice registration
    ./matrix-line -g -c data/config.yaml -r data/registration.yaml

    Then register the appservice with your homeserver by adding the registration file path to your homeserver config. For Synapse, add it to app_service_config_files in homeserver.yaml, then restart the homeserver.

  5. Build and run the bridge using Docker (use -d for detached mode):

    • Using Docker Compose:
    docker compose up --build -d

    To run the bridge without rebuilding, use:

    docker compose up -d
    • Building and running without Docker on Windows (MSYS2 and x86_64-w64-mingw32-gcc required)
    # Clone and build olm if not already done
    git clone https://gitlab.matrix.org/matrix-org/olm.git
    cd olm
    cmake -Bbuild -G "Unix Makefiles" \
      -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
      -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
      -DCMAKE_INSTALL_PREFIX=/mingw64
    cmake --build build
    cmake --install build
    cd ..
    # Move the .dll and .dll.a files in the matrix-line root directory
    
    # Build the bridge.
    # Make sure the olm .dll file(s) are in the root of the project.
    ./build-windows.sh
    cd data
    ../matrix-line.exe
    • Other systems:
    ./build.sh
    cd data
    ../matrix-line

Login

Using the LINE SelfHosted Bridge Bot

  1. Open the Matrix client of your choice and start a chat with @sh-linebot:your.matrix.homeserver.domain. For local Beeper bridges, use @sh-linebot:beeper.local.
  2. Send the command login and follow the instructions to log in to your LINE account.

or

Via Beeper Desktop Settings

  1. Open Beeper Desktop Settings
  2. Navigate to Bridges
  3. Click the three dots next to your LINE Bridge and select Experimental: Add an account
  4. Follow the instructions to log in to your LINE account.

Can't log in?

There are two common reasons login can fail:

1. No email is set on your LINE account

This bridge uses the email from your account information. If your account is older, you signed in using a phone number, or you signed in with Google, you may not have an email set for your LINE account.

How to set an email for your LINE account:

  1. Open the LINE app on your mobile device.
  2. Go to Settings > Account.
  3. Tap on Email address and set your email address.

2. Letter Sealing (End-to-End Encryption) is disabled

This bridge requires LINE's end-to-end encryption feature, Letter Sealing, to be enabled. If it is disabled, the login will fail with Error when logging in: Internal error.

How to enable Letter Sealing:

  1. Open the LINE app on your mobile device.
  2. Go to Settings > Privacy.
  3. Turn Letter Sealing on (note: it can't be turned off once you do so)
  4. Try logging in to the bridge again.

Note

  • The Letter Sealing setting is only configurable from the LINE mobile app.
  • Once the setting's turned on it can't be turned off.
  • Letter Sealing was introduced as an optional feature in August 2015.
  • It was enabled by default in major LINE clients in 2016.
  • Since 2021, it has been enabled by default in all regions.
  • For more information, see issue #42.

About

A bridgev2 project for bridging Matrix and LINE - Best used with Beeper

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors