Linking a bot with your LINE Login channel

By linking a bot developed using the Messaging API with your LINE Login channel, you can display an option to add the bot as a friend when a user logs in to your web app.

If the user selects the checkbox, the bot will be added as a friend.

Consent screen

For more information on bots, see Messaging API.

Before you begin

To display the option to add your bot as a friend, make sure you have the following:

  • LINE Login v2.1 or above
  • LINE Login channel with the WEB app type
  • At least one bot linked to a Messaging API channel that belongs to the same provider as your LINE Login channel.

Displaying the option to add your bot as friend

To link a bot with your channel, link the bot with your channel on the console and redirect the user to the authorization URL with the bot_prompt query parameter.

  1. Log in to a channel where you are an "admin" on the console. In the "Bot linked to this channel" item in "Channel settings", you'll find a list of bots linked to Messaging API channels that belong to the same provider.
  2. Select the bot you want users to add and click Update. Only one bot can be linked to a channel.

Redirect users to the authorization URL

Redirect users to the LINE Login authorization URL with the bot_prompt query parameter as shown below. For more information on redirecting users to the authorization URL, see Making an authorization request.

https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id={CHANNEL_ID}&redirect_uri={CALLBACK_URL}&state={STATE}&bot_prompt={BOT_PROMPT}&scope={SCOPE_LIST}


Set one of the following values for the bot_prompt query parameter.

Value Description
normal Includes an option to add a bot as friend in the consent screen.
aggressive Opens a new screen to add the bot as friend after the user agrees to the permissions in the consent screen.

The following screens are displayed depending on the bot_prompt value.

Screen to be displayed

The following describes the consent screen and how the process is handled depending on the user's friendship status with the bot before logging in.

Friendship status before login Description
Not a friend A checkbox is displayed to add the bot as a friend. The bot is added as a friend if the user selects the checkbox.
Bot blocked by user A checkbox is displayed to unblock the bot. The bot is unblocked if the user selects the checkbox.
Added as friend Shows that the user has added the bot as a friend. No checkbox is displayed to add the bot as a friend.

Getting the friendship status of the user and the bot

You can get the friendship status of the user and the bot using the following methods.

Use the friendship_status_changed query parameter

If the following conditions are met, the friendship_status_changed query parameter is returned in the callback URL after the authentication and authorization process is complete.

  • The bot_prompt query parameter is specified when making an authorization request.
  • The consent screen with the option to add your bot as friend is displayed to the user.

The following is an example response with the friendship_status_changed parameter in the callback URL.

HTTTP/1.1 302 Found
Location : https://client.example.org/cb?code={CODE}&state={STATE}&friendship_status_changed={FRIENDSHIP_STATUS_CHANGED}

The friendship_status_changed query parameter can take the following values. For more information on the callback URL, see Receiving the authorization code.

Value Description
true The friendship status of the user and bot changed during login. This occurs in the following situations:
  • User added the bot as a friend
  • User unblocked the bot
false The friendship status of the user and bot did not change during login. This occurs in the following situations:
  • User already added the bot as a friend
  • User did not add the bot as a friend
  • User did not unblock the bot

Use the Social API to get friendship status

Send a GET request to the https://api.line.me/friendship/v1/status endpoint after the user has logged in to your app and an access token has been returned.

curl -X GET \
-H 'Authorization: Bearer {access token}' \
https://api.line.me/friendship/v1/status

The friendFlag property is returned if the API call is successful. The value is true if the user has added the bot as a friend and has not blocked the bot. Otherwise, the value is false.

For more information, see Get friendship status in the Social API reference.