# Developing a LIFF app (v1)

LIFF v1 has been discontinued from October 1, 2021

If you're using LIFF v1, you must migrate to LIFF v2. For more information on migrating to LIFF v2, see "Migrate to LIFF v2" in the news from April 5, 2021.

After October 1, 2021, documentation on LIFF v1 will be deleted without notice and will no longer be accessible.

This topic explains the LIFF-specific tasks required to deploy a web app as a LIFF app.


The steps for adding a LIFF app to a channel and opening a LIFF app are the same as LIFF v2.

# Setting the title of the LIFF app

Specify the name of the LIFF app in the <title> element of the HTML source of the web app. This name appears in the title bar of the LIFF app.

<title>My LIFF app</title>

# Integrating the LIFF SDK

The LIFF SDK provides the following features.

  • Initialization of the LIFF app.
  • Interface with LINE. With the client API incorporated in the SDK, you can open any URLs with the LIFF browser or with an external browser and close the LIFF app.

For more information, see Calling the LIFF API.

Specify the URL of the LIFF SDK, https://d.line-scdn.net/liff/1.0/sdk.js, in the <script> element.

<script src="https://d.line-scdn.net/liff/1.0/sdk.js"></script>

You don't need to add a Promise polyfill to your app manually. The LIFF SDK automatically adds the core-js Promise polyfill (opens new window) to an environment that doesn't support Promise.

# Calling the LIFF API

With the LIFF app, you can perform the following operations via the LIFF SDK.

# Initializing the LIFF app

The liff.init() method gets the information necessary to make various API calls with the LIFF app.

  data => {
    // Now you can call LIFF API
    const userId = data.context.userId;
  err => {
    // LIFF initialization failed

For more information, see liff.init() in the LIFF v1 API reference.

# Opening a URL

The liff.openWindow() method opens the specified URL in LINE's in-app browser or an external browser.

The following code opens https://example.com in an external browser.


For more information, see liff.openWindow() in the LIFF v1 API reference.

To open a PDF

In the HTML source of the web app, in the <a href=""> attribute, specify the path of the target PDF:

<a href="/path/to/your.pdf">Open a PDF</a>

Clicking this link opens the PDF in LINE's in-app browser or an external browser.

To make the PDF open in a new tab, add target="_blank":

<a href="/path/to/your.pdf" target="_blank">Open a PDF in another tab</a>

# Getting the user's profile

There are two ways to get a user's profile in the LIFF app.

Choose the most appropriate method for your intended use case.

# Getting data to send to a server

Your LIFF app should obtain an access token as described below and send it to your server in lieu of actual user data.

To learn more about how to process user data on your server, see Send access token to get user data.

Call the liff.getAccessToken() method to get an access token for the current user.

const accessToken = liff.getAccessToken();

For more information, see liff.getAccessToken() in the LIFF v1 API reference.

# Getting data to use in a LIFF app

Call the liff.getProfile() method to get the current user's profile.

Don't send user data to your server

Don't send the user data that you get from liff.getProfile() to a server.

Send an access token obtained with liff.getAccessToken() instead.

.then(profile => {
  const name = profile.displayName
.catch((err) => {
  console.log('error', err);

For more information, see liff.getProfile() in the LIFF v1 API reference.

# Sending messages to the current chat screen

The liff.sendMessages() method sends messages on behalf of the user to the chat screen where the LIFF app is opened. This feature is only available in a LIFF app launched from a one-on-one chat room. You can send up to 5 message objects in a single request.

From the LIFF app, you can send the following types of Messaging API messages:

For more information about message types, see Message objects in the Messaging API reference.

When messages are sent to a chat that includes a LINE Official Account (bot), the LINE Platform sends webhook events to the bot server. When image, video, and audio messages are sent using the liff.sendMessages() method, the webhook events sent at the time contain the contentProvider.type property whose value is external. For more information, see Message event in the Messaging API reference.

This code sends "Hello, World!" as the user's message to the chat screen where the LIFF app is displayed.

    text:'Hello, World!'
.then(() => {
  console.log('message sent');
.catch((err) => {
  console.log('error', err);

For more information, see liff.sendMessages() in the LIFF v1 API reference.

# Closing the LIFF app

The liff.closeWindow() method closes the opened LIFF app.


For more information, see liff.closeWindow() in the LIFF v1 API reference.