> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up LINE

[Back to messaging or digital channels](https://koreai.mintlify.site/agent-platform/channels.md#messaging-or-digital-channels)

Connect a LINE Official Account to your agent so people reach it in LINE for chat and media messaging. You prepare a Messaging API channel, identify the bot, enter its credentials in Artemis, then register and verify the webhook.

The setup requires:

1. [Prepare the LINE Official Account](#prepare-the-line-official-account) and its Messaging API channel.
2. [Artemis channel configuration](#artemis-channel-configuration): collect the bot's credentials and create the connection.
3. [Webhook configuration in LINE](#webhook-configuration-in-line): register, verify, and turn on the webhook.
4. [Verify the connection](#verify-the-connection) with a real LINE conversation.

After setup, LINE posts every event for the channel to Artemis. Artemis resolves the connection from the payload, and the agent replies in the same chat.

**Important considerations**

* **The Destination ID selects the connection**: LINE sends the bot's user ID in each webhook's `destination` field, and Artemis uses it to find the connection before it verifies the signature. It must be the `U`-prefixed bot `userId`, not the numeric Channel ID, the `@`-prefixed Basic ID, or your personal user ID.
* **Official Account Manager creates the channel**: Enabling the Messaging API on the Official Account creates the channel. LINE no longer creates Messaging API channels directly in the Developers Console.
* **Provider selection is permanent**: You can't change it later, and each user gets a different user ID under each provider.
* **LINE turns on automatic replies by default**: Greeting messages and auto-reply messages send a LINE-managed response alongside the agent's reply. LINE recommends turning them off for a first Messaging API bot.

## Prerequisites

Confirm these before you start.

* A LINE Business ID, and admin access to the Official Account and its Messaging API channel. Lower roles can't see several controls.
* Admin access to the provider you intend to use. A provider appears in the list only when you hold that role.
* Artemis project access with permission to open **Deployments** > **Channels**, and a deployed agent in the environment you intend to bind.

***

## How Artemis routes LINE events

LINE sends every event to one generic URL, so Artemis identifies the connection from the signed body.

| Piece | Owner | What it does |
| - | - | - |
| **Destination ID** | LINE | Routes inbound events by matching the top-level `destination` field. |
| **Channel Secret** | LINE | The HMAC-SHA256 key that verifies `X-Line-Signature` over the unchanged body. |
| **Channel Access Token** | LINE | Authorizes replies, push messages, bot info lookups, and the loading indicator. |
| **Webhook URL** | Artemis | Receives events at `/api/v1/channels/line/webhook`, with no identifier in the path. |

***

## Prepare the LINE Official Account

Do this in LINE before you open Artemis. Select **Open Official Account Manager** or **Open LINE Developers Console** in the setup guide to jump straight there.

**1. Create or select an Official Account**

In [LINE Official Account Manager](https://manager.line.biz/), create the customer-facing account or select the one that should represent the agent. Complete its name, profile image, region, and administrator access.

For a new organization, register a Business ID at [account.line.biz](https://account.line.biz/) and complete the [Official Account entry form](https://entry.line.biz/form/entry/unverified) first.

**2. Enable the Messaging API**

Go to **Settings** > **Messaging API** and enable it. Choose the correct LINE Developers provider. You can't treat provider ownership as an environment toggle later.

**3. Open the linked Messaging API channel**

In the [LINE Developers Console](https://developers.line.biz/console/), select the provider and the Messaging API channel linked to the Official Account. The **Basic settings** and **Messaging API** tabs hold the credentials and webhook controls.

**4. Review response settings**

In Official Account Manager, open **Settings** > **Response settings**. Turn off **Greeting messages** and **Auto-reply messages** when the agent owns every reply, or author them deliberately so users don't get conflicting responses.

***

## Artemis channel configuration

Collect the credentials, then create the connection before you select **Verify** in LINE.

**1. Copy the Channel Secret**

On the channel's **Basic settings** tab, copy **Channel secret**. You need the admin role to see it. Artemis uses it as the HMAC-SHA256 key for `X-Line-Signature` verification.

**2. Issue or copy a Channel Access Token**

On the **Messaging API** tab, issue a token that can call the Messaging API.

| Token type | Validity | How to issue it |
| - | - | - |
| User-specified expiration (v2.1) | Up to 30 days | API call. LINE recommends it, so schedule rotation before it expires. |
| Long-lived | Until you revoke it | **Issue** on the **Messaging API** tab. Reissuing it invalidates the previous token immediately. |
| Short-lived or stateless | 30 days or 15 minutes | API call. |

**3. Get the bot's Destination ID**

Call [Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info) with the channel access token, and copy the `userId` from the response. It begins with `U`.

```bash theme={null}
curl -X GET https://api.line.me/v2/bot/info \
  -H "Authorization: Bearer <channel-access-token>"

# Copy userId, not basicId or the numeric Channel ID
{
  "userId": "U0123456789abcdef0123456789abcdef",
  "basicId": "@123example",
  "displayName": "Support Bot"
}
```

Run it from a secure terminal, since the command carries your token.

**4. Create the connection**

1. In Artemis, go to **Deployments** > **Channels** > **LINE** > **+ New**. The **New LINE Connection** dialog opens, with the setup guide on the left and the fields on the right.
2. Configure the fields below, then select **Create**.

| Artemis field | What it controls |
| - | - |
| **Display Name** | The label operators see. Name it for the Official Account and environment. Routing ignores it. |
| **Destination ID** | The routing key. Enter the `U`-prefixed bot `userId`. |
| **Channel Access Token** | Authorizes every outbound call to LINE. |
| **Channel Secret** | Verifies the signature on each inbound event. |
| **Environment** | The environment whose active deployment answers messages. Leave the working copy default only while you develop. |
| **Provider Verification Strength** | How far the runtime trusts LINE's identity assertion when it links a person to an existing session. Choose **Strong** only when you base continuity and account-linking decisions on it. |
| **Initial Status** | Keep it **Active**. LINE verification resolves only for an active connection. |

Copy the **Webhook URL** from the connection's summary panel.

> [!WARNING]
>
> Treat both credentials as secrets. Never place the Channel Secret or Channel Access Token in browser code, screenshots, tickets, or source control, and update Artemis as soon as LINE reissues or revokes either one.

***

## Webhook configuration in LINE

LINE separates saving the URL from turning delivery on, so a verified webhook can still deliver nothing.

1. Confirm the connection exists with the correct Destination ID and Channel Secret, and is **Active**. LINE's verify request has no user message, but Artemis still resolves and authenticates the connection.
2. In the Developers Console, open the channel's **Messaging API** tab and find **Webhook settings**.
3. Select **Edit** under **Webhook URL**, paste the Artemis URL exactly, and select **Update**. LINE accepts one webhook endpoint per channel.
4. Select **Verify** and require **Success**. LINE sends an empty-event POST, and Artemis answers after it resolves the connection and verifies the signature. Stop if LINE reports a timeout, a non-200 response, a TLS error, or a signature failure.
5. Turn on **Use webhook**. Without it, LINE never delivers message events.
6. Turn on **Webhook redelivery** only when your operations policy needs retries after non-2xx responses. LINE can then deliver the same event more than once and change the order, so rely on event IDs.

> [!WARNING]
>
> Use the generic LINE URL exactly as shown. Don't append the Destination ID, Channel ID, project ID, or a connection identifier. LINE puts `destination` in the signed body, and Artemis routes from that value.

If you use a long-lived token, restrict API callers by IP address on the channel's **Security** tab. See [configure security settings](https://developers.line.biz/en/docs/messaging-api/building-bot/#configure-security-settings).

### Validation checklist

Work down this list once per connection.

| Validation item | Expected result |
| :- | :- |
| Prepare the account | Messaging API enabled under the right provider, with automatic replies reviewed. |
| Collect credentials | Channel Secret, Channel Access Token, and the `U`-prefixed Destination ID from the same channel. |
| Create the Artemis connection | Saved as **Active**. |
| Verify the webhook | LINE reports **Success**. |
| Turn on delivery | **Use webhook** is on. |
| Send a live message | One real conversation produces exactly one agent reply. |

***

## Verify the connection

Artemis has no synthetic test for this channel, so a real conversation is the only end-to-end proof.

1. Add the Official Account as a friend with the QR code or add-friend link on the **Messaging API** tab. Test from a normal LINE account, not an administrator-only console identity.
2. Send a unique text message.
3. Confirm the agent replies once in the same chat. A LINE auto-reply plus an agent reply means the response settings are still on.
4. Test each input type you intend to support. Receiving a media event doesn't guarantee the agent flow knows how to use the attachment.
5. If you need groups, turn on **Allow bot to join group chats** in Official Account Manager, invite the bot, message or mention it, and confirm sessions stay scoped to the LINE source.

| Input | What to confirm |
| - | - |
| `text` | The agent receives and answers it. |
| `image`, `video`, `audio`, `file` | The token downloads the content and the agent processes it. |
| `location`, `sticker` | The agent's authored behavior handles the event. |
| `postback` | The action returns to the same session. |

***

## Security and credential boundaries

The Channel Secret authenticates what comes in. The Channel Access Token authorizes what goes out.

* **Signatures**: Artemis computes HMAC-SHA256 over the unchanged raw body and compares it with `X-Line-Signature`.
* **Raw bytes**: Proxies and middleware must not rewrite the signed body. A changed byte, wrong secret, or reissued secret fails authentication.
* **Rotation**: Reissuing a Channel Secret invalidates the old one. Reissuing a long-lived token invalidates the previous token. Coordinate the Artemis update with the LINE change.
* **Environments**: Use distinct providers or channels, or at least distinct credentials and connections, for development and production. Never point two environments at the same webhook.

***

## Manage the channel connection

Open a connection from **Deployments** > **Channels** > **LINE** to manage it. The page has a header, three tabs, and a summary panel on the right.

**Header.** Shows the connection name, its environment badge, its status, and when it last changed. The **...** overflow menu holds the connection-level actions.

**Summary panel.** Stays visible on every tab.

| Field | Description |
| - | - |
| **Channel** and **Connection Type** | Read **LINE** and **Channel Connection**. |
| **Identifier** | The Destination ID this connection routes on. Check it first when messages arrive and no session appears. |
| **Credentials** | Reads **Configured** once credentials save. |
| **Webhook URL** | The webhook URL for LINE, with a copy control. |
| **Created** and **Updated** | Date and time of creation and of the last change. |

> [tab] Credentials
>
> Artemis encrypts credentials after you save them. Leave a field blank to keep its current value, or enter a new value to replace it.
>
> | Field | Description |
> | - | - |
> | **Use Auth Profile** | Turn it on, then select a saved auth profile in place of the fields below. |
> | **Channel Access Token** | Replace it promptly when you reissue the token, because the old one stops working. |
> | **Channel Secret** | Replace it if an administrator reissues the secret. Until you do, every inbound event fails verification. |
>
> Select **Save Credentials** to apply your changes.

> [tab] Configuration
>
> Update how the connection behaves. **LINE Settings** holds the provider-specific fields.
>
> | Setting | Description |
> | - | - |
> | **Display Name** | The label operators see. |
> | **Provider Verification Strength** | How far the runtime trusts LINE's identity assertion. |
> | **Destination ID** | Read-only, with a copy control. To serve another Official Account, create a new connection. |
> | **Message template** | The authorization message the connection sends when a tool needs the user to authorize. Insert variables from the chips, select **Show more** for the full list, and select **Show preview** to check it. |
> | **Webhook URL** | The webhook URL, with a copy control. |
>
> Select **Save Changes** to apply your changes.

> [tab] Deployment
>
> Choose which deployed version answers LINE.
>
> | Setting | Description |
> | - | - |
> | **Environment** | Under **Environment Binding**. Selects which deployed version handles incoming messages. |
> | **Active Deployment** | Shows the bound version and when someone deployed it. |
>
> Select **Save Changes** after you switch the environment.

***

## Troubleshoot connection issues

Most failures trace to the Destination ID, the Channel Secret, or the **Use webhook** toggle.

| Symptom | Likely cause | Recommended action |
| - | - | - |
| **Verify** doesn't show **Success** | No active connection, unreachable endpoint, or bad URL | Confirm the connection exists and is **Active**, the endpoint is reachable over trusted public HTTPS, the URL has no extra path segment, and LINE gets a `200` response. |
| No connection found | Wrong identifier saved | Replace the Destination ID with the `U`-prefixed `userId` from Get bot info. The Channel ID, Basic ID, and personal user IDs don't route. |
| Signature verification fails | Wrong or reissued secret, or a rewritten body | Copy the Channel Secret from the matching channel's **Basic settings**, check whether another admin reissued it, and confirm no proxy changes the raw body. |
| Verified but no messages arrive | **Use webhook** is off | Turn on **Use webhook**. |
| Messages arrive but the agent doesn't reply | Token or deployment issue | Check that the Channel Access Token is current, the connection is **Active**, the environment has a runnable deployment, and LINE hasn't revoked or expired the token. |
| Users receive two replies | LINE automatic replies still on | Turn off or deliberately coordinate **Greeting messages** and **Auto-reply messages** in Official Account Manager. |
| Direct messages work but groups don't | The bot can't join groups | Turn on **Allow bot to join group chats**, reinvite the bot if necessary, and confirm the test event comes from the expected group or room. |
| Text works but media doesn't | Unsupported type, token, or policy | Confirm Artemis supports the event type, the token can download message content, attachment limits allow the file, and the agent flow handles attachments. |

***

## LINE reference

Use these pages when you need detail beyond what this article covers. Artemis field names and the runtime URL shown in the connection stay the source of truth for this integration.

| Resource | Use it for |
| - | - |
| [Build a LINE bot](https://developers.line.biz/en/docs/messaging-api/building-bot/) | Tokens, the webhook URL, verification, and certificate requirements. |
| [Verify webhook signatures](https://developers.line.biz/en/docs/messaging-api/receiving-messages/#verify-signature) | How `X-Line-Signature` works. |
| [Channel access tokens](https://developers.line.biz/en/docs/basics/channel-access-token/) | How the token types differ. |
| [Messaging API reference](https://developers.line.biz/en/reference/messaging-api/) | Get bot info and webhook event objects. |

***

**Related articles:**

* [Channels](https://koreai.mintlify.site/agent-platform/channels.md)
* [Set up Messenger](https://koreai.mintlify.site/agent-platform/channels/messenger)
* [Set up Telegram](https://koreai.mintlify.site/agent-platform/channels/telegram)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.