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

# LINE

> LINE messaging platform tools for sending messages, broadcasting, and retrieving user data

## Overview

LINE tools allow you to interact with the LINE Messaging API. Supports direct messaging to specific users, broadcasting to all followers, and retrieving user profile and analytics data.

## Key Features

### Messaging

* `LINE_SEND_MESSAGE`
  * Send a text message to a specific LINE user
  * **Inputs**: `to` (LINE user ID), `message` (text)
* `LINE_BROADCAST_MESSAGE`
  * Broadcast a message to all users who follow your LINE Official Account
  * **Inputs**: `message` (text)

### User Data

* `LINE_GET_PROFILE`
  * Retrieve a user's profile: display name, profile picture URL, status message
  * **Inputs**: `user_id` (LINE user ID)
* `LINE_GET_FRIENDS_COUNT`
  * Get follower count metrics for a specific date
  * **Inputs**: `date` (yyyyMMdd format, e.g. `20250329`)
* `LINE_GET_DEMOGRAPHIC`
  * Get demographic breakdown of your followers (gender, age, region, app type, subscription period)
  * **Inputs**: none (token only)

## Authentication

To use LINE tools, you need a **LINE Channel Access Token** from the LINE Messaging API.

**Note**: Treat API keys as sensitive information and never commit them to public repositories.

For setup instructions, see the [LINE credentials guide](/en/pages/credentials/line).

## Setup

### 1. Create a LINE Official Account

1. Visit the [LINE Developers Console](https://developers.line.biz/console/)
2. Create a new **Provider** if you don't have one
3. Create a new **Messaging API channel**

### 2. Get Your Channel Access Token

1. Open your channel in the LINE Developers Console
2. Go to the **Messaging API** tab
3. Scroll to **Channel access token (long-lived)** and click **Issue**
4. Copy the token — this is your `LINE_API.channel_access_token`

### 3. Add LINE Credentials to JinbaFlow

Add your token as a secret in JinbaFlow with key `LINE_API`:

```json theme={null}
{
  "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN"
}
```

## Examples

### Example 1: Send a Direct Message

```yaml theme={null}
- id: send_message
  tool: LINE_SEND_MESSAGE
  config:
    - name: token
      value: "{{secrets.LINE_API.channel_access_token}}"
  input:
    - name: to
      value: U_YOUR_LINE_USER_ID
    - name: message
      value: "Hello from LINE Bot!"
```

### Example 2: Broadcast to All Followers

```yaml theme={null}
- id: broadcast_message
  tool: LINE_BROADCAST_MESSAGE
  config:
    - name: token
      value: "{{secrets.LINE_API.channel_access_token}}"
  input:
    - name: message
      value: "Hello everyone! This is a broadcast message."
```

### Example 3: Get User Profile

```yaml theme={null}
- id: get_profile
  tool: LINE_GET_PROFILE
  config:
    - name: token
      value: "{{secrets.LINE_API.channel_access_token}}"
  input:
    - name: user_id
      value: U_YOUR_LINE_USER_ID
```

### Example 4: Get Friends Count

```yaml theme={null}
- id: get_friends_count
  tool: LINE_GET_FRIENDS_COUNT
  config:
    - name: token
      value: "{{secrets.LINE_API.channel_access_token}}"
  input:
    - name: date
      value: "20250329"
```

### Example 5: Get Demographic Data

```yaml theme={null}
- id: get_demographic
  tool: LINE_GET_DEMOGRAPHIC
  config:
    - name: token
      value: "{{secrets.LINE_API.channel_access_token}}"
  input: []
```

## LINE User ID Format

LINE user IDs start with `U` followed by 32 hexadecimal characters, e.g. `U_YOUR_LINE_USER_ID`.

You can obtain a user's ID from:

* LINE webhook events (`source.userId`)
* The LINE Developers Console (for test users)

## Date Format

The `LINE_GET_FRIENDS_COUNT` tool requires dates in `yyyyMMdd` format:

* `20250329` → March 29, 2025
* Statistics are available from the day after the reference date

## Demographic Data Notes

`LINE_GET_DEMOGRAPHIC` requires at least **20 friends** in your account before data becomes available. The `available` field in the response indicates whether data is ready.

## Resources

* [LINE Developers Documentation](https://developers.line.biz/en/docs/messaging-api/)
* [LINE Developers Console](https://developers.line.biz/console/)
* [LINE Messaging API Reference](https://developers.line.biz/en/reference/messaging-api/)
