> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/line.md).

# Connect a Conversation Platform: LINE

Connect a LINE Official Account: obtain the Channel ID, Channel Secret, and Channel Access Token, configure the Webhook URL, and open Web Chat within LINE using LIFF.

## <mark style="color:blue;">Before You Connect</mark> <a href="#pre-integration-checklist" id="pre-integration-checklist"></a>

* Create an "AI Assistant" on the [MaiAgent platform](https://admin.maiagent.ai/)
* Create a "Provider" and a LINE Official Account in the [LINE Developers](https://developers.line.biz/zh-hant/) console

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-4c57afd0e778526737fc9ac2313136c151427ec5%2F%E6%88%AA%E5%9C%96%202025-04-23%20%E4%B8%8B%E5%8D%884.47.49.png?alt=media" alt=""><figcaption></figcaption></figure>

## <mark style="color:blue;">Start Connecting</mark> <a href="#start-integration" id="start-integration"></a>

### 1. Go to <https://manager.line.biz/> and select the Official Account you want to connect <a href="#step-select-line-official-account" id="step-select-line-official-account"></a>

Click MaiAgent Testing:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-b259661331628fb8d70751be73bf58b1ff1363e7%2F%E6%88%AA%E5%9C%96%202025-04-23%20%E4%B8%8B%E5%8D%885.01.45.png?alt=media" alt=""><figcaption></figcaption></figure>

This opens the Official Account settings screen:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-9e55e5c3dc2374041854881b6719f3df3825b269%2Fimage%20(91).png?alt=media" alt=""><figcaption></figcaption></figure>

### 2. Click Settings in the upper-right corner <a href="#step-open-settings" id="step-open-settings"></a>

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-4c7a72ffe65370366469f48c041f2e4779895d93%2Fimage%20(92).png?alt=media" alt=""><figcaption></figcaption></figure>

On the following screen, click Messaging API in the left sidebar:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-2a672d36efd55a0a903906ff3ec5d9c38fa3a2b3%2Fimage%20(94).png?alt=media" alt=""><figcaption></figcaption></figure>

### 3. Enable the Messaging API service <a href="#step-enable-messaging-api" id="step-enable-messaging-api"></a>

a. Click <mark style="color:blue;">Enable Messaging API</mark>

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-e9cf1fba0bb93107e220ba5675f057ddadfec276%2Fimage%20(95).png?alt=media" alt=""><figcaption></figcaption></figure>

b. Select the Provider you just created (if you have not created one yet, you can still create a Provider on this page)

After selecting it, click <mark style="color:blue;">Agree</mark>

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-900971b42f688352ea2b8bbb5e032a4186cd7430%2Fimage%20(96).png?alt=media" alt=""><figcaption></figcaption></figure>

c. Provide documents such as a privacy policy (optional)

Next, you can enter URLs for your company's privacy policy and other documents. When finished, click "ok" to proceed to the final confirmation.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-9c5990ded93811136e85a654172838b736de6f41%2Fimage%20(97).png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
Before clicking ok for the final time, confirm that you have selected the correct Provider. This action cannot be undone after you click ok.
{% endhint %}

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-2738e6eeda74375881863013c9b4dee8a4211d9a%2Fimage%20(98).png?alt=media" alt=""><figcaption></figcaption></figure>

### 4. Obtain the <mark style="color:blue;">Channel ID</mark>, <mark style="color:blue;">Channel Secret</mark>, and <mark style="color:blue;">Channel Access Token</mark> <a href="#step-get-channel-credentials" id="step-get-channel-credentials"></a>

a. After clicking OK, you can obtain the <mark style="color:blue;">Channel ID</mark> and <mark style="color:blue;">Channel secret</mark> for this Messaging API service:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-62036a0837be41377d35148d132fa177eae230b2%2Fimage%20(99).png?alt=media" alt=""><figcaption></figcaption></figure>

b. Return to the [LINE Developers ](https://developers.line.biz/console/)page to obtain the Channel Access Token

Open the MaiAgent Provider you just created

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-0ca678190a3fc0ccc0026d1d94e97aa7ac8c991d%2Fimage%20(100).png?alt=media" alt=""><figcaption></figcaption></figure>

c. Find and open the MaiAgent Testing Channel you just created

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-6b8df2220047a11c45a07982d0f5b570b4245716%2Fimage%20(101).png?alt=media" alt=""><figcaption></figcaption></figure>

d. Switch to the Messaging API page and scroll down to the Channel access token section

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-7c72c96f2bb978a7fdf9137fa491da3f05ac8f66%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-21%20113719.png?alt=media" alt=""><figcaption></figcaption></figure>

e. Issue a <mark style="color:blue;">Channel access token</mark> and copy it

{% hint style="danger" %}
If the Official Account is already connected to another LINE management service, the Console usually already has a long-lived token. Copy and reuse it directly; **do not click Reissue**. Reissuing invalidates the old token (it can remain valid for at most another 24 hours), preventing the original service from replying. See [Migrate from another service to MaiAgent](#migrate-from-other-line-service).
{% endhint %}

If you have not yet issued a <mark style="color:blue;">Channel access token</mark>, click <mark style="color:blue;">Issue</mark>:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-262bfa573d9962d3818de76352aabb7475ce91dd%2Fimage%20(104).png?alt=media" alt=""><figcaption></figcaption></figure>

You can then obtain your <mark style="color:blue;">Channel access token</mark> and copy it for use:

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-df57c4306b08e8dc8a601e5311be6fd7ba285a1f%2Fimage%20(13).png?alt=media" alt=""><figcaption></figcaption></figure>

### 5. Go to Messaging Platforms in MaiAgent and select LINE <a href="#step-select-line-in-maiagent" id="step-select-line-in-maiagent"></a>

a. Click <mark style="color:blue;">Connect Messaging Platform</mark> in the upper-right corner

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-45051526831861d07352f6b1084732e923c9fa5b%2Fimage%20(102).png?alt=media" alt=""><figcaption></figcaption></figure>

b. Select LINE as the platform to connect

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-cb4498bb59b5516d1074ed0de41f6a5d03b07d41%2F%E6%88%AA%E5%9C%96%202025-05-07%20%E4%B8%8B%E5%8D%882.43.54.png?alt=media" alt=""><figcaption></figcaption></figure>

### 6. Enter a name, select an Agent, and paste the **Channel ID, Channel Secret, and** Channel Access Token you just obtained <a href="#step-fill-channel-credentials" id="step-fill-channel-credentials"></a>

The creation form has three tabs: <mark style="color:blue;">Basic Settings</mark>, <mark style="color:blue;">Feature Settings</mark>, and <mark style="color:blue;">Permission Settings</mark>. In <mark style="color:blue;">Basic Settings</mark>, fill in:

| Field                                                                                                   | Description                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="color:blue;">Name</mark>                                                                   | The name displayed for this messaging platform in the admin console                                                                                                                                                                                                                                                                      |
| <mark style="color:blue;">AI Assistant</mark>                                                           | Select the Agent to connect (the one marked "Default" is the organization's default Agent). You can leave this blank; AI will not reply if it is blank. See [Use human support only, without AI](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/web-chat/website.md#human-only-mode)                               |
| <mark style="color:blue;">LINE Channel</mark>                                                           | Paste the <mark style="color:blue;">Channel ID</mark>, <mark style="color:blue;">Channel Secret</mark>, and <mark style="color:blue;">Channel Access Token</mark> you just obtained                                                                                                                                                      |
| <mark style="color:blue;">Chat Settings</mark> › Only respond when @mentioned in groups                 | When enabled, the Agent only responds to messages that @mention it in LINE groups. When disabled, it responds to all messages in the group. See [Use in LINE groups](#line-group)                                                                                                                                                        |
| <mark style="color:blue;">AI Assistant Thinking Animation</mark>                                        | Enabled by default. When a user sends a message in a one-on-one chat, LINE immediately displays a loading animation until the Agent sends its reply (up to 60 seconds). The screen notes that this feature only works in one-on-one chats and is not displayed in groups. See [AI Assistant Thinking Animation](#line-loading-animation) |
| <mark style="color:blue;">Enable Reset Commands</mark>, <mark style="color:blue;">Reset Commands</mark> | When enabled, you can add one or more command phrases (such as "Start over"). When a user's LINE message exactly matches one of them, a new conversation starts for that user. The command itself receives no reply; AI responds in the new conversation when the user sends their next message                                          |

The <mark style="color:blue;">Feature Settings</mark> tab includes <mark style="color:blue;">AI Interaction Features</mark> (enable OCR) and <mark style="color:blue;">AI Awareness Settings</mark> (use system time in responses + time zone, use the sender's name in responses). See [Feature Settings](https://docs.maiagent.ai/maiagent-user-guide/en/build/conversation-settings/platform-settings/function-settings.md#messaging-platform-switches) for details. In the <mark style="color:blue;">Permission Settings</mark> tab, select which roles can see this platform. See [Messaging Platform Settings Overview](https://docs.maiagent.ai/maiagent-user-guide/en/build/conversation-settings/platform-settings.md#tab-map). You can change all these settings on the platform settings page after creation.

After entering the credentials, click <mark style="color:blue;">Test Connection</mark> to confirm that LINE accepts them ("Connection successful" appears on success). Then click the "<mark style="color:blue;">Connect Messaging Platform</mark>" button in the lower-right corner to finish setting up the messaging platform.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-44bf92a7f547e51f5f75fe14faf29cca9eabbbae%2Fline-create-form-loading-animation.png?alt=media" alt="Basic Settings tab of the LINE creation form: name, AI assistant, Webhook reminder, and three LINE channel credential fields. In Chat Settings, the group @mention toggle is off, AI Assistant Thinking Animation is on, and Enable Reset Commands is off"><figcaption><p>AI Assistant Thinking Animation is enabled by default when you create a LINE messaging platform</p></figcaption></figure>

#### AI Assistant Thinking Animation <a href="#line-loading-animation" id="line-loading-animation"></a>

This is LINE's official loading animation. When a user sends a message to the Official Account in a one-on-one chat, a loading animation appears in the conversation to let them know the Agent is processing it, so they do not mistake the wait for a lack of response. The animation disappears when the Agent sends its reply and is displayed for at most 60 seconds.

* **Enabled by default**: It is enabled for newly created LINE messaging platforms, and existing LINE messaging platforms have also been updated to enable it.
* **Displayed only for automatic Agent replies**: The animation does not appear when a human support agent has taken over the conversation, automatic replies are disabled, or the current time is outside the automatic reply hours.
* **Not displayed in groups**: LINE only supports this animation in one-on-one chats. Groups and multi-person chats are unaffected.

To disable the animation, go to <mark style="color:blue;">Messaging Platforms</mark>, open the LINE platform, turn off <mark style="color:blue;">AI Assistant Thinking Animation</mark> on the <mark style="color:blue;">Basic Settings</mark> tab, and click <mark style="color:blue;">Save</mark>.

### 7. Obtain the Webhook URL <a href="#step-get-webhook-url" id="step-get-webhook-url"></a>

When you create a messaging platform, the system automatically sets the LINE Official Account's Webhook URL to the MaiAgent URL and verifies it. If the creation success screen shows "Webhook URL automatically configured and verified", skip step 8 and go directly to step 9 to check the response settings. If it shows "Webhook URL automatically configured, but Use webhook is not enabled in LINE", the URL is already set; simply enable <mark style="color:blue;">Webhook</mark> in step 9. If it shows "Automatic Webhook URL configuration incomplete", configure it manually as described below.

In Messaging Platforms, select the LINE channel you just created, click Actions, and find the Webhook URL in the API section

### 8. At <https://manager.line.biz/>, click "Settings/Messaging API" and paste the Webhook URL you just obtained <a href="#step-set-webhook-url-in-line" id="step-set-webhook-url-in-line"></a>

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-eecf83c718171a6d06cac20257140ab7f41668e1%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-21%20122044.png?alt=media" alt=""><figcaption></figcaption></figure>

### 9. Adjust response settings: enable Webhook and disable auto-response messages <a href="#step-configure-messaging-api-channel" id="step-configure-messaging-api-channel"></a>

LINE Official Accounts have auto-response messages enabled by default. If you leave them on, LINE sends a default response when users send messages (for example, "Sorry, this account cannot reply to individual user messages"). See [Receiving LINE auto-response messages](#line-auto-response).

In [LINE Official Account Manager](https://manager.line.biz/), click <mark style="color:blue;">Settings</mark> in the upper-right corner, then <mark style="color:blue;">Response settings</mark> in the left sidebar. You can also reach the same page from the channel's <mark style="color:blue;">Messaging API</mark> tab in [LINE Developers](https://developers.line.biz/console/) by clicking <mark style="color:blue;">Edit</mark> under Auto-reply messages.

Configure the following settings:

| Item                                                                                                                         | Setting                                                                                                                                                                  | Description                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="color:blue;">Webhook</mark>                                                                                     | On                                                                                                                                                                       | When off, LINE does not forward messages to MaiAgent                                                                               |
| <mark style="color:blue;">Auto-response messages</mark> (the toggle shown when <mark style="color:blue;">Chat</mark> is off) | Off                                                                                                                                                                      | When on, LINE replies with its own default text                                                                                    |
| <mark style="color:blue;">Response method</mark> (the option shown when <mark style="color:blue;">Chat</mark> is on)         | Select <mark style="color:blue;">Manual chat</mark> for both <mark style="color:blue;">Response hours</mark> and <mark style="color:blue;">Outside response hours</mark> | If you select an option that includes "Auto-response messages", LINE replies automatically during that period                      |
| <mark style="color:blue;">Greeting message</mark>                                                                            | As needed                                                                                                                                                                | LINE sends this when a user adds the account as a friend. Edit its content in the LINE admin console; it is unrelated to the Agent |

MaiAgent works with <mark style="color:blue;">Chat</mark> either on or off. When it is on, support staff can view conversations and reply manually in the LINE admin console. The Agent will still reply to the same message as usual.

{% hint style="warning" %}
**Replies sent manually from the LINE admin console do not appear in MaiAgent.** LINE Webhook only sends MaiAgent events such as incoming user messages, unsent messages, and friend additions. LINE does not notify any external system about messages support staff send from the LINE Official Account Manager chat screen, nor does it provide a way to retrieve them later. This applies to any customer support system connected to the same Official Account. These replies are not recorded in "All Conversations", and the Agent cannot see this context when it takes over later. To keep conversation records complete, always reply from MaiAgent's support conversations. Use the LINE admin console for settings such as broadcasts and rich menus.
{% endhint %}

{% hint style="warning" %}
When <mark style="color:blue;">Response hours</mark> is enabled, the response method is split into two groups: "Response hours" and "Outside response hours". Select <mark style="color:blue;">Manual chat</mark> for both. If you only change response hours, auto-response messages will still appear at night and on holidays.
{% endhint %}

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-b0620ef7416611f019d89ca5676f4f2e981c63a8%2F%E6%88%AA%E5%9C%96%202025-04-23%20%E4%B8%8B%E5%8D%885.51.33.png?alt=media" alt="Response settings page in LINE Official Account Manager: Chat, Greeting message, and Webhook are enabled, and Manual chat is selected as the response method during response hours"><figcaption><p>Settings with Chat enabled: turn on Webhook and select Manual chat as the response method. Scroll down and confirm that Manual chat is also selected outside response hours</p></figcaption></figure>

### **10. Verify the connection** <a href="#step-verify-integration" id="step-verify-integration"></a>

Try adding your own LINE Official Account as a friend and having a conversation with the Agent

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-d3f81c1c9b7e84203137e9f54aef019209f73860%2F%E6%88%AA%E5%9C%96%202025-04-23%20%E4%B8%8B%E5%8D%886.34.27.png?alt=media" alt=""><figcaption></figcaption></figure>

If you can view the conversation in both <https://manager.line.biz/> and All Conversations in MaiAgent, the connection is successful!

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-4d59bf9fc4fe7c1f8ac476d18bab8b515766f9dc%2F%E6%88%AA%E5%9C%96%202025-04-23%20%E4%B8%8B%E5%8D%886.43.12.png?alt=media" alt=""><figcaption></figcaption></figure>

## Open Web Chat within LINE (LINE LIFF) <a href="#line-liff" id="line-liff"></a>

To let users open the web chat window directly within LINE (for example, from a rich menu, with their LINE identity passed in), embed Web Chat using LINE LIFF. This requires creating a LIFF App in LINE Developers and configuring its URL. For instructions, see [LINE LIFF: What is LINE LIFF](https://docs.maiagent.ai/tech/serve/whatislineliff) in the technical manual.

## Monthly Message Quota <a href="#line-monthly-quota" id="line-monthly-quota"></a>

LINE Official Accounts have a monthly limit on push messages (depending on the plan you purchase from LINE). Open the LINE messaging platform's <mark style="color:blue;">Basic Settings</mark> tab. The <mark style="color:blue;">Monthly Message Quota</mark> card at the top queries LINE in real time and displays the <mark style="color:blue;">Monthly Quota</mark>, <mark style="color:blue;">Used This Month</mark>, and <mark style="color:blue;">Remaining</mark> (unlimited plans display "Unlimited"). When the quota is exhausted, the card turns red with the warning "LINE monthly message quota exhausted". **During this period, replies from both AI and human support staff cannot reach LINE users**, and the corresponding messages on the conversation page are marked [Undelivered](https://docs.maiagent.ai/maiagent-user-guide/en/serve/daily-operations/reply.md#delivery-failed). Upgrade your plan in LINE Official Account Manager or wait for the quota to reset next month.

For example, during an end-of-month sale, a customer support manager at an online store learns that customers have asked about orders on LINE but received no reply. In <mark style="color:blue;">All Conversations</mark>, the Agent's reply shows "Undelivered: LINE monthly message quota exhausted" underneath. The manager then checks <mark style="color:blue;">Basic Settings</mark> for the LINE messaging platform, confirms that the monthly message quota is exhausted, and upgrades the plan in LINE Official Account Manager. Subsequent replies can then be sent normally.

## Message Formatting and Consecutive Messages <a href="#message-format-and-merging" id="message-format-and-merging"></a>

* **Automatic Markdown conversion to plain text**: LINE does not render Markdown. Before an Agent reply is sent to LINE, formatting such as headings, bold and italic text, links, tables, and code is automatically converted to clean plain text (links become "text URL", and each table row becomes a list item on its own line). You do not need to tell the Agent to avoid Markdown in its role instructions. Text entered by human support staff, Flex cards, and quick reply buttons are unaffected. See [Message Content Rendering Optimization: Messaging Channels](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/web-chat/markdown-rendering.md#messaging-channels-plain-text) for details
* **Consecutive messages merged into one turn**: When a user sends several images in succession in a one-on-one chat, or sends an image followed by text, the Agent waits for the sequence to arrive and responds once (for messages containing only images or files, it waits until about 4 seconds after the last message with no new messages, up to about 20 seconds; text triggers an immediate reply, and multiple images selected together are processed after the whole set arrives). It no longer replies to each image separately. Only one turn is processed at a time per conversation; new messages queue behind the current turn until it finishes. Voice messages, stickers, videos, and locations trigger an immediate reply like text. Group conversations retain their existing behavior

## Use in LINE Groups <a href="#line-group" id="line-group"></a>

After you add the Official Account to a LINE group, the Agent replies to every message in the group by default. To have it reply only when called, go to <mark style="color:blue;">All Conversations</mark>, open the group conversation, and enable "Only respond when @mentioned in groups" above the input box. See [All Conversations](https://docs.maiagent.ai/maiagent-user-guide/en/serve/daily-operations/reply.md).

Once enabled, group members can call the Agent in two ways:

| Method       | How to use it                                                                 | Description                                                                                                                       |
| ------------ | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| @mention     | Include "@Official Account display name" in the message                       | The name must exactly match the LINE Official Account's display name                                                              |
| Quoted reply | Use LINE's "Reply" on a message previously sent by the Agent, then enter text | No additional @mention is needed. This is especially convenient when you cannot @mention the Official Account in LINE for desktop |

Rules for quoted replies:

* Only quoting **a message sent by the Agent** calls it. Quoting another member's message does not trigger it.
* Only **text messages** call it. Replying to an Agent message with a sticker does not trigger a reply or consume Credits.
* In groups, the Agent quotes the question message in its reply so members can see whom it is answering. If the reply takes longer than LINE's allowed immediate reply window, it is sent as a regular message without a quote.
* These rules do not affect one-on-one chats. The Agent replies to every message without quoting it.

### Group Join Greeting <a href="#line-group-join-greeting" id="line-group-join-greeting"></a>

When the Official Account is added to a LINE group, it can send a greeting to introduce itself and explain how members can call it. The greeting is blank by default; if left blank, the account says nothing when it joins a group.

For example, before adding the Official Account to a "VIP Members" group, an online store's customer support manager sets a greeting on the LINE messaging platform: "Hello everyone, I'm the demo store's AI assistant. If you have questions about products or orders, please @mention me or quote my message to ask." This text appears in the group as soon as the Official Account joins. Back in MaiAgent's <mark style="color:blue;">All Conversations</mark>, the group conversation and greeting are already listed, without waiting for a group member to speak first.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-e389350da46064b59565d62daf9abdd9f8006993%2Fline-group-join-greeting-demo.gif?alt=media" alt="Illustrative animation: in a LINE group chat, after the store manager invites the demo store&#x27;s AI assistant into the group, the assistant immediately sends the greeting: Hello everyone, I&#x27;m the demo store&#x27;s AI assistant. If you have questions about products or orders, please @mention me or quote my message to ask."><figcaption><p>Illustrative animation: the Official Account sends the configured greeting as soon as it is added to a group</p></figcaption></figure>

To configure it:

1. Go to <mark style="color:blue;">Messaging Platforms</mark>, open the LINE platform, and stay on the <mark style="color:blue;">Basic Settings</mark> tab.
2. Under <mark style="color:blue;">Chat Settings</mark>, enter the text to send in <mark style="color:blue;">Group Join Greeting</mark>, below the "Only respond when @mentioned in groups" toggle. Clear the field if you do not want to send a greeting.
3. Click <mark style="color:blue;">Save</mark> in the lower-right corner.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-01a78b516f6b4eb996bbb48863c25ca9955e29c6%2Fline-group-join-greeting-setting.png?alt=media" alt="Chat Settings section on the LINE messaging platform&#x27;s Basic Settings tab: the Group Join Greeting input is below the Only respond when @mentioned in groups toggle, contains a two-line greeting, and shows 45 / 5000 in the lower-right corner"><figcaption><p>Enter the Group Join Greeting in Chat Settings. The character count updates in real time below the input</p></figcaption></figure>

Sending rules:

* **Sent once, only when the Official Account is added to a group**: It is not sent again when other members join later. It is also not sent when the Official Account is added to a multi-person chat rather than a group.
* **Does not consume LINE's monthly message quota**: The greeting uses LINE's free reply mechanism and does not count toward the [Monthly Message Quota](#line-monthly-quota). For this reason, if it cannot be sent (for example, LINE rejects it or the reply deadline has passed), it is not resent as a push message. The message is marked [Undelivered](https://docs.maiagent.ai/maiagent-user-guide/en/serve/daily-operations/reply.md#delivery-failed) in <mark style="color:blue;">All Conversations</mark>.
* **No AI processing or Credits used**: The greeting is sent exactly as entered, with line breaks preserved. The Agent does not rewrite it.
* **Sent whether "Only respond when @mentioned in groups" is on or off**: The greeting is sent as usual even though nobody @mentions the Official Account when it joins.
* **Conversation history**: The greeting is saved as an AI assistant message in the group conversation. Later messages from group members continue in the same conversation. If no AI assistant is selected for the messaging platform, the greeting is still sent to the group, but it is not recorded in <mark style="color:blue;">All Conversations</mark>.
* **5,000-character limit**: LINE counts special characters such as emoji as 2 characters. The input displays "characters used / 5000" below it. If the limit is exceeded, the field turns red and shows a prompt, and clicking <mark style="color:blue;">Save</mark> is blocked.

## Checklist When the Agent Does Not Reply <a href="#no-reply-checklist" id="no-reply-checklist"></a>

If a user sends a LINE message but the Agent does not reply, first check whether the message appears in MaiAgent's <mark style="color:blue;">All Conversations</mark>, then investigate according to the result.

**The message does not appear in "All Conversations"** (MaiAgent did not receive it):

1. In the <mark style="color:blue;">Messaging API</mark> settings in LINE Official Account Manager, check that the Webhook URL matches the one provided by MaiAgent and has not been changed by another service. See [Step 8](#step-set-webhook-url-in-line). Each Official Account can have only one Webhook URL.
2. Check that <mark style="color:blue;">Webhook</mark> is enabled in LINE's response settings. See [Step 9](#step-configure-messaging-api-channel).
3. Check that the <mark style="color:blue;">Channel ID</mark>, <mark style="color:blue;">Channel Secret</mark>, and <mark style="color:blue;">Channel Access Token</mark> entered for the MaiAgent messaging platform match those in LINE Developers. If you reissue a Token or Secret in LINE, update it in MaiAgent as well.

**The message arrives, but the Agent does not reply**:

1. Check whether <mark style="color:blue;">Auto Reply</mark> is disabled for this conversation or a human support agent has taken over. The Agent does not reply during a handoff. Once the issue is resolved, transfer the conversation back to AI. See [All Conversations](https://docs.maiagent.ai/maiagent-user-guide/en/serve/daily-operations/reply.md#handoff-actions).
2. Check whether the current time falls within the messaging platform's configured auto-reply hours. See [Website: Auto Reply Settings](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/web-chat/website.md#auto-reply-settings).
3. Check whether "Only respond when @mentioned in groups" is enabled for group conversations. When enabled, users must @mention the Official Account or quote the Agent's message to receive a reply. See [Using the Agent in LINE Groups](#line-group).
4. Check whether <mark style="color:blue;">Enabled</mark> is turned off for the messaging platform. See [Feature Settings](https://docs.maiagent.ai/maiagent-user-guide/en/build/conversation-settings/platform-settings/function-settings.md#basic-functions).
5. Check whether the organization's Credits or this messaging platform's quota has been exhausted. When the messaging platform's quota runs out, the Agent stops replying, and users receive only a quota notification. See [Messaging Platform Credits Quota Management](https://docs.maiagent.ai/maiagent-user-guide/en/others/credits/inbox-credit-quota.md#quota-exceeded-behavior).
6. If [Hook Message Interception](https://docs.maiagent.ai/maiagent-user-guide/en/build/hook.md) is configured, check the [Hook Execution Logs](https://docs.maiagent.ai/maiagent-user-guide/en/build/hook/execution-logs.md) to see whether the message was intercepted.

If everything above is normal but the Agent still does not reply, note the conversation time and URL, and contact your MaiAgent representative for help investigating.

## Receiving LINE's Auto-Response Message <a href="#line-auto-response" id="line-auto-response"></a>

If users receive the following text after sending a message, the LINE Official Account's auto-response messages are still enabled. This text is sent by LINE, rather than the Agent:

> Thank you for your message!\
> Sorry, this account cannot reply to individual user messages.\
> Please look forward to our next update.

To resolve this:

1. Follow [Step 9](#step-configure-messaging-api-channel) to disable <mark style="color:blue;">Auto-response messages</mark>. If <mark style="color:blue;">Chat</mark> is enabled, set the response method for both <mark style="color:blue;">Response hours</mark> and <mark style="color:blue;">Outside response hours</mark> to <mark style="color:blue;">Manual chat</mark>.
2. Confirm that <mark style="color:blue;">Webhook</mark> is still enabled.
3. Send another message to test. With the correct settings, you will receive only the Agent's reply.

While Webhook is enabled, MaiAgent still receives and replies to messages, so users may see both this text and the Agent's reply until the settings are corrected.

## Users Sharing Their Location <a href="#location-messages" id="location-messages"></a>

When a user shares a place through LINE's "Location" feature, MaiAgent receives it as a message in the conversation. The message contains the place name and address (or "📍 Location shared" if LINE does not provide them), while the coordinates are stored separately in the message metadata (`latitude`, `longitude`).

To let the Agent respond based on the user's location (for example, to recommend the nearest store), enable [Feature Settings → Use Location Information in Responses](https://docs.maiagent.ai/maiagent-user-guide/en/build/conversation-settings/platform-settings/function-settings.md#gps-location) for this LINE messaging platform. Once enabled, the Agent's replies include a "📍 Share location" quick reply button that users can tap to send their current location to the Agent.

## ⚠️ Important Notes <a href="#important-notes" id="important-notes"></a>

**Limitations**

* Messages that support staff send manually from LINE's chat interface are not synced to MaiAgent. See [Step 9](#step-configure-messaging-api-channel).
* Only one Agent can be added to a LINE group.
* Adding a new Agent automatically removes the previous one.

### Sharing an Official Account with Other LINE Backend Services <a href="#share-line-official-account-with-other-services" id="share-line-official-account-with-other-services"></a>

A LINE Official Account can have only one Webhook URL at a time. If you set the Webhook directly to MaiAgent, LINE events are sent directly to MaiAgent and are no longer sent to the existing third-party backend. As a result, features in that backend that rely on Webhook (such as add/block events, keyword filtering and tagging, delivery events, or conversation history) may no longer receive data. The actual impact depends on how that service is implemented.

Conversations that MaiAgent receives and processes are retained in MaiAgent's "All Conversations". If the existing third-party backend must also retain these features, confirm the integration architecture before switching over. A common approach is to use the third-party service as the LINE Webhook entry point: it processes events and keywords first, then forwards messages that need AI replies to MaiAgent. This requires a custom integration that preserves the original LINE request body and the `X-Line-Signature` header. Each reply token can be used only once, so avoid having both services reply to the same event.

#### Migrating from Another Backend to MaiAgent <a href="#migrate-from-other-line-service" id="migrate-from-other-line-service"></a>

The moment you click <mark style="color:blue;">Connect Messaging Platform</mark> in MaiAgent to create a LINE messaging platform, the system automatically changes the Official Account's Webhook URL to MaiAgent's URL. Messages then go to MaiAgent instead of the original backend (the change can take up to about one minute to take effect on LINE; if automatic setup is incomplete, use the manual settings instead. This reminder also appears on the creation form). Therefore, **creating the messaging platform is the moment of switchover**. Create it at your intended switchover time and follow this order:

1. **Save the original Webhook URL first**: In the channel's <mark style="color:blue;">Messaging API</mark> tab in [LINE Developers](https://developers.line.biz/console/), copy and save the <mark style="color:blue;">Webhook URL</mark> under <mark style="color:blue;">Webhook settings</mark>. Without it, you will not be able to switch back to the original backend later.
2. **Reuse the existing long-lived token; do not click Reissue**: Copy and use the existing token in the <mark style="color:blue;">Channel access token</mark> section on the same page. Clicking Reissue invalidates the old token (it can remain valid for at most another 24 hours), preventing the original backend from replying.
3. **Create the LINE messaging platform at the intended switchover time**: Follow [Steps 5–6](#step-select-line-in-maiagent) to enter the Channel ID, Channel Secret, and the token you just copied. If you want only human support replies for now, leave <mark style="color:blue;">AI Assistant</mark> unselected. Immediately after creation, open <mark style="color:blue;">Auto Reply Settings</mark> and turn off all seven days. See [Human Support Only, Without AI](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/web-chat/website.md#human-only-mode). This prevents AI replies from the moment of switchover.
4. **Confirm that Webhook was configured automatically**: Setup is complete if the success screen displays "Webhook URL automatically configured and verified". If it displays "Use webhook is not enabled" or "Automatic Webhook URL setup incomplete", follow the on-screen instructions to enable Webhook (see [Step 9](#step-configure-messaging-api-channel)), or manually paste MaiAgent's URL and click <mark style="color:blue;">Verify</mark> (see [Steps 7–8](#step-get-webhook-url)).
5. **Confirm that auto-response messages are disabled and test**: Check the settings in [Step 9](#step-configure-messaging-api-channel). After about one minute, send a message from a personal LINE account and confirm that it appears in MaiAgent's <mark style="color:blue;">All Conversations</mark>. LINE may continue sending to the old URL for up to about one minute after the URL changes.

To switch back to the original backend, change the Webhook URL in the Console to the URL saved in Step 1 and click <mark style="color:blue;">Verify</mark>. You can keep the MaiAgent messaging platform for now, but creating another messaging platform in MaiAgent for the same Official Account later will automatically switch the Webhook back to MaiAgent again.

For example, a chain store's Official Account is connected to another support backend. During the day, the administrator saves the original Webhook URL from the Console in the handover document and confirms that the Channel access token already has a value. After support staff finish work that evening, the administrator creates the messaging platform in MaiAgent: they paste the existing token (without clicking Reissue), leave AI Assistant blank, and immediately turn off auto replies for all seven days. The screen displays "Webhook URL automatically configured and verified", and a test message sent from a personal LINE account one minute later arrives in MaiAgent. The next day, they discover that they still need the original backend's member linking feature, so they change the Webhook back to the original URL. Within a few minutes, the original setup is restored.

For the full preparation checklist and sequence when also migrating Messenger and Instagram, see [Migrating from Another Customer Support System to MaiAgent](https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/migrate-from-other-platform.md).

MaiAgent's LINE replies support more than plain text. In addition to text and images, they support [FlexMessage Cards and Interactive Buttons](https://docs.maiagent.ai/maiagent-user-guide/en/build/tools/agent-ui.md) configured through Agent UI, allowing you to guide users with visual options. The actual content displayed depends on the Agent and Agent UI settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/en/build/choose-channel/line.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
