> ## Documentation Index
> Fetch the complete documentation index at: https://support.i.moneyforward.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LINE WORKS integration

> Learn how to connect AI Helpdesk to LINE WORKS and send inquiries to the bot from LINE WORKS.

When you connect AI Helpdesk to LINE WORKS, users can send inquiries to the AI bot from LINE WORKS talk rooms.

## Prerequisites

<Info>
  * You must have the **Admin** role in AI Helpdesk.
  * You must have administrator permissions in your LINE WORKS tenant.
  * You need permissions to create apps in the LINE WORKS Developer Console.
</Info>

## Required information for LINE WORKS connection

Create a client app and a bot in the [LINE WORKS Developer Console](https://dev.worksmobile.com/jp/console/openapi/v2/app/list/view) and prepare the following information.

| Field                         | Where to obtain                                                                |
| ----------------------------- | ------------------------------------------------------------------------------ |
| **Domain ID**                 | Domain ID shown on the home page of the LINE WORKS Developer Console (numeric) |
| **Client ID**                 | Client app's **App Information**                                               |
| **Client Secret**             | Client app's **App Information**                                               |
| **Service Account**           | Client app's **App Information** (format: `serviceaccount@...`)                |
| **Private Key**               | Client app's **App Information** (RSA private key in PEM format)               |
| **Bot ID**                    | Bot ID (numeric) registered in LINE WORKS Developers                           |
| **Bot Secret**                | Bot secret                                                                     |
| **Workspace name** (optional) | Display name in AI Helpdesk                                                    |

## Setup in the LINE WORKS Developer Console

### Create a client app

1. Open **Console > Bot > Create Client App** and click **+ Add a new app**.

2. Enter an app name, choose **Authentication App**, and submit.

3. Configure **App Information** as follows.

   | Setting                          | Value                                         |
   | -------------------------------- | --------------------------------------------- |
   | **App access permissions**       | All members                                   |
   | **Access Token expiration date** | 1 hour                                        |
   | **Refresh Token Rotation**       | On                                            |
   | **OAuth Scopes**                 | `bot`, `bot.message`, `bot.read`, `user.read` |

4. After submitting, record the following credentials:

   * **Client ID**
   * **Client Secret**
   * **Service Account**
   * **Private Key (PEM)**

### Create a bot

1. Open **Console > Bot > Create new Bot**.

2. Enter the bot name and description.

3. Enable **Callback URL** and set it to:

   ```text theme={null}
   https://assist.i.moneyforward.com/chat/lineworks
   ```

4. Enable **text**, **image**, and **file** on the Callback URL.

5. Enable the **Bot Policy** checkboxes.

6. After saving, open the bot's detail screen and record the **Bot ID** and **Bot Secret**.

### Add the bot to your workspace

In the [LINE WORKS Admin Console](https://admin.worksmobile.com/), go to **Service > Bot > Add Bot** and add the bot you created to the workspace.
Configure the policy, user rights, and privacy settings to match your workspace's operational guidelines.

## Connect LINE WORKS

<Steps>
  <Step title="Open integration settings">
    Select **Settings** from the left navigation and open the **Integrations** tab.
    In the **Messaging** section, click **Add connection** and choose **LINE WORKS — Custom Bot**.

    {/* TODO(image): ![Screenshot: Settings > Integrations > Select LINE WORKS](/images/ai-helpdesk/placeholder.png) */}
  </Step>

  <Step title="Enter credentials (Step 1)">
    Enter all of the following information.

    * **Domain ID**
    * **Client ID**
    * **Client Secret**
    * **Service Account** (format: `serviceaccount@...`)
    * **Private Key** (paste the full PEM content including line breaks)
    * **Bot ID**
    * **Bot Secret**
    * **Workspace name** (optional)

    <Warning>
      For the private key, paste the full content including `-----BEGIN RSA PRIVATE KEY-----` through `-----END RSA PRIVATE KEY-----` with all line breaks preserved.
    </Warning>

    After filling in all fields, click **Next**.
    The credentials are validated against the LINE WORKS API.

    {/* TODO(image): ![Screenshot: LINE WORKS connection dialog (credential input)](/images/ai-helpdesk/placeholder.png) */}
  </Step>

  <Step title="Select an observer user (Step 2)">
    AI Helpdesk talk room sessions require at least three members.
    In addition to the end user and the bot, select a user from the list to participate as an "observer."

    <Note>
      When credential validation succeeds, a list of users in the LINE WORKS tenant is displayed.
      It is recommended to use a dedicated account that does not monitor inquiry content during normal operations.
    </Note>

    Select a user and click **Connect**.

    {/* TODO(image): ![Screenshot: LINE WORKS connection dialog (observer selection)](/images/ai-helpdesk/placeholder.png) */}
  </Step>

  <Step title="Confirm successful connection">
    After a successful connection, a LINE WORKS card appears in the **Messaging** section, showing the domain ID and connected status.

    {/* TODO(image): ![Screenshot: Connected LINE WORKS card](/images/ai-helpdesk/placeholder.png) */}
  </Step>
</Steps>

## Using the bot

After connecting, LINE WORKS users can send inquiries in a talk room with the bot.

When a user sends a message to the bot's talk room, a group talk is automatically created and a session begins.

## Disconnect LINE WORKS

In the **Messaging** section under **Settings > Integrations**, click the trash icon on the card to disconnect.

<Warning>
  Disconnecting stops accepting new inquiries from that LINE WORKS tenant.
</Warning>

## Troubleshooting

**"Credentials are invalid" error**

* Verify that the domain ID contains numbers only.
* Confirm that the private key is in the correct PEM format (full content with line breaks).
* Check that the app is enabled in the LINE WORKS Developer Console.

**User list is not displayed**

* Verify that the service account has the necessary scopes (such as `user.read`).
* Check whether the LINE WORKS API rate limit has been reached.
