bunline is a reimplementation of LINE Notify API (which has been deprecated and set to sunset on March 31, 2025) on top of LINE’s Messaging API using the Bun JavaScript runtime. This project aims to be a drop-in replacement for the LINE Notify API and provide a seamless transition for users from LINE Notify to the LINE Messaging API.
- Mimics the LINE Notify API endpoint for easy migration
- Supports sending text messages, images, and stickers
- Configurable through a JSON file (also supports zero-configuration mode)
- Uses the LINE Messaging API as the backend
- Bun runtime
- LINE Messaging API channel
- Channel Access Token
- User ID or Group ID for message recipients
For detailed instructions on obtaining the Channel Access Token and User/Group ID, refer to this LINE Notify Migration Tips article (Thai language).
There are 3 ways to provide configuration to bunline.
Method | Description |
---|---|
Configuration file | Configuration is stored in config.json . |
Environment variable | Configuration is encoded as a base64 string and passed as the CONFIG_BASE64 environment variable. |
Zero-configuration | No configuration needed. |
- With configuration, bunline will only accept the configured access tokens. The configuration provides a mapping from LINE Notify access tokens to corresponding LINE Messaging API parameters (channel access token and recipient ID). If you already use LINE Notify, you can keep using the same access token and you only have to change the endpoint URL.
- Without configuration, bunline will expect the LINE Notify access token to be in this format:
<channel-access-token>|<user-id-or-group-id>
. You will need to update both the endpoint URL and the access token when migrating from LINE Notify.
Create a config.json
file with the following structure:
{
"accessTokens": {
"<your-access-token>": {
"channelAccessToken": "<your-channel-access-token>",
"to": "<user-id-or-group-id>"
}
}
}
- Create a configuration file per above
- Encode the configuration file as a base64 string:
base64 -w 0 config.json
- Set the
CONFIG_BASE64
environment variable with the base64 string
If you don't want to use a configuration file, you can just start the server without any configuration. In this mode, bunline will be a simple adapter. It will expect an access token to be in the format <channel-access-token>|<user-id-or-group-id>
and it will pass them on directly to the LINE Messaging API.
To run the server using Docker (with a configuration file):
docker run -ti --rm -v $PWD/config.json:/app/config.json --init -p 3717:3717 ghcr.io/dtinth/bunline:main
To run the server using Docker (without a configuration file):
docker run -ti --rm --init -p 3717:3717 ghcr.io/dtinth/bunline:main
Run the server:
bun start
The server will start on port 3717 by default. You can change the port by setting the PORT
environment variable.
To migrate from LINE Notify to this solution:
- Create a LINE Official Account and link it to the LINE Messaging API.
- Generate a Channel Access Token.
- Find the User ID or Group ID for message recipients. Refer to LINE Notify Migration Tips article for more information.
- Update your existing code to use the new endpoint.
PORT
: Set the server port (default: 3717)CONFIG_PATH
: Set the path to the configuration file (default: config.json)LINE_API_BASE
: Set the LINE API base URL (default: https://api.line.me)
- Image file uploads via the
imageFile
parameter are not supported - This is a basic implementation and may not cover all LINE Notify features
bunline includes end-to-end tests to ensure its functionality. These tests are defined in the e2e.test.ts
file and can be run locally or as part of the CI/CD pipeline.
To run the tests locally:
-
Ensure you have Bun installed on your system.
-
Create a test configuration file:
bun scripts/create-test-config.ts
-
Run bunline, pointing to the mock LINE API server:
env LINE_API_BASE=https://mockapis.onrender.com/line CONFIG_PATH=test-config.json bun start
-
In a separate terminal, run the tests:
bun test