# LINE API

import { Badge } from '@astrojs/starlight/components';

<Aside type="caution" title="/createLineMessage is deprecated">
New integrations should use [Messaging API v2](/developer/api-reference/messaging-api-v2/) — pass `platforms: ["LINE"]` to `Notify` and use the `line` block inside `payload.content.localized_content`. See the [migration guide](/developer/api-reference/messaging-api-v2/migration-from-v1/#from-createlinemessage). For rich image / carousel / flex messages, pre-configure them as LINE templates in your Pushwoosh Control Panel and reference the template code through `line.template`.
</Aside>

<Aside> Before sending LINE messages, ensure that the Line platform is properly configured. [Learn more](/developer/first-steps/connect-messaging-services/line-configuration/) </Aside>

## createLineMessage <Badge text="Deprecated" variant="caution" size="small" />

Used to send LINE messages to users

`POST` `https://api.pushwoosh.com/json/1.3/createLineMessage`

### Send a textual message

Simple LINE messages that consist only of plain text, without images or buttons. [Learn more](https://developers.line.biz/en/reference/messaging-api/#text-message)

> **Tip:** For advanced formatting and rich media, use message templates like [Flex](#send-a-flex-message), [image](#send-an-image-message), or [carousel](#send-an-image-carousel-message).

##### Request body

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `application` | string | Yes | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code) |
| `auth` | string | Yes | [API access token](/developer/api-reference/api-identifiers/#api-access-token) for authenticating the request.  |
| `notifications` | array of objects | Yes | List of LINE message objects to be sent. |
| `content` | string | Yes | Text of the LINE message to be sent. Max character limit: 5000.<br/><strong>Note:</strong> If both <code>preset</code> and <code>content</code> are included, the value from the request overrides the <code>preset</code>. |
| `preset` | string | No | Code of the [LINE preset](/product/content/line-presets/) you created in the Pushwoosh Control Panel. **Note:** If both `preset` and `content` are included, the value from the request overrides the `preset`. |
| `send_date` | string | Yes | Date and time to send the message.  Use format `YYYY-MM-DD HH:mm` or `now` to send immediately. |
| `devices` | array of strings | Yes | List of device codes (user IDs) to send the LINE message to. |

```
{
    "request": {
    "application": "XXXXXX-XXXXXX",
    "auth": "**************************************",
        "notifications": [
            {
                "content": "test",
                "preset": "preset_code",
                "send_date":"now",
                "devices": ["XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"]
            }
        ]
    }
}

```

### Send an image message

You can send an [image message](https://developers.line.biz/en/reference/messaging-api/#image-message) to LINE users by specifying an image object within the template field of your request. 

Each image message requires two image URLs: one for the **full-size image (image\_url)** and another for the **preview (preview\_image\_url)**.  When users tap the preview, the full-size image opens. Make sure both URLs use HTTPS (TLS 1.2 or later) and link to publicly accessible image files. 

For details, see the [Image Message section](https://developers.line.biz/en/reference/messaging-api/#image-message) in the LINE Messaging API documentation. 

##### Request body 

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | ----- | ----- | ----- |
| `application` | string | Yes | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code) |
| `auth` | string | Yes | [API access token](/developer/api-reference/api-identifiers/#api-access-token) used to authenticate the request. |
| `notifications` | array of objects | Yes | List of messages to send. |
| `content` | string | Yes | Used as fallback or preview text for the message. Code of the LINE preset you created in the Pushwoosh Control Panel.<br/><strong>Note:</strong> If both <code>preset</code> and <code>template</code> are included, the <code>template</code> from the request is used.<br/>If both <code>preset</code> and <code>content</code> are included, the <code>content</code> from the request overrides the preset. |
| `send_date` | string | Yes | Date and time to send the message.  Use format `YYYY-MM-DD HH:mm` or `now` to send immediately. |
| `devices` | array of strings | Yes | List of device codes (user IDs) to send the LINE message to. |
| `preset` | string | No | Code of the [LINE preset](/product/content/line-presets/) you created in the Pushwoosh Control Panel.<br/><strong>Note:</strong> If both <code>preset</code> and <code>template</code> parameters are included in the request, the values from the <code>template</code> will override those defined in the preset.<br/>If both <code>preset</code> and <code>content</code> are included in the same request, the <code>content</code> provided directly in the request will override the content from the <code>preset</code>. |
| `template` | object | Yes | Message layout template. Supports multiple message types.  See details below.  |

##### Template parameters

**Type:** image

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `image_url` | string | Yes | URL to the full-size image (must use HTTPS). **Max length:** 2000 characters. **Format:** JPEG, PNG. **Max size:** 10 MB. |
| `preview_image_url` | string | Yes | URL to the preview image shown in chat (must use HTTPS). **Max length:** 2000 characters. **Format:** JPEG, PNG. **Max size:** 1 MB.  |

##### Example request

```json
{
  "request": {
    "application": "XXXXXX-XXXXXX",
    "auth": "**************************************",
    "notifications": [
      {
        "content": "test",
        "send_date": "now",
        "devices": [
          "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        ],
        "preset": "preset_code",
        "template": {
          "en": {
            "image": {
              "alt_text": "some text",
              "image_url": "https://images.com/1.jpg",
              "preview_image_url": "https://images.com/1.png"
            }
          }
        }
      }
    ]
  }
}


```

### Send an image carousel message

Image carousel messages let you display multiple images in a horizontally scrollable format. Each image appears as a separate, non-clickable column that users can swipe through in the LINE chat interface. 

This format is ideal for showcasing items, promotions, or visual selections in an engaging way. 

For details, refer to the [Image Carousel Template](https://developers.line.biz/en/reference/messaging-api/#carousel) section in the LINE Messaging API documentation.

##### Request body

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `application` | string | Yes | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code) |
| `auth` | string | Yes | [API access token](/developer/api-reference/api-identifiers/#api-access-token) used to authenticate the request. |
| `notifications` | array of objects | Yes | List of messages to send. |
| `content` | string | Yes | Used as fallback or preview text for the message.<br/><strong>Note:</strong> If both <code>content</code> and <code>template</code> are set, the <code>template</code> is used.<br/>If both a <code>preset</code> and <code>content</code> are included in the same request, the <code>content</code> provided directly in the request will override the content from the <code>preset</code>. |
| `send_date` | string | Yes | Date and time to send the message. Use the format `YYYY-MM-DD HH:mm` or `"now"`. |
| `devices` | array of strings | Yes | List of device codes (user IDs) to send the LINE message to. |
| `preset` | string | No | Code of the [LINE preset](/product/content/line-presets/) you created in the Pushwoosh Control Panel.<br/><strong>Note:</strong> If both <code>preset</code> and <code>template</code> parameters are included in the request, the values from the <code>template</code> will override those defined in the <code>preset</code>.<br/>If both a <code>preset</code> and <code>content</code> are included in the same request, the <code>content</code> provided directly in the request will override the content from the <code>preset</code>. |
| `template` | object | Yes  | Message layout template. Supports multiple message types. See details below. |



##### Template parameters

**Type:** image\_carousel

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `alt_text` | string | Yes | Fallback text displayed in push previews and on unsupported devices. Max 400 characters. |
| `columns` | array of objects | Yes | Array of image columns (1–10 supported). Each column includes an image. |
| `image_url` | string  | Yes | URL to the image shown in each carousel column pointing to a publicly accessible JPEG or PNG file.  Must use HTTPS. |

##### Example request

```json
{
  "request": {
    "application": "XXXXXX-XXXXXX",
    "auth": "**************************************",
    "notifications": [
      {
        "content": "test",
        "send_date": "now",
        "devices": [
          "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        ],
        "preset": "preset_code",
        "template": {
          "en": {
            "image_carousel": {
              "alt_text": "some text",
              "columns": [
                { "image_url": "https://images.com/1.jpg" },
                { "image_url": "https://images.com/2.jpg" },
                { "image_url": "https://images.com/3.jpg" }
              ]
            }
          }
        }
      }
    ]
  }
}
```

### Send a Flex message

Flex Messages are powerful, customizable message types that allow you to create structured layouts using text, images, buttons, and other components. They are ideal for use cases such as receipts, product cards, menus, or any content that benefits from visual structuring.

To send a Flex Message, include a `template` object with a `raw` payload inside your request. The message layout must follow the [LINE Flex Message specification](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/). 

**Tip:** You can design and preview Flex Messages using the [LINE Flex Message Simulator](https://developers.line.biz/flex-simulator/).

##### Request body

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `application` | string | Yes | [Pushwoosh application code](/developer/api-reference/api-identifiers/#application-code) |
| `auth` | string | Yes | [API access token](/developer/api-reference/api-identifiers/#api-access-token) used to authenticate the request. |
| `notifications` | array of objects | Yes | List of messages to send. |
| `content` | string | Yes | Used as fallback or preview text for the message.<br/><strong>Note:</strong> If both <code>content</code> and <code>template</code> are set, the template is used.<br/>If both <code>preset</code> and <code>content</code> are included, the content from the request overrides the preset. |
| `send_date` | string | Yes | When to send the message. Use `"now"` or `YYYY-MM-DD HH:mm` format. |
| `devices` | array of strings | Yes | List of LINE device tokens (user IDs) to receive the message. |
| `preset` | string | No | Code of the [LINE preset](/product/content/line-presets/) you created in the Pushwoosh Control Panel.<br/><strong>Note:</strong> If both <code>preset</code> and <code>template</code> are included, the template overrides the preset.<br/>If both <code>preset</code> and <code>content</code> are included, the content from the request overrides the preset. |
| `template` | object | Yes | Message layout template. Supports multiple message types. See details below. |

##### Template parameters

For a Flex Message, use the raw structure.  
Type: raw (Flex)

| Parameter <div style="width:180px"></div>| Type  <div style="width: 80px"></div>| Required | Description <div style="width:180px"></div> |
| :---- | :---- | :---- | :---- |
| `alt_text` | string | Yes | Fallback text shown in notifications, chat previews, and quotes. Max 400 characters. |
| `content`  | object  | Yes | Flex Message layout, structured using `bubble`, `box`, `text`, and other components as per LINE's Flex specification. |

##### Example request

```json
{
  "request": {
    "application": "XXXXXX-XXXXXX",
    "auth": "**************************************",
    "notifications": [
      {
        "content": "test",
        "send_date": "now",
        "devices": ["XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"],
        "preset": "preset_code", 
        "template": {
          "en": {
            "raw": {
              "alt_text": "My raw template",
              "content": {
                "type": "bubble",
                "body": {
                  "type": "box",
                  "layout": "vertical",
                  "contents": [
                    {
                      "type": "text",
                      "text": "RECEIPT",
                      "weight": "bold",
                      "color": "#1DB446",
                      "size": "sm"
                    }
                    // Additional components...
                  ]
                }
              }
            }
          }
        }
      }
    ]
  }
}
```