Messaging API reference
Common specifications
Webhooks
Webhook event objects
OAuth
Message
Insight
Profile
Group
Room
Rich menu
Account link
Message objects
Action objects
Rich menu structure

Messaging API reference

Common specifications

Rate limits

Rate limits for Messaging API requests are as follows. These limits are applied to each endpoint.

Different rate limits are applied depending on the applied plan.

For bots associated with LINE official accounts

Send multicast message

100,000 requests per minute
2,000,000 recipients per minute

Send broadcast message
Get number of message deliveries
Get number of followers
Get friend demographics

60 requests per hour

Other API endpoints

100,000 requests per minute

For bots associated with LINE@ accounts

Send multicast message

10,000 requests per minute
200,000 recipients per minute

Other API endpoints

10,000 requests per minute

Status codes

The following status codes are returned by the Messaging API.

Status code Description
200 OK Request successful
400 Bad Request Problem with the request
401 Unauthorized Valid channel access token is not specified
403 Forbidden Not authorized to access the resource. Confirm that your account or plan is authorized to access the resource.
429 Too Many Requests Exceeded the rate limit for API calls
500 Internal Server Error Error on the internal server

Response headers

The following HTTP headers are included in Messaging API responses.

Response header Description
X-Line-Request-Id ID generated for each request

Error responses

The following JSON data is returned in the response body when an error occurs.

Property Type Description
message String Message containing information about the error. For more details, see Error messages.
details[].message String Details of the error. Not returned in certain situations.
details[].property String Location of where the error occurred. Not returned in certain situations.

Error messages

The main error messages that are found in the message property of the JSON error responses are shown below.

Message Description
The request body has X error(s) An error was found in the JSON data of the request body. The number of errors is displayed for "X". Further details are shown in the details[].message and details[].property properties.
Invalid reply token An invalid reply token was used in the reply message
The property, XXX, in the request body is invalid (line: XXX, column: XXX) An invalid property was specified in the request body. The specific property is displayed for "XXX".
The request body could not be parsed as JSON (line: XXX, column: XXX) The JSON in the request body could not be parsed. The specific line and column are displayed.
The content type, XXX, is not supported A content type not supported by the API is requested.
Authentication failed due to the following reason: XXX Authentication failed when the API was called. The reason is displayed for "XXX".
Access to this API is not available for your account Appears when calling an API that you do not have permission to use.
Failed to send messages Appears when the message fails to be sent. One reason this may appear is if the user ID specified does not exist.
You have reached your monthly limit. You have exceeded the target limit for additional messages.

Example error response

{  
   "message":"The request body has 2 error(s)",
   "details":[  
      {  
         "message":"May not be empty",
         "property":"messages[0].text"
      },
      {  
         "message":"Must be one of the following values: [text, image, video, audio, location, sticker, template, imagemap]",
         "property":"messages[1].type"
      }
   ]
}

Webhooks

When an event, such as when a user adds your LINE official account or sends a message, is triggered, an HTTPS POST request is sent to the webhook URL that is configured for your channel on the console.

Your bot server then receives and handles the requests.

Request headers

Request header Description
X-Line-Signature Used for signature validation

Request body

The request body contains a JSON object with the user ID of a bot that should receive webhook events and an array of webhook event objects.

Property Type Description
destination String User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, U[0-9a-f]{32}.
events Array of webhook event objects Information about the event

Response

Your bot server should return the status code 200 for a HTTP POST request sent by a webhook.

Signature validation

The signature in the X-Line-Signature request header must be verified to confirm that the request was sent from the LINE Platform.

Authentication is performed as follows:

  1. With the channel secret as the secret key, your application retrieves the digest value in the request body created using the HMAC-SHA256 algorithm.
  2. The server confirms that the signature in the request header matches the digest value which is Base64 encoded.

Example of signature validation

# Click on the language tabs for examples of signature validation
String channelSecret = ...; // Channel secret string
String httpRequestBody = ...; // Request body string
SecretKeySpec key = new SecretKeySpec(channelSecret.getBytes(), "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(key);
byte[] source = httpRequestBody.getBytes("UTF-8");
String signature = Base64.encodeBase64String(mac.doFinal(source));
// Compare X-Line-Signature request header string and the signature
CHANNEL_SECRET = ... # Channel secret string
http_request_body = request.raw_post # Request body string
hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)
signature = Base64.strict_encode64(hash)
# Compare X-Line-Signature request header string and the signature
defer req.Body.Close()
body, err := ioutil.ReadAll(req.Body)
if err != nil {
    // ...
}
decoded, err := base64.StdEncoding.DecodeString(req.Header.Get("X-Line-Signature"))
if err != nil {
    // ...
}
hash := hmac.New(sha256.New, []byte("<channel secret>"))
hash.Write(body)
// Compare decoded signature and `hash.Sum(nil)` by using `hmac.Equal`
$channelSecret = ...; // Channel secret string
$httpRequestBody = ...; // Request body string
$hash = hash_hmac('sha256', $httpRequestBody, $channelSecret, true);
$signature = base64_encode($hash);
// Compare X-Line-Signature request header string and the signature
use Digest::SHA 'hmac_sha256';
use MIME::Base64 'encode_base64';

my $channel_secret= ... # Channel secret string
my $http_body = ... # Request body string
my $signature = encode_base64(hmac_sha256($http_body, $channel_secret));
# Compare X-Line-Signature request header string and the signature
import base64
import hashlib
import hmac

channel_secret = ... # Channel secret string
body = ... # Request body string
hash = hmac.new(channel_secret.encode('utf-8'),
    body.encode('utf-8'), hashlib.sha256).digest()
signature = base64.b64encode(hash)
# Compare X-Line-Signature request header and the signature
const crypto = require('crypto');

const channelSecret = ...; // Channel secret string
const body = ...; // Request body string
const signature = crypto
  .createHmac('SHA256', channelSecret)
  .update(body).digest('base64');
// Compare X-Line-Signature request header and the signature

Webhook event objects

JSON objects which contain events generated on the LINE Platform.

Some properties of these event objects might not have any value. Generated event objects don't contain properties without any value.

The structure of these event objects might be changed when the Messaging API feature is updated. Such changes can include adding properties, changing the order of properties, adding or deleting spaces and newlines between data elements, and so on. Implement your server so as not to fail in receiving event objects whose structure has changed in the future.

Example webhook event object

{
  "destination": "xxxxxxxxxx", 
  "events": [
    {
      "replyToken": "0f3779fba3b349968c5d07db31eab56f",
      "type": "message",
      "timestamp": 1462629479859,
      "source": {
        "type": "user",
        "userId": "U4af4980629..."
      },
      "message": {
        "id": "325708",
        "type": "text",
        "text": "Hello, world"
      }
    },
    {
      "replyToken": "8cf9239d56244f4197887e939187e19e",
      "type": "follow",
      "timestamp": 1462629479859,
      "source": {
        "type": "user",
        "userId": "U4af4980629..."
      }
    }
  ]
}

Common properties

The following properties are found in webhook event objects.

Property Type Description
type String Identifier for the type of event
timestamp Number Time of the event in milliseconds
source Object Source user, group, or room object with information about the source of the event.

Source user

Property Type Description
type String user
userId String ID of the source user

Source user example

  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  }

Source group

Property Type Description
type String group
groupId String ID of the source group
userId String ID of the source user. Only included in message events. Not included if the user has not agreed to the Official Accounts Terms of Use.

Source group example

  "source": {
    "type": "group",
    "groupId": "Ca56f94637c...",
    "userId": "U4af4980629..."
  }

Source room

Property Type Description
type String room
roomId String ID of the source room
userId String ID of the source user. Only included in message events. Not included if the user has not agreed to the Official Accounts Terms of Use.

Source room example

  "source": {
    "type": "room",
    "roomId": "Ra8dbf4673c...",
    "userId": "U4af4980629..."
  }

Message event

Webhook event object which contains the sent message. The message property contains a message object which corresponds with the message type. You can reply to message events.

Property Type Description
type String message
replyToken String Token for replying to the event
message Object Object containing the contents of the message. Message types include:

Text

Message object which contains the text sent from the source.

Property Type Description
id String Message ID
type String text
text String Message text

Text message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "text",
    "text": "Hello, world!"
  }
}

Image

Message object which contains the image content sent from the source.

Property Type Description
id String Message ID
type String image
contentProvider.type String Provider of the image file.
  • line: The image was sent by a LINE user. The binary image data can be retrieved from the content endpoint.
  • external: The image was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.
contentProvider.originalContentUrl String URL of the image file. Only included when contentProvider.type is external.
contentProvider.previewImageUrl String URL of the preview image. Only included when contentProvider.type is external.

Image message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "image",
    "contentProvider": {
      "type": "line"
    }
  }
}

Video

Message object which contains the video content sent from the source. The preview image is displayed in the chat and the video is played when the image is tapped.

Property Type Description
id String Message ID
type String video
duration Number Length of video file (milliseconds)
contentProvider.type String Provider of the video file.
  • line: The video was sent by a LINE user. The binary video data can be retrieved from the content endpoint.
  • external: The video was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.
contentProvider.originalContentUrl String URL of the video file. Only included when contentProvider.type is external.
contentProvider.previewImageUrl String URL of the preview image. Only included when contentProvider.type is external.

Video message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "video",
    "duration": 60000,
    "contentProvider": {
      "type": "external",
      "originalContentUrl": "https://example.com/original.mp4",
      "previewImageUrl": "https://example.com/preview.jpg"
    }
  }
}

Audio

Message object which contains the audio content sent from the source.

Property Type Description
id String Message ID
type String audio
duration Number Length of audio file (milliseconds)
contentProvider.type String Provider of the audio file.
  • line: The audio file was sent by a LINE user. The binary audio data can be retrieved from the content endpoint.
  • external: The audio file was sent using the LIFF liff.sendMessages() method. For more information, see liff.sendMessages() in the LIFF API reference.
contentProvider.originalContentUrl String URL of the audio file. Only included when contentProvider.type is external.

Audio message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "audio",
    "duration": 60000,
    "contentProvider": {
      "type": "line"
    }
  }
}

File

Message object which contains the file sent from the source. The binary data can be retrieved from the content endpoint.

Property Type Description
id String Message ID
type String file
fileName String File name
fileSize Number File size in bytes

File message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "file",
    "fileName": "file.txt",
    "fileSize": 2138
  }
}

Location

Message object which contains the location data sent from the source.

Property Type Description
id String Message ID
type String location
title String Title
address String Address
latitude Decimal Latitude
longitude Decimal Longitude

Location message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "location",
    "title": "my location",
    "address": "〒150-0002 東京都渋谷区渋谷2丁目21−1",
    "latitude": 35.65910807942215,
    "longitude": 139.70372892916203
  }
}

Sticker

Message object which contains the sticker data sent from the source. For a list of basic LINE stickers and sticker IDs, see sticker list.

Property Type Description
id String Message ID
type String sticker
packageId String Package ID
stickerId String Sticker ID

Sticker message example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "message",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "message": {
    "id": "325708",
    "type": "sticker",
    "packageId": "1",
    "stickerId": "1"
  }
}

Follow event

Event object for when your LINE official account is added as a friend (or unblocked). You can reply to follow events.

Property Type Description
type String follow
replyToken String Token for replying to this event

Follow event example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "follow",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  }
}

Unfollow event

Event object for when your LINE official account is blocked.

Property Type Description
type String unfollow

Unfollow event example

{
  "type": "unfollow",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  }
}

Join event

Event object for when your LINE official account joins a group or room. You can reply to join events.

A join event is triggered at different times for groups and rooms.

  • For groups: A join event is sent when a user invites your LINE official account.
  • For rooms: A join event is sent when the first event (for example when a user sends a message or is added to the room) occurs after your LINE official account is added.
Property Type Description
type String join
replyToken String Token for replying to this event

Join event example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "join",
  "timestamp": 1462629479859,
  "source": {
    "type": "group",
    "groupId": "C4af4980629..."
  }
}

Leave event

Event object for when a user removes your LINE official account from a group or when your LINE official account leaves a group or room.

Property Type Description
type String leave

Leave event example

{
  "type": "leave",
  "timestamp": 1462629479859,
  "source": {
    "type": "group",
    "groupId": "C4af4980629..."
  }
}

Member join event

Event object for when a user joins a group or room that the LINE official account is in.

Property Type Description
type String memberJoined
joined.members Array of source user objects User ID of users who joined
replyToken String Token for replying to this event

Member join event example

{
  "replyToken": "0f3779fba3b349968c5d07db31eabf65",
  "type": "memberJoined",
  "timestamp": 1462629479859,
  "source": {
    "type": "group",
    "groupId": "C4af4980629..."
  },
  "joined": {
    "members": [
      {
       "type": "user",
        "userId": "U4af4980629..."
      },
      {
        "type": "user",
        "userId": "U91eeaf62d9..."
      }
    ]
  }
}

Member leave event

Event object for when a user leaves a group or room that the LINE official account is in.

Property Type Description
type String memberLeft
left.members Array of source user objects User ID of users who left

Member leave event example

{
  "type": "memberLeft",
  "timestamp": 1462629479960,
  "source": {
    "type": "group",
    "groupId": "C4af4980629..."
  },
  "left": {
    "members": [
      {
        "type": "user",
        "userId": "U4af4980629..."
      },
      {  
        "type": "user",
        "userId": "U91eeaf62d9..."
      }
    ]
  }
}

Postback event

Event object for when a user performs a postback action which initiates a postback. You can reply to postback events.

Property Type Description
type String postback
replyToken String Token for replying to this event
postback.data String Postback data
postback.params Object JSON object with the date and time selected by a user through a datetime picker action.
Only returned for postback actions via a datetime picker action.

Postback event example

{  
   "type":"postback",
   "replyToken":"b60d432864f44d079f6d8efe86cf404b",
   "source":{  
      "userId":"U91eeaf62d...",
      "type":"user"
   },
   "timestamp":1513669370317,
   "postback":{  
      "data":"storeId=12345",
      "params":{  
         "datetime":"2017-12-25T01:00"
      }
   }
}

postback.params object

Object with the date and time selected by a user through a datetime picker action. The full-date, time-hour, and time-minute formats follow the RFC3339 protocol.

Property Format Description
date full-date Date selected by user. Only included in the date mode.
time time-hour ":" time-minute Time selected by the user. Only included in the time mode.
datetime full-date "T" time-hour ":" time-minute Date and time selected by the user. Only included in the datetime mode.

postback.params object example

{  
   "datetime":"2017-12-25T01:00"
}

Beacon event

Event object for when a user enters the range of a LINE Beacon. You can reply to beacon events.

Property Type Description
type String beacon
replyToken String Token for replying to this event
beacon.hwid String Hardware ID of the beacon that was detected
beacon.type String Type of beacon event. See Beacon event types.
beacon.dm String Device message of beacon that was detected. This message consists of data generated by the beacon to send notifications to bot servers. Only included in webhook events from devices that support the "device message" property.
For more information, see the LINE Simple Beacon specification.

Beacon event types

beacon.type Description
enter Entered beacon's reception range
leave [Deprecated] Left beacon's reception range.
banner Tapped beacon banner

If you are interested in using the Beacon Banner feature, make an inquiry through the LINE for Business website.

Beacon event example

{
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "type": "beacon",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U4af4980629..."
  },
  "beacon": {
    "hwid": "d41d8cd98f",
    "type": "enter"
  }
}

Event object for when a user has linked his/her LINE account with a provider's service account. You can reply to account link events.

If the link token has expired or has already been used, no webhook event will be sent and the user will be shown an error.

Property Type Description
type String accountLink
replyToken String Token for replying to this event. This value will not be included if the link has failed.
link Object link object. This will include whether the account link was successful or not and a nonce generated from the user ID on the provider's service.

Account link event example

{
  "type": "accountLink",
  "replyToken": "b60d432864f44d079f6d8efe86cf404b",
  "source": {
    "userId": "U91eeaf62d...",
    "type": "user"
  },
  "timestamp": 1513669370317,
  "link": {
    "result": "ok",
    "nonce": "xxxxxxxxxxxxxxx"
  }
}
Property Type Description
result String One of the following values to indicate whether the link was successful or not.
  • ok: Indicates the link was successful.
  • failed: Indicates the link failed for any reason, such as due to a user impersonation.
nonce String Specified nonce when verifying the user ID

Example link object

"link": {
  "result": "ok",
  "nonce": "xxxxxxxxxxxxxxx"
}

Indicates that a user linked a device with LINE.

Property Type Description
type String things
replyToken String Token for replying to this event
things.deviceId String Device ID of the device that has been linked with LINE.
things.type String link

If you use the LINE Things API, you can identify the device that has been linked or unlinked by the user from the device ID acquired by the Webhook event. For more information about the API, see Getting the product ID and PSDI by specifying the device ID in the LINE Things API reference.

Device link event example

{
  "type": "things",
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U91eeaf62d..."
  },
  "things": {
    "deviceId": "t2c449c9d1...",
    "type": "link"
  }
}

Indicates that the user unlinked a device from LINE.

Property Type Description
type String things
replyToken String Token for replying to this event
things.deviceId String Device ID of the device that was unlinked from LINE.
things.type String unlink

If you use the LINE Things API, you can identify the device that has been linked or unlinked by the user from the device ID acquired by the Webhook event. For more information about the API, see Getting the product ID and PSDI by specifying the device ID in the LINE Things API reference.

Device unlink event example

{
  "type": "things",
  "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
  "timestamp": 1462629479859,
  "source": {
    "type": "user",
    "userId": "U91eeaf62d..."
  },
  "things": {
    "deviceId": "t2c449c9d1...",
    "type": "unlink"
  }
}

LINE Things scenario execution event

This event indicates that an automatic communication scenario has been executed.

Rather than returning an aggregated result for a scenario set, an execution result is returned for each individual scenario.

The order in which execution results are returned is independent of the order of the scenarios.

Property Type Description
type String things
replyToken String Token for replying to this event
things.deviceId String Device ID of the device that executed the scenario
things.type String scenarioResult
things.result.scenarioId String Scenario ID executed
things.result.revision Number Revision number of the scenario set containing the executed scenario
things.result.startTime Number Timestamp for when execution of scenario action started (milliseconds, LINE app time)
things.result.endTime Number Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
things.result.resultCode String Scenario execution completion status
See also things.result.resultCode definitions.
things.result.actionResults Array Execution result of individual operations specified in action
Note that an array of actions specified in a scenario has the following characteristics
  • The actions defined in a scenario are performed sequentially, from top to bottom.
  • Each action produces some result when executed.
    Even actions that do not generate data, such as SLEEP, return an execution result of type void.
  • The number of items in an action array may be 0.
Therefore, things.result.actionResults has the following properties:
  • The number of items in the array matches the number of actions defined in the scenario.
  • The order of execution results matches the order in which actions are performed. That is, in a scenario set with multiple GATT_READ actions, the results are returned in the order in which each individual GATT_READ action was performed.
  • If 0 actions are defined in the scenario, the number of items in things.result.actionResults will be 0.
things.result.actionResults[].type String void, binary
  • Depends on type of the executed action.
  • This property is always included if things.result.actionResults is not empty.
things.result.actionResults[].data String Base64-encoded binary data
This property is always included when things.result.actionResults[].type is binary.
things.result.bleNotificationPayload String Data contained in notification
The value is Base64-encoded binary data. Only included for scenarios where trigger.type = BLE_NOTIFICATION.
things.result.errorReason String Error reason

things.result.resultCode definition

resultCode Description
success Indicates that the execution has completed successfully
gatt_error Indicates that the execution of the GATT operation failed
  • GATT Service UUID is incorrect.
  • GATT Characteristic UUID is incorrect.
  • Attempted to write to a characteristic that cannot be written to.
runtime_error Indicates that an unexpected error has occurred
  • When an unexpected error has occurred

Example of LINE Things scenario execution event

{
  "events": [
    {
      "type": "things",
      "source": {
        "userId": "uXXX",
        "type": "user"
      },
      "timestamp": 1547817848122,
      "things": {
        "type": "scenarioResult",
        "deviceId": "tXXX",
        "result": {
          "scenarioId": "XXX",
          "revision": 2,
          "startTime": 1547817845950,
          "endTime": 1547817845952,
          "resultCode": "success",
          "bleNotificationPayload": "AQ==",
          "actionResults": [
            {
              "type": "binary",
              "data": "/w=="
            }
          ]
        }
      }
    }
  ],
  "destination": "uXXX"
}

OAuth

Issue channel access token

Note: This method issues a short-lived channel access token that is valid for 30 days. To issue a long-lived channel access token, use the "Issue" button found on the console.

Issues a short-lived channel access token.

Up to 30 tokens can be issued. If the maximum is exceeded, existing channel access tokens are revoked in the order of when they were first issued.

HTTP request

POST https://api.line.me/v2/oauth/accessToken

Request header

Request header Description
Content-Type application/x-www-form-urlencoded

Request body

Field Type Description
grant_type String client_credentials
client_id String Channel ID. Found on the console.
client_secret String Channel secret. Found on the console.

Example request

curl -v -X POST https://api.line.me/v2/oauth/accessToken \
-H "Content-Type:application/x-www-form-urlencoded" \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={channel ID}' \
--data-urlencode 'client_secret={channel secret}'
// No sample code available
# No sample code available
// No sample code available
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->createChannelAccessToken('<channel id>');
# No sample code available
# No sample code available
// No sample code available

Response

Returns a 200 HTTP status code and a JSON object with the following information.

Property Type Description
access_token String Short-lived channel access token. Valid for 30 days.
Note: Channel access tokens cannot be refreshed.
expires_in Number Time until channel access token expires in seconds from time the token is issued
token_type String Bearer

Example response

{
"access_token":"W1TeHCgfH2Liwa.....",
"expires_in":2592000,
"token_type":"Bearer"
}

Error response

Returns a 400 HTTP status code and a JSON object with the following information.

Property Type Description
error String Error summary
error_description String Details of the error. Not returned in certain situations.

Example error response

{
"error":"invalid_request",
"error_description":"some parameters missed or invalid"
}

Revoke channel access token

Revokes a channel access token.

HTTP request

POST https://api.line.me/v2/oauth/revoke

Request header

Request header Description
Content-Type application/x-www-form-urlencoded

Request body

Field Type Description
access_token String Channel access token

Response

Returns the status code 200 and an empty response body. No error occurs if an invalid channel access token is specified.

Example request

curl -v -X POST https://api.line.me/v2/oauth/revoke \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode 'access_token={channel access token}'
// No sample code available
# No sample code available
// No sample code available
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->revokeChannelAccessToken('<channel access token>');
# No sample code available
# No sample code available
// No sample code available

Error response

Returns a 400 HTTP status code and a JSON object with the following information.

Property Type Description
error String Error summary
error_description String Details of the error. Not returned in certain situations.

Example error response

{
"error":"invalid_request",
"error_description":"some parameters missed or invalid"
}

Message

Send reply message

Sends a reply message in response to an event from a user, group, or room.

Webhooks are used to notify you when an event occurs. For events that you can respond to, a reply token is issued for replying to messages.

Because the reply token becomes invalid after a certain period of time, responses should be sent as soon as a message is received. Reply tokens can only be used once.

HTTP request

POST https://api.line.me/v2/bot/message/reply

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
replyToken String Required Reply token received via webhook
messages Array of message objects Required Messages
Max: 5
notificationDisabled Boolean Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).
Default: false

Example request

curl -v -X POST https://api.line.me/v2/bot/message/reply \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
    "replyToken":"nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
    "messages":[
        {
            "type":"text",
            "text":"Hello, user"
        },
        {
            "type":"text",
            "text":"May I help you?"
        }
    ]
}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final TextMessage textMessage = new TextMessage("hello");
final ReplyMessage replyMessage = new ReplyMessage(
        "<replyToken>",
        textMessage);

final BotApiResponse botApiResponse;
try {
    botApiResponse = client.replyMessage(replyMessage).get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

System.out.println(botApiResponse);
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.ReplyMessage(<replyToken>, linebot.NewTextMessage("hello")).Do(); err != nil {
    ...
}
message = {
  type: 'text',
  text: 'hello'
}
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.reply_message("<replyToken>", message)
p response
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);

$textMessageBuilder = new \LINE\LINEBot\MessageBuilder\TextMessageBuilder('hello');
$response = $bot->replyMessage('<replyToken>', $textMessageBuilder);

echo $response->getHTTPStatus() . ' ' . $response->getRawBody();
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $messages = LINE::Bot::API::Builder::SendMessage->new(
)->add_text(
    text => 'hello',
);
my $res = $bot->reply_message("<replyToken>", $messages->build);
unless ($res->is_success) {
    # error handling
    ....
}
from linebot import LineBotApi
from linebot.models import TextSendMessage
from linebot.exceptions import LineBotApiError

line_bot_api = LineBotApi('<channel access token>')

try:
    line_bot_api.reply_message('<reply_token>', TextSendMessage(text='Hello World!'))
except LineBotApiError as e:
    # error handle
    ...
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

const message = {
  type: 'text',
  text: 'Hello World!'
};

client.replyMessage('<replyToken>', message)
  .then(() => {
    ...
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Send push message

Sends a push message to a user, group, or room at any time.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

HTTP request

POST https://api.line.me/v2/bot/message/push

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
to String Required ID of the target recipient. Use a userId, groupId, or roomId value returned in a webhook event object. Do not use the LINE ID found on LINE.
messages Array of message objects Required Messages
Max: 5
notificationDisabled Boolean Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).
Default: false

Example request

curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
    "to": "U4af4980629...",
    "messages":[
        {
            "type":"text",
            "text":"Hello, world1"
        },
        {
            "type":"text",
            "text":"Hello, world2"
        }
    ]
}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final TextMessage textMessage = new TextMessage("hello");
final PushMessage pushMessage = new PushMessage(
        "<to>",
        textMessage);

final BotApiResponse botApiResponse;
try {
    botApiResponse = client.pushMessage(pushMessage).get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

System.out.println(botApiResponse);
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.PushMessage(<to>, linebot.NewTextMessage("hello")).Do(); err != nil {
    ...
}
message = {
  type: 'text',
  text: 'hello'
}
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.push_message("<to>", message)
p response
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);

$textMessageBuilder = new \LINE\LINEBot\MessageBuilder\TextMessageBuilder('hello');
$response = $bot->pushMessage('<to>', $textMessageBuilder);

echo $response->getHTTPStatus() . ' ' . $response->getRawBody();
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $messages = LINE::Bot::API::Builder::SendMessage->new(
)->add_text(
    text => 'hello',
);
my $res = $bot->push_message("<to>", $messages->build);
unless ($res->is_success) {
    # error handling
    ....
}
from linebot import LineBotApi
from linebot.models import TextSendMessage
from linebot.exceptions import LineBotApiError

line_bot_api = LineBotApi('<channel access token>')

try:
    line_bot_api.push_message('<to>', TextSendMessage(text='Hello World!'))
except LineBotApiError as e:
    # error handle
    ...
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

const message = {
  type: 'text',
  text: 'Hello World!'
};

client.pushMessage('<to>', message)
  .then(() => {
    ...
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Send multicast message

Sends push messages to multiple users at any time. Messages cannot be sent to groups or rooms.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

HTTP request

POST https://api.line.me/v2/bot/message/multicast

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
to Array of strings Required Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE.
Max: 150 user IDs
messages Array of message objects Required Messages
Max: 5
notificationDisabled Boolean Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).
Default: false

Example request

curl -v -X POST https://api.line.me/v2/bot/message/multicast \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
    "to": ["U4af4980629...","U0c229f96c4..."],
    "messages":[
        {
            "type":"text",
            "text":"Hello, world1"
        },
        {
            "type":"text",
            "text":"Hello, world2"
        }
    ]
}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
user_ids = [user_id1, user_id2, ...]
client.multicast(user_ids, <message>)
userIDs := []string{ ... }
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.Multicast(userIDs, linebot.NewTextMessage("hello")).Do(); err != nil {
    ...
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$userIds = ['<userId1>', '<userId2>', ...];
$bot->multicast($userIds, '<message>');
# No sample code available
line_bot_api.multicast(['<user_id_1>', '<user_id_2>'], TextSendMessage(text='Hello World!'))
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Send broadcast message

Sends push messages to multiple users at any time.

note LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

HTTP request

POST https://api.line.me/v2/bot/message/broadcast

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
messages Array of message objects Required Messages
Max: 5
notificationDisabled Boolean Optional
  • true: The user doesn't receive a push notification when the message is sent.
  • false: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device).
Default: false

Example request

curl -v -X POST https://api.line.me/v2/bot/message/broadcast \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
    "messages":[
        {
            "type":"text",
            "text":"Hello, world1"
        },
        {
            "type":"text",
            "text":"Hello, world2"
        }
    ]
}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Get content

Gets image, video, and audio data sent by users.

HTTP request

GET https://api.line.me/v2/bot/message/{messageId}/content

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
messageId Message ID

Response

Returns status code 200 and the content in binary.

Content is automatically deleted after a certain period from when the message was sent. There is no guarantee for how long content is stored.

Example request

curl -v -X GET https://api.line.me/v2/bot/message/{messageId}/content \
-H 'Authorization: Bearer {channel access token}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final MessageContentResponse messageContentResponse;
try {
    messageContentResponse = client.getMessageContent("<messageId>").get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

Files.copy(messageContentResponse.getStream(),
           Files.createTempFile("foo", "bar"));
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
content, err := bot.GetMessageContent(<messageID>).Do()
if err != nil {
    ...
}
defer content.Content.Close()

...
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.get_message_content("<messageId>")
case response
when Net::HTTPSuccess then
  tf = Tempfile.open("content")
  tf.write(response.body)
else
  p "#{response.code} #{response.body}"
end
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getMessageContent('<messageId>');
if ($response->isSucceeded()) {
    $tempfile = tmpfile();
    fwrite($tempfile, $response->getRawBody());
} else {
    error_log($response->getHTTPStatus() . ' ' . $response->getRawBody());
}
use LINE::Bot::API;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $res = $bot->get_message_content("<messageId>");
unless ($res->is_success) {
    # error handling
    ....
}
my $filename = $ret->fh->filename;
open my $fh, '<', $file or die "$!: $file";
from linebot import LineBotApi

line_bot_api = LineBotApi('<channel access token>')

message_content = line_bot_api.get_message_content('<message_id>')
with open(file_path, 'wb') as fd:
    for chunk in message_content.iter_content():
        fd.write(chunk)
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getMessageContent('<messageId>')
  .then((stream) => {
    stream.on('data', (chunk) => {
      ...
    });
    stream.on('error', (err) => {
      // error handling
    });
  });

Get the target limit for additional messages

Gets the target limit for additional messages in the current month.

The number of messages retrieved by this operation includes the number of messages sent from LINE Official Account Manager.

Set a target limit with LINE Official Account Manager. For the procedures, refer to the LINE Official Account Manager manual.

Note: LINE@ accounts cannot call this API endpoint.

HTTP request

GET https://api.line.me/v2/bot/message/quota

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -v -X GET https://api.line.me/v2/bot/message/quota \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
type String One of the following values to indicate whether a target limit is set or not.
  • none. This indicates that a target limit is not set.
  • limited. This indicates that a target limit is set.
value Number The target limit for additional messages in the current month. This property is returned when the type property has a value of limited.

Example response

{
  "type":"limited",
  "value":1000
}

Get number of messages sent this month

Gets the number of messages sent in the current month.

The number of messages retrieved by this operation includes the number of messages sent from LINE Official Account Manager.

The number of messages retrieved by this operation is approximate. To get the correct number of sent messages, use LINE Official Account Manager or execute API operations for getting the number of sent messages.

Note: LINE@ accounts cannot call this API endpoint.

HTTP request

GET https://api.line.me/v2/bot/message/quota/consumption

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -v -X GET https://api.line.me/v2/bot/message/quota/consumption \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
totalUsage Number The number of sent messages in the current month

Example response

{
  "totalUsage":"500"
}

Get number of sent reply messages

Gets the number of messages sent with the /bot/message/reply endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

HTTP request

GET https://api.line.me/v2/bot/message/delivery/reply

Request headers

Request header Description
Authorization Bearer {channel access token}

Query parameters

Parameter Description
date Date the messages were sent
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/message/delivery/reply?date={yyyyMMdd} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
status String Status of the counting process. One of the following values is returned:
  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.
success Number The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

{
  "status":"ready",
  "success":10000
}

Get number of sent push messages

Gets the number of messages sent with the /bot/message/push endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

HTTP request

GET https://api.line.me/v2/bot/message/delivery/push

Request headers

Request header Description
Authorization Bearer {channel access token}

Query parameters

Parameter Description
date Date the messages were sent
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/message/delivery/push?date={yyyyMMdd} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
status String Status of the counting process. One of the following values is returned:
  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.
success Number The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

{
  "status":"ready",
  "success":10000
}

Get number of sent multicast messages

Gets the number of messages sent with the /bot/message/multicast endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

Note: LINE@ accounts under the free or basic plan cannot call this API endpoint.

HTTP request

GET https://api.line.me/v2/bot/message/delivery/multicast

Request headers

Request header Description
Authorization Bearer {channel access token}

Query parameters

Parameter Description
date Date the messages were sent
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/message/delivery/multicast?date={yyyyMMdd} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
status String Status of the counting process. One of the following values is returned:
  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.
success Number The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

{
  "status":"ready",
  "success":10000
}

Get number of sent broadcast messages

Gets the number of messages sent with the /bot/message/broadcast endpoint.

The number of messages retrieved by this operation does not include the number of messages sent from LINE Official Account Manager.

note LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

HTTP request

GET https://api.line.me/v2/bot/message/delivery/broadcast

Request headers

Request header Description
Authorization Bearer {channel access token}

Query parameters

Parameter Description
date Date the messages were sent
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/message/delivery/broadcast?date={yyyyMMdd} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
# No sample code available
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
status String Status of the counting process. One of the following values is returned:
  • ready: You can get the number of messages.
  • unready: The message counting process for the date specified in date has not been completed yet. Retry your request later. Normally, the counting process is completed within the next day.
  • out_of_service: The date specified in date is earlier than March 31, 2018, when the operation of the counting system started.
success Number The number of messages sent with the Messaging API on the date specified in date. The response has this property only when the value of status is ready.

Example response

{
  "status":"ready",
  "success":10000
}

Insight

Get number of message deliveries

Returns the number of messages sent on a specified day.

note LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

HTTP request

GET https://api.line.me/v2/bot/insight/message/delivery?date={date}

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type application/json

Query parameters

Parameter Required Description
date Required Date for which to retrieve number of sent messages
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/insight/message/delivery?date=20190418 \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_number_of_message_deliveries("20190101")
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns status code 200 and a JSON object with the following properties:

Property Type Description
status String Calculation status. One of:
  • ready: Calculation has finished; the numbers are up-to-date.
  • unready: We haven't finished calculating the number of sent messages for the specified date. Calculation usually takes about a day. Please try again later.
  • out_of_service: The specified date is earlier than the date on which we first started calculating sent messages (March 1, 2017).
broadcast Number Number of push messages sent to all of this LINE official account's friends (broadcast messages).
targeting Number Number of push messages sent to some of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
autoResponse Number Number of auto-response messages sent.
welcomeResponse Number Number of greeting messages sent.
chat Number Number of messages sent from LINE Official Account Manager Chat screen.
apiBroadcast Number Number of broadcast messages sent with the Send broadcast message Messaging API operation.
apiPush Number Number of push messages sent with the Send push message Messaging API operation.
apiMulticast Number Number of multicast messages sent with the Send multicast message Messaging API operation.
apiReply Number Number of replies sent with the Send reply message Messaging API operation.

Properties after broadcast contain the number of messages sent on the date specified indate. These extra properties are included only if status is ready.

Example response

{
    "status": "ready",
    "broadcast": 5385,
    "targeting": 522
}

Get number of followers

Returns the number of users who have added the bot on or before a specified date.

note LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

HTTP request

GET https://api.line.me/v2/bot/insight/followers?date={date}

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type application/json

Query parameters

Parameter Required Description
date Required Date for which to retrieve the number of followers.
  • Format: yyyyMMdd (Example: 20191231)
  • Timezone: UTC+9

Example request

curl -v -X GET https://api.line.me/v2/bot/insight/followers?date=20190418 \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_number_of_followers("20190101")
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns status code 200 and a JSON object with the following properties:

Property Type Description
status String Calculation status. One of:
  • ready: Calculation has finished. The numbers are up-to-date.
  • unready:We haven't finished calculating followers for the specified date. Calculation usually takes about a day. Please try again later.
  • out_of_service:The specified date is earlier than the date on which we first started calculating followers (November 1, 2016).
followers Number The number of times, as of the specified date, that a user added this LINE official account as a friend for the first time. The number doesn't decrease even if a user later blocks the account or when they delete their LINE account.
targetedReaches Number The number of users, as of the specified date, that the official account can reach through targeted messages based on gender, age, and/or region. This number only includes users who are active on LINE or LINE services and whose demographics have a high level of certainty.
blocks Number The number of users blocking the account as of the specified date. The number decreases when a user unblocks the account.

Properties after followers are only returned if status is ready.

Example response

{
    "status": "ready",
    "followers": 7620,
    "targetedReaches": 5848,
    "blocks": 237
}

Get friend demographics

Retrieves the demographic attributes for a bot's friends. In addition, you can check the information of friends only for LINE official accounts created by users in Japan (JP), Thailand (TH) and Taiwan (TW).

note LINE official account migration

You can't call this API with a LINE@ account or LINE official account that hasn't been migrated to the account plans implemented on April 18, 2019. Please migrate your account first. For more information, see Migration of LINE@ accounts.

note Not real-time data

It can take up to 3 days for demographic information to be calculated. This means the information the API returns may be 3 days old. Furthermore, your Target reach number must be at least 20 to retrieve demographic information.

HTTP request

GET https://api.line.me/v2/bot/insight/demographic

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type application/json

Example request

curl -v -X GET https://api.line.me/v2/bot/insight/demographic \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_friend_demographics
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns status code 200 and a JSON object with these properties:

Property Type Description
available Boolean true if friend demographic information is available.
genders Array Percentage per gender
genders[].gender String Gender
genders[].percentage Number Percentage
ages Array Percentage per age group
ages[].age String Age group
ages[].percentage Number Percentage
areas Array Percentage per area
areas[].area String Area
areas[].percentage Number Percentage
appTypes Array Percentage by OS
appTypes[].appType String OS
appTypes[].percentage Number Percentage
subscriptionPeriods Array Percentage per friendship duration
subscriptionPeriods[].subscriptionPeriod String Friendship duration
subscriptionPeriods[].percentage Number Percentage

The elements of each Array are included in the response only if the value of available istrue.

Example response

{
    "available": true,
    "genders": [
        {
            "gender": "unknown",
            "percentage": 37.6
        },
        {
            "gender": "male",
            "percentage": 31.8
        },
        {
            "gender": "female",
            "percentage": 30.6
        }
    ],
    "ages": [
        {
            "age": "unknown",
            "percentage": 37.6
        },
        {
            "age": "from50",
            "percentage": 17.3
        },
        ...
    ],
    "areas": [
        {
            "area": "unknown",
            "percentage": 42.9
        },
        {
            "area": "徳島",
            "percentage": 2.9
        },
        ...
    ],
    "appTypes": [
        {
            "appType": "ios",
            "percentage": 62.4
        },
        {
            "appType": "android",
            "percentage": 27.7
        },
        {
            "appType": "others",
            "percentage": 9.9
        }
    ],
    "subscriptionPeriods": [
        {
            "subscriptionPeriod": "over365days",
            "percentage": 96.4
        },
        {
            "subscriptionPeriod": "within365days",
            "percentage": 1.9
        },
        {
            "subscriptionPeriod": "within180days",
            "percentage": 1.2
        },
        {
            "subscriptionPeriod": "within90days",
            "percentage": 0.5
        },
        {
            "subscriptionPeriod": "within30days",
            "percentage": 0.1
        },
        {
            "subscriptionPeriod": "within7days",
            "percentage": 0
        }
    ]
}

Profile

Get profile

Gets user profile information.

HTTP request

GET https://api.line.me/v2/bot/profile/{userId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
userId User ID that is returned in a webhook event object. Do not use the LINE ID found on LINE.

Example request

curl -v -X GET https://api.line.me/v2/bot/profile/{userId} \
-H 'Authorization: Bearer {channel access token}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final UserProfileResponse userProfileResponse;
try {
    userProfileResponse = client.getProfile("<userId>").get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

System.out.println(userProfileResponse.getUserId());
System.out.println(userProfileResponse.getDisplayName());
System.out.println(userProfileResponse.getPictureUrl());
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetProfile(<userId>).Do();
if err != nil {
    ...
}
println(res.Displayname)
println(res.PicutureURL)
println(res.StatusMessage)
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.get_profile("<userId>")
case response
when Net::HTTPSuccess then
  contact = JSON.parse(response.body)
  p contact['displayName']
  p contact['pictureUrl']
  p contact['statusMessage']
else
  p "#{response.code} #{response.body}"
end
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getProfile('<userId>');
if ($response->isSucceeded()) {
    $profile = $response->getJSONDecodedBody();
    echo $profile['displayName'];
    echo $profile['pictureUrl'];
    echo $profile['statusMessage'];
}
use LINE::Bot::API;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $res = $bot->get_profile("<userId>");
unless ($res->is_success) {
    # error handling
    ....
}

say $ret->display_name;
say $ret->user_id;
say $ret->picture_url;
say $ret->status_message;
from linebot import LineBotApi
from linebot.exceptions import LineBotApiError

line_bot_api = LineBotApi('<channel access token>')

try:
    profile = line_bot_api.get_profile('<user_id>')
except LineBotApiError as e:
    # error handle
    ...
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getProfile('<userId>')
  .then((profile) => {
    console.log(profile.displayName);
    console.log(profile.userId);
    console.log(profile.pictureUrl);
    console.log(profile.statusMessage);
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
displayName String User's display name
userId String Identifier of the user
pictureUrl String Profile image URL. "https" image URL. Not included in the response if the user doesn't have a profile image.
statusMessage String User's status message. Not included in the response if the user doesn't have a status message.

Example response

{
    "displayName":"LINE taro",
    "userId":"U4af4980629...",
    "pictureUrl":"https://obs.line-apps.com/...",
    "statusMessage":"Hello, LINE!"
}

Group

Get group member user IDs

Note: This feature is available only to verified or premium accounts. For more information about account types, see the LINE Account Connect page on the LINE for Business website.

Gets the user IDs of the members of a group that the LINE official account is in. This includes the user IDs of users who have not added the LINE official account as a friend or has blocked the LINE official account.

HTTP request

GET https://api.line.me/v2/bot/group/{groupId}/members/ids

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
groupId Required Group ID. Found in the source object of webhook event objects.

Query parameters

Parameter Required Description
start Optional Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.

Example request

curl -v -X GET https://api.line.me/v2/bot/group/{groupId}/members/ids?start={continuationToken} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_group_member_ids(<groupId>, <continuationToken>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetGroupMemberIDs(<groupId>, <continuationToken>).Do()
if err != nil {
    ...
}
for _, id := range res.MemberIDs {
    println(id)
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getGroupMemberIds(<groupId>, <continuationToken>);
# No sample code available
member_ids_res = line_bot_api.get_group_member_ids(<group_id>)
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getGroupMemberIds('<groupId>')
  .then((ids) => {
    ids.forEach((id) => console.log(id));
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
memberIds Array of strings List of user IDs of the members in the group. The number of user IDs returned in memberIds is not fixed. Users who have not agreed to the Official Accounts Terms of Use are not included in memberIds.
Max: 100 user IDs
next String A continuation token to get the next array of user IDs of the members in the group. Returned only when there are remaining user IDs that were not returned in memberIds in the original request.

Example response

{  
   "memberIds":[  
      "U4af4980629...",
      "U0c229f96c4...",
      "U95afb1d4df..."
   ],
   "next":"jxEWCEEP..."
}

Get group member profile

Gets the user profile of a member of a group that the LINE official account is in if the user ID of the group member is known. You can get user profiles of users who have not added the LINE official account as a friend or have blocked the LINE official account.

HTTP request

GET https://api.line.me/v2/bot/group/{groupId}/member/{userId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
groupId Group ID. Found in the source object of webhook event objects.
userId User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

Example request

curl -v -X GET https://api.line.me/v2/bot/group/{groupId}/member/{userId} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_group_member_profile(<groupId>, <userId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetGroupMemberProfile(<groupId>, <userId>).Do()
if err != nil {
    ...
}
println(res.Displayname)
println(res.PicutureURL)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getGroupMemberProfile(<groupId>, <userId>);
# No sample code available
profile = line_bot_api.get_group_member_profile(<group_id>, <user_id>)
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getGroupMemberProfile('<groupId>', '<userId>')
  .then((profile) => {
    console.log(profile.displayName);
    console.log(profile.userId);
    console.log(profile.pictureUrl);
    console.log(profile.statusMessage);
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
displayName String Display name
userId String User ID
pictureUrl String Profile image URL

Example response

{
    "displayName":"LINE taro",
    "userId":"U4af4980629...",
    "pictureUrl":"https://obs.line-apps.com/..."
}

Leave group

Leaves a group.

HTTP request

POST https://api.line.me/v2/bot/group/{groupId}/leave

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
groupId Group ID. Found in the source object of webhook event objects.

Example request

curl -v -X POST https://api.line.me/v2/bot/group/{groupId}/leave \
-H 'Authorization: Bearer {channel access token}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final BotApiResponse botApiResponse;
try {
    botApiResponse = client.leaveGroup("<roomId>").get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

System.out.println(botApiResponse);
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.LeaveGroup(<groupId>).Do(); err != nil {
    ...
}
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.leave_group("<groupId>")
p response.body
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->leaveGroup('<groupId>');
echo $response->getHTTPStatus() . ' ' . $response->getRawBody();
use LINE::Bot::API;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $res = $bot->leave_group("<groupId>");
unless ($res->is_success) {
    # error handling
    ....
}
from linebot import LineBotApi
from linebot.exceptions import LineBotApiError

line_bot_api = LineBotApi('<channel access token>')

try:
    line_bot_api.leave_group('<group_id>')
except LineBotApiError as e:
    # error handle
    ...
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.leaveGroup('<groupId>')
  .then(() => {
    ...
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Room

Get room member user IDs

Note: This feature is available only to verified or premium accounts. For more information about account types, see the LINE Account Connect page on the LINE for Business website.

Gets the user IDs of the members of a room that the LINE official account is in. This includes the user IDs of users who have not added the LINE official account as a friend or has blocked the LINE official account.

HTTP request

GET https://api.line.me/v2/bot/room/{roomId}/members/ids

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
roomId Required Room ID. Found in the source object of webhook event objects.

Query parameters

Parameter Required Description
start Optional Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.

Example request

curl -v -X GET https://api.line.me/v2/bot/room/{roomId}/members/ids?start={continuationToken} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
        config.channel_token = ENV["<channel token>"]
}
client.get_room_member_ids(<roomId>, <continuationToken>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetRoomMemberIDs(<roomId>, <continuationToken>).Do()
if err != nil {
    ...
}
for _, id := range res.MemberIDs {
    println(id)
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getRoomMemberIds('<roomId>', '<continuationToken>');
# No sample code available
member_ids_res = line_bot_api.get_room_member_ids(<room_id>)
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getRoomMemberIds('<roomId>')
  .then((ids) => {
    ids.forEach((id) => console.log(id));
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
memberIds Array of strings List of user IDs of the members in the room. The number of user IDs returned in memberIds is not fixed. Users who have not agreed to the Official Accounts Terms of Use are not included in memberIds.
Max: 100 user IDs
next String A continuation token to get the next array of user IDs of the members in the room. Returned only when there are remaining user IDs that were not returned in memberIds in the original request.

Example response

{  
   "memberIds":[  
      "U4af4980629...",
      "U0c229f96c4...",
      "U95afb1d4df..."
   ],
   "next":"jxEWCEEP..."
}

Get room member profile

Gets the user profile of a member of a room that the LINE official account is in if the user ID of the room member is known. You can get user profiles of users who have not added the LINE official account as a friend or have blocked the LINE official account.

HTTP request

GET https://api.line.me/v2/bot/room/{roomId}/member/{userId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
roomId Room ID. Found in the source object of webhook event objects.
userId User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

Example request

curl -v -X GET https://api.line.me/v2/bot/room/{roomId}/member/{userId} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_room_member_profile(<roomId>, <userId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetRoomMemberProfile(<roomId>, <userId>).Do()
if err != nil {
    ...
}
println(res.Displayname)
println(res.PicutureURL)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getRoomMemberProfile(<roomId>, <userId>);
# No sample code available
profile = line_bot_api.get_room_member_profile(<room_id>, <user_id>)
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.getRoomMemberProfile('<roomId>', '<userId>')
  .then((profile) => {
    console.log(profile.displayName);
    console.log(profile.userId);
    console.log(profile.pictureUrl);
    console.log(profile.statusMessage);
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and a JSON object with the following information.

Property Type Description
displayName String Display name
userId String User ID
pictureUrl String Profile image URL

Example response

{
    "displayName":"LINE taro",
    "userId":"U4af4980629...",
    "pictureUrl":"https://obs.line-apps.com/..."
}

Leave room

Leaves a room.

HTTP request

POST https://api.line.me/v2/bot/room/{roomId}/leave

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
roomId Room ID. Found in the source object of webhook event objects.

Example request

curl -v -X POST https://api.line.me/v2/bot/room/{roomId}/leave \
-H 'Authorization: Bearer {channel access token}'
final LineMessagingClient client = LineMessagingClient
        .builder("<channel access token>")
        .build();

final BotApiResponse botApiResponse;
try {
    botApiResponse = client.leaveRoom("<roomId>").get();
} catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
    return;
}

System.out.println(botApiResponse);
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.LeaveRoom(<roomId>).Do(); err != nil {
    ...
}
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
response = client.leave_room("<roomId>")
p response.body
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->leaveRoom('<roomId>');
echo $response->getHTTPStatus() . ' ' . $response->getRawBody();
use LINE::Bot::API;

my $bot = LINE::Bot::API->new(
    channel_secret       => "<channel secret>",
    channel_access_token => "<channel access token>",
);

my $res = $bot->leave_room("<roomId>");
unless ($res->is_success) {
    # error handling
    ....
}
from linebot import LineBotApi
from linebot.exceptions import LineBotApiError

line_bot_api = LineBotApi('<channel access token>')

try:
    line_bot_api.leave_room('<room_id>')
except LineBotApiError as e:
    # error handle
    ...
const line = require('@line/bot-sdk');

const client = new line.Client({
  channelAccessToken: '<channel access token>'
});

client.leaveRoom('<roomId>')
  .then(() => {
    ...
  })
  .catch((err) => {
    // error handling
  });

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Rich menu

Note: Rich menus created using the Messaging API are only supported on LINE 7.14.0 and later for Android and iOS.

Customizable menu that is displayed on your LINE official account's chat screen. For more information, see Using rich menus.

Create rich menu

Creates a rich menu.

You must upload a rich menu image, and set the rich menu as the default rich menu or link the rich menu to a user for the rich menu to be displayed. You can create up to 1000 rich menus for one LINE official account with the Messaging API.

HTTP request

POST https://api.line.me/v2/bot/richmenu

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type application/json

Request body

The rich menu represented as a rich menu object.

Example request

curl -v -X POST https://api.line.me/v2/bot/richmenu \
-H 'Authorization: Bearer {channel access token}' \
-H 'Content-Type: application/json' \
-d \
'{
    "size": {
      "width": 2500,
      "height": 1686
    },
    "selected": false,
    "name": "Nice richmenu",
    "chatBarText": "Tap here",
    "areas": [
      {
        "bounds": {
          "x": 0,
          "y": 0,
          "width": 2500,
          "height": 1686
        },
        "action": {
          "type": "postback",
          "data": "action=buy&itemid=123"
        }
      }
   ]
}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}

rich_menu = {
    <rich menu content>
}
client.create_rich_menu(rich_menu)
richMemu := linebot.RichMenu{ ... }
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.CreateRichMenu(richMemu).Do()
if err != nil {
    t.Error(err.Error())
}
println(res.RichMenuID)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$richMenuBuilder = new \LINE\LINEBot\RichMenuBuilder(...)
$response = $bot->createRichMenu($richMenuBuilder);
# No sample code available
rich_menu_to_create = RichMenu(
    size=RichMenuSize(width=2500, height=843),
    selected=False,
    name="Nice richmenu",
    chat_bar_text="Tap here",
    areas=[RichMenuArea(
        bounds=RichMenuBounds(x=0, y=0, width=2500, height=843),
        action=URIAction(label='Go to line.me', uri='https://line.me'))]
)
rich_menu_id = line_bot_api.create_rich_menu(rich_menu=rich_menu_to_create)
// No sample code available

Response

Returns the status code 200 and the ID of the rich menu.

Example response

{
  "richMenuId": "{richMenuId}"
}

Upload rich menu image

Uploads and attaches an image to a rich menu.

You can use rich menu images with the following specifications:

  • Image format: JPEG or PNG
  • Image size (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270
  • Maximum file size: 1 MB

Note: You cannot replace an image attached to a rich menu. To update your rich menu image, create a new rich menu object and upload another image.

HTTP request

POST https://api.line.me/v2/bot/richmenu/{richMenuId}/content

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type image/jpeg or image/png
Content-Length The length of the request body in octets (8-bit bytes). Must be a non-negative value.

Path parameters

Parameter Required Description
richMenuId Required The ID of the rich menu to attach the image to

Example request

curl -v -X POST https://api.line.me/v2/bot/richmenu/{richMenuId}/content \
-H "Authorization: Bearer {channel access token}" \
-H "Content-Type: image/jpeg" \
-T image.jpg
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.create_rich_menu_image(<richMenuId>, <file>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.UploadRichMenuImage(<richMenuId>, <imagePath>).Do(); err != nil {
    ...
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$imagePath = '/path/to/image.jpeg';
$contentType = 'image/jpeg';
$response = $bot->uploadRichMenuImage(<richMenuId>, $imagePath, $contentType);
# No sample code available
with open(<file_path>, 'rb') as f:
    line_bot_api.set_rich_menu_image(<rich_menu_id>, <content_type>, f)
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Download rich menu image

Downloads an image associated with a rich menu.

HTTP request

GET https://api.line.me/v2/bot/richmenu/{richMenuId}/content

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
richMenuId Required ID of the rich menu with the image to be downloaded

Response

Returns the status code 200 and the binary data of the rich menu image. The image can be downloaded as shown in the example request.

Example request

curl -v -X GET "https://api.line.me/v2/bot/richmenu/{richMenuId}/content" \
-H 'Authorization: Bearer {channel access token}' \
-o picture.jpg
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_rich_menu_image(<richMenuId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
content, err := bot.DownloadRichMenuImage(<richMenuId>).Do()
if err != nil {
    ...
}
defer content.Content.Close()

...
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->downloadRichMenuImage(<richMenuId>);
# No sample code available
content = line_bot_api.get_rich_menu_image(<rich_menu_id>)
with open(file_path, 'wb') as fd:
    for chunk in content.iter_content():
        fd.write(chunk)
// No sample code available

Get rich menu list

Gets a list of all rich menus created by Create rich menu.

Note: You can't retrieve rich menus created with LINE Official Account Manager.

HTTP request

GET https://api.line.me/v2/bot/richmenu/list

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -v -X GET https://api.line.me/v2/bot/richmenu/list \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_rich_menus
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetRichMenuList().Do()
if err != nil {
    ...
}
for _, richMenu := range res {
    println(richMenu.RichMenuID)
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getRichMenuList();
# No sample code available
from linebot import LineBotApi
from linebot.exceptions import LineBotApiError

rich_menu_list = line_bot_api.get_rich_menu_list()

// No sample code available

Response

Returns the status code 200 and a list of rich menu response objects.

Property Type Description
richmenus Array Array of rich menu response objects

Example response

{
  "richmenus": [
    {
      "richMenuId": "{richMenuId}",
      "size": {
        "width": 2500,
        "height": 1686
      },
      "selected": false,
      "areas": [
        {
          "bounds": {
            "x": 0,
            "y": 0,
            "width": 2500,
            "height": 1686
          },
          "action": {
            "type": "postback",
            "data": "action=buy&itemid=123"
          }
        }
      ]
    }
  ]
}

Get rich menu

Gets a rich menu via a rich menu ID.

HTTP request

GET https://api.line.me/v2/bot/richmenu/{richMenuId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
richMenuId Required ID of an uploaded rich menu

Example request

curl -v -X GET https://api.line.me/v2/bot/richmenu/{richMenuId} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_rich_menu(<richMenuId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetRichMenu(<richMenuId>).Do()
if err != nil {
    ...
}
println(res.RichMenuID)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getRichMenu(<richMenuId>);
# No sample code available
rich_menu = line_bot_api.get_rich_menu(rich_menu_id)
// No sample code available

Response

Returns the status code 200 and a rich menu response object.

Example response

{
  "richMenuId": "{richMenuId}",
  "size": {
     "width": 2500,
     "height": 1686
   },
   "selected": false,
   "areas": [
     {
       "bounds": {
         "x": 0,
         "y": 0,
         "width": 2500,
         "height": 1686
       },
       "action": {
         "type": "postback",
         "data": "action=buy&itemid=123"
       }
     }
   ]
}

Delete rich menu

Deletes a rich menu.

HTTP request

DELETE https://api.line.me/v2/bot/richmenu/{richMenuId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
richMenuId Required ID of an uploaded rich menu

Example request

curl -v -X DELETE https://api.line.me/v2/bot/richmenu/{richMenuId} \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.delete_rich_menu(<richMenuId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.DeleteRichMenu(<richMenuId>).Do(); err != nil {
    ...
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->deleteRichMenu(<richMenuId>);
# No sample code available
line_bot_api.delete_rich_menu(<rich_menu_id>)
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Set default rich menu

Sets the default rich menu. The default rich menu is displayed to all users who have added your LINE official account as a friend and are not linked to any per-user rich menu.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

HTTP request

POST https://api.line.me/v2/bot/user/all/richmenu/{richMenuId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
richMenuId Required ID of an uploaded rich menu

Example request

curl -v -X POST https://api.line.me/v2/bot/user/all/richmenu/{richMenuId} \
-H "Authorization: Bearer {channel access token}"
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.set_default_rich_menu(<richMenuId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.SetDefaultRichMenu(<richMenuId>).Do(); err != nil {
    ...
}
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Get default rich menu ID

Gets the ID of the default rich menu set with the Messaging API.

HTTP request

GET https://api.line.me/v2/bot/user/all/richmenu

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -v -X GET https://api.line.me/v2/bot/user/all/richmenu \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new { |config|
    config.channel_secret = "<channel secret>"
    config.channel_token = "<channel access token>"
}
p client.get_default_rich_menu
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetDefaultRichMenu().Do()
if err != nil {
    ...
}
println(res.RichMenuID)
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and a JSON object with the rich menu ID.

Example response

{
    "richMenuId": "{richMenuId}"
}

Cancel default rich menu

Cancels the default rich menu set with the Messaging API.

HTTP request

DELETE https://api.line.me/v2/bot/user/all/richmenu

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -v -X DELETE https://api.line.me/v2/bot/user/all/richmenu \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.unset_default_rich_menu
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.CancelDefaultRichMenu().Do(); err != nil {
    ...
}
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Links a rich menu to a user. Only one rich menu can be linked to a user at one time.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

HTTP request

POST https://api.line.me/v2/bot/user/{userId}/richmenu/{richMenuId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
richMenuId Required ID of an uploaded rich menu
userId Required User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

Example request

curl -v -X POST https://api.line.me/v2/bot/user/{userId}/richmenu/{richMenuId} \
-H "Authorization: Bearer {channel access token}"
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.link_user_rich_menu(<userId>, <richMenuId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.LinkUserRichMenu(<userId>, <richMenuId>).Do(); err != nil {
    ...
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->linkRichMenu(<userId>, <richMenuId>);
# No sample code available
line_bot_api.link_rich_menu_to_user(<user_id>, <rich_menu_id>)
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Links a rich menu to multiple users.

The rich menu is displayed in the following order of priority (highest to lowest):

  1. The per-user rich menu set with the Messaging API
  2. The default rich menu set with the Messaging API
  3. The default rich menu set with LINE Official Account Manager

HTTP request

POST https://api.line.me/v2/bot/richmenu/bulk/link

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
richMenuId String Required ID of an uploaded rich menu
userIds Array of strings Required Array of user IDs. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.
Max: 150 user IDs

Example request

curl -v -X POST https://api.line.me/v2/bot/richmenu/bulk/link \
-H "Authorization: Bearer {channel access token}" \
-H "Content-Type: application/json" \
-d '{
  "richMenuId":"{richMenuId}",
  "userIds":["{userId1}","{userId2}"]
}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.bulk_link_rich_menus([<userId1>, <userId2>], <richMenuId>)
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 202 and an empty JSON object.

Unlike linking a rich menu to a user, this request is processed asynchronously in the background. Normally, the process is completed within a few seconds.

To verify whether the request was processed successfully, get the rich menu ID linked to the users and check if the rich menu is actually linked to the users.

Example response

{}

Get rich menu ID of user

Gets the ID of the rich menu linked to a user.

HTTP request

GET https://api.line.me/v2/bot/user/{userId}/richmenu

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
userId Required User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

Example request

curl -v -X GET https://api.line.me/v2/bot/user/{userId}/richmenu \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.get_user_rich_menu(<userId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.GetUserRichMenu(<userId>).Do()
if err != nil {
    ...
}
println(res.RichMenuID)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->getRichMenuId(<userId>);
# No sample code available
rich_menu_id = line_bot_api.get_rich_menu_id_of_user(<user_id>)
// No sample code available

Response

Returns the status code 200 and a JSON object with the rich menu ID.

Example response

{
    "richMenuId": "{richMenuId}"
}

Unlinks a rich menu from a user.

HTTP request

DELETE https://api.line.me/v2/bot/user/{userId}/richmenu

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
userId Required User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.

Example request

curl -v -X DELETE https://api.line.me/v2/bot/user/{userId}/richmenu \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.unlink_user_rich_menu(<userId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
if _, err := bot.UnlinkUserRichMenu(<userId>).Do(); err != nil {
    ...
}
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$bot->unlinkRichMenu(<userId>);
# No sample code available
line_bot_api.unlink_rich_menu_from_user(<user_id>)
// No sample code available

Response

Returns the status code 200 and an empty JSON object.

Example response

{}

Unlinks rich menus from multiple users.

HTTP request

POST https://api.line.me/v2/bot/richmenu/bulk/unlink

Request headers

Request header Description
Content-Type application/json
Authorization Bearer {channel access token}

Request body

Property Type Required Description
userIds Array of strings Required Array of user IDs. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.
Max: 150 user IDs

Example request

curl -v -X POST https://api.line.me/v2/bot/richmenu/bulk/unlink \
-H "Authorization: Bearer {channel access token}" \
-H "Content-Type: application/json" \
-d '{
  "userIds":["{userId1}","{userId2}"]
}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.bulk_unlink_rich_menus([<userId1>, <userId2>])
// No sample code available
// No sample code available
# No sample code available
# No sample code available
// No sample code available

Response

Returns the status code 202 and an empty JSON object.

Unlike unlinking a rich menu from a user, this request is processed asynchronously in the background. Normally, the process is completed within a few seconds.

To verify whether the request was processed successfully, get the rich menu ID linked to the users and check if the unlinked rich menus are actually not linked to the users.

Example response

{}

Issues a link token used for the account link feature.

HTTP request

POST https://api.line.me/v2/bot/user/{userId}/linkToken

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Required Description
userId Required User ID for the LINE account to be linked. Found in the source object of account link event objects. Do not use the LINE ID used in LINE.

Example request

curl -X POST https://api.line.me/v2/bot/user/{userId}/linkToken \
-H 'Authorization: Bearer {channel access token}'
// No sample code available
client = Line::Bot::Client.new{ |config|
    config.channel_secret = ENV["<channel secret>"]
    config.channel_token = ENV["<channel token>"]
}
client.create_link_token(<userId>)
bot, err := linebot.New(<channel secret>, <channel token>)
if err != nil {
    ...
}
res, err := bot.IssueLinkToken(<userId>).Do()
if err != nil {
    ...
}
println(res.LinkToken)
$httpClient = new \LINE\LINEBot\HTTPClient\CurlHTTPClient('<channel access token>');
$bot = new \LINE\LINEBot($httpClient, ['channelSecret' => '<channel secret>']);
$response = $bot->createLinkToken(<userId>);
# No sample code available
link_token_response = line_bot_api.issue_link_token(<user_id>)
// No sample code available

Response

Returns the status code 200 and a link token. Link tokens are valid for 10 minutes and can only be used once.

Note: The validity period may change without notice.

Example response

{
  "linkToken": "NMZTNuVrPTqlr2IF8Bnymkb7rXfYv5EY"
}

Common properties for messages

The following properties can be specified in all the message objects.

Quick reply

These properties are used for the quick reply feature. Supported on LINE 8.11.0 and later for iOS and Android. For more information, see Using quick replies.

Property Type Required Description
quickReply Object Optional items object

If the user receives multiple message objects, the quickReply property of the last message object is displayed.

items object

This is a container that contains quick reply buttons.

Property Type Required Description
items Array of objects Required Quick reply button objects. Max: 13 objects
Quick reply button object

This is a quick reply option that is displayed as a button.

Property Type Required Description
type String Required action
imageUrl String Optional URL of the icon that is displayed at the beginning of the button
  • Max: 1000 characters
  • URL scheme: https
  • Image format: PNG
  • Aspect ratio: 1:1
  • Data size: Up to 1 MB
There is no limit on the image size.
If the action property has a camera action, camera roll action, or location action, and the imageUrl property is not set, the default icon is displayed.
action Object Required Action performed when this button is tapped. Specify an action object. The following is a list of the available actions:

If a version of LINE that doesn't support the quick reply feature receives a message that contains quick reply buttons, only the message is displayed.

Example items object

"quickReply": {
  "items": [
    {
      "type": "action",
      "action": {
        "type": "cameraRoll",
        "label": "Send photo"
      }
    },
    {
      "type": "action",
      "action": {
        "type": "camera",
        "label": "Open camera"
      }
    }
  ]
}

Text message

Property Type Required Description
type String Required text
text String Required Message text. You can include the following emoji: Max: 2000 characters

Text message example

{
    "type": "text",
    "text": "Hello, world"
}

Text message example with emoji


{
    "type": "text",
    "text": "\uDBC0\uDC84 LINE emoji"
}

Sticker message

Property Type Required Description
type String Required sticker
packageId String Required Package ID for a set of stickers. For information on package IDs, see the Sticker list.
stickerId String Required Sticker ID. For a list of sticker IDs for stickers that can be sent with the Messaging API, see the Sticker list.

Sticker message example

{
  "type": "sticker",
  "packageId": "1",
  "stickerId": "1"
}

Image message

Property Type Required Description
type String Required image
originalContentUrl String Required Image URL (Max: 1000 characters)
HTTPS
JPEG
Max: 4096 x 4096
Max: 1 MB
previewImageUrl String Required Preview image URL (Max: 1000 characters)
HTTPS
JPEG
Max: 240 x 240
Max: 1 MB

Image message example

{
    "type": "image",
    "originalContentUrl": "https://example.com/original.jpg",
    "previewImageUrl": "https://example.com/preview.jpg"
}

Video message

Property Type Required Description
type String Required video
originalContentUrl String Required URL of video file (Max: 1000 characters)
HTTPS
mp4
Max: 1 minute
Max: 10 MB

A very wide or tall video may be cropped when played in some environments.
previewImageUrl String Required URL of preview image (Max: 1000 characters)
HTTPS
JPEG
Max: 240 x 240
Max: 1 MB

Video message example

{
    "type": "video",
    "originalContentUrl": "https://example.com/original.mp4",
    "previewImageUrl": "https://example.com/preview.jpg"
}

Audio message

Property Type Required Description
type String Required audio
originalContentUrl String Required URL of audio file (Max: 1000 characters)
HTTPS
m4a
Max: 1 minute
Max: 10 MB
duration Number Required Length of audio file (milliseconds)

Audio message example

{
    "type": "audio",
    "originalContentUrl": "https://example.com/original.m4a",
    "duration": 60000
}

Location message

Property Type Required Description
type String Required location
title String Required Title
Max: 100 characters
address String Required Address
Max: 100 characters
latitude Decimal Required Latitude
longitude Decimal Required Longitude

Location message example

{
    "type": "location",
    "title": "my location",
    "address": "〒150-0002 東京都渋谷区渋谷2丁目21−1",
    "latitude": 35.65910807942215,
    "longitude": 139.70372892916203
}

Imagemap message

Imagemap messages are messages configured with an image that has multiple tappable areas. You can assign one tappable area for the entire image or different tappable areas on divided areas of the image.

You can also play a video on the image and display a label with a hyperlink after the video is finished.

Property Type Required Description
type String Required imagemap
baseUrl String Required Base URL of the image
Max: 1000 characters
HTTPS
For more information about the specification of images supported by imagemap messages, see How to configure an image.
altText String Required Alternative text
Max: 400 characters
baseSize.width Number Required Width of base image in pixels. Set to 1040.
baseSize.height Number Required Height of base image. Set to the height that corresponds to a width of 1040 pixels.
video.originalContentUrl String *1 URL of the video file (Max: 1000 characters)
HTTPS
mp4
Max: 1 minute
Max: 10 MB

Note: A very wide or tall video may be cropped when played in some environments.
video.previewImageUrl String *1 URL of the preview image (Max: 1000 characters)
HTTPS
JPEG
Max: 240 x 240 pixels
Max: 1 MB
video.area.x Number *1 Horizontal position of the video area relative to the left edge of the imagemap area. Value must be 0 or higher.
video.area.y Number *1 Vertical position of the video area relative to the top of the imagemap area. Value must be 0 or higher.
video.area.width Number *1 Width of the video area
video.area.height Number *1 Height of the video area
video.externalLink.linkUri String *2 Webpage URL. Called when the label displayed after the video is tapped.
Max: 1000 characters
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.
video.externalLink.label String *2 Label. Displayed after the video is finished.
Max: 30 characters
actions Array of imagemap action objects Required Action when tapped
Max: 50

*1 This property is required if you set a video to play on the imagemap.
*2 This property is required if you set a video to play and a label to display after the video on the imagemap.

How to configure an image

You can use images with the following specifications for imagemap messages.

  • Image format: JPEG or PNG
  • Image width: 240px, 300px, 460px, 700px, 1040px
  • Size: Up to 1 MB

Make it possible to access images of 5 different sizes using the baseUrl/{image width} URL format. LINE will then download an image at the appropriate resolution based on the device.

For example, if we had a base URL of https://example.com/images/cats, the URL for the image with a width of 700px would be https://example.com/images/cats/700.

Note: Access https://example.com/images/cats/700 to confirm that the image is displayed.
Note: Do not include the extension in the image filename.

Imagemap action objects

Object which specifies the actions and tappable areas of an imagemap.

When an area is tapped, the user is redirected to the URI specified in uri and the message specified in message is sent.

Imagemap message example with two tappable areas

{
  "type": "imagemap",
  "baseUrl": "https://example.com/bot/images/rm001",
  "altText": "This is an imagemap",
  "baseSize": {
      "width": 1040,
      "height": 1040
  },
  "video": {
      "originalContentUrl": "https://example.com/video.mp4",
      "previewImageUrl": "https://example.com/video_preview.jpg",
      "area": {
          "x": 0,
          "y": 0,
          "width": 1040,
          "height": 585
      },
      "externalLink": {
          "linkUri": "https://example.com/see_more.html",
          "label": "See More"
      }
  },
  "actions": [
      {
          "type": "uri",
          "linkUri": "https://example.com/",
          "area": {
              "x": 0,
              "y": 586,
              "width": 520,
              "height": 454
          }
      },
      {
          "type": "message",
          "text": "Hello",
          "area": {
              "x": 520,
              "y": 586,
              "width": 520,
              "height": 454
          }
      }
  ]
}
Imagemap URI action object
Property Type Required Description
type String Required uri
label String Optional Label for the action. Spoken when the accessibility feature is enabled on the client device.
Max: 50 characters
Supported on LINE 8.2.0 and later for iOS.
linkUri String Required Webpage URL
Max: 1000 characters
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.
area Imagemap area object Required Defined tappable area

Example imagemap URI action object

{  
   "type":"uri",
   "label":"https://example.com/",
   "linkUri":"https://example.com/",
   "area":{  
      "x":0,
      "y":0,
      "width":520,
      "height":1040
   }
}
Imagemap message action object
Property Type Required Description
type String Required message
label String Optional Label for the action. Spoken when the accessibility feature is enabled on the client device.
Max: 50 characters
Supported on LINE 8.2.0 and later for iOS.
text String Required Message to send
Max: 400 characters
Supported on LINE for iOS and Android only.
area Imagemap area object Required Defined tappable area

Example imagemap message action object

{  
   "type":"message",
   "label":"hello",
   "text":"hello",
   "area":{  
      "x":520,
      "y":0,
      "width":520,
      "height":1040
   }
}
Imagemap area object

Defines the size of a tappable area. The top left is used as the origin of the area. Set these properties based on the baseSize.width property and the baseSize.height property.

Property Type Required Description
x Number Required Horizontal position relative to the left edge of the area. Value must be 0 or higher.
y Number Required Vertical position relative to the top of the area. Value must be 0 or higher.
width Number Required Width of the tappable area
height Number Required Height of the tappable area

Example imagemap area object

{
   "x":520,
   "y":0,
   "width":520,
   "height":1040
}

Template messages

Note: Template messages are only supported on LINE 6.7.0 and later for iOS and Android.

Template messages are messages with predefined layouts which you can customize. For more information, see template messages.

The following template types are available:

Common properties of template message objects

The following properties are common to all template message objects.

Property Type Required Description
type String Required template
altText String Required Alternative text.
Max: 400 characters
template Object Required A Buttons, Confirm, Carousel, or Image Carousel object.

Buttons template

Template with an image, title, text, and multiple action buttons.

Property Type Required Description
type String Required buttons
thumbnailImageUrl String Optional Image URL (Max: 1000 characters)
HTTPS
JPEG or PNG
Max width: 1024px
Max: 1 MB
imageAspectRatio String Optional Aspect ratio of the image. Specify one of the following values:
  • rectangle: 1.51:1
  • square: 1:1
The default value is rectangle.
imageSize String Optional Size of the image. Specify one of the following values:
  • cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed.
  • contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
The default value is cover.
imageBackgroundColor String Optional Background color of image. Specify a RGB color value. The default value is #FFFFFF (white).
title String Optional Title
Max: 40 characters
text String Required Message text
Max: 160 characters (no image or title)
Max: 60 characters (message with an image or title)
defaultAction Action object Optional Action when image is tapped; set for the entire image, title, and text area
actions Array of action objects Required Action when tapped
Max: 4

Buttons template message example

{
  "type": "template",
  "altText": "This is a buttons template",
  "template": {
      "type": "buttons",
      "thumbnailImageUrl": "https://example.com/bot/images/image.jpg",
      "imageAspectRatio": "rectangle",
      "imageSize": "cover",
      "imageBackgroundColor": "#FFFFFF",
      "title": "Menu",
      "text": "Please select",
      "defaultAction": {
          "type": "uri",
          "label": "View detail",
          "uri": "http://example.com/page/123"
      },
      "actions": [
          {
            "type": "postback",
            "label": "Buy",
            "data": "action=buy&itemid=123"
          },
          {
            "type": "postback",
            "label": "Add to cart",
            "data": "action=add&itemid=123"
          },
          {
            "type": "uri",
            "label": "View detail",
            "uri": "http://example.com/page/123"
          }
      ]
  }
}

Confirm template

Template with two action buttons.

Property Type Required Description
type String Required confirm
text String Required Message text
Max: 240 characters
actions Array of action objects Required Action when tapped
Set 2 actions for the 2 buttons

Confirm template message example

{
  "type": "template",
  "altText": "this is a confirm template",
  "template": {
      "type": "confirm",
      "text": "Are you sure?",
      "actions": [
          {
            "type": "message",
            "label": "Yes",
            "text": "yes"
          },
          {
            "type": "message",
            "label": "No",
            "text": "no"
          }
      ]
  }
}

Template with multiple columns which can be cycled like a carousel. The columns will be shown in order by scrolling horizontally.

Property Type Required Description
type String Required carousel
columns Array of column objects Required Array of columns
Max: 10
imageAspectRatio String Optional Aspect ratio of the image. Specify one of the following values:
  • rectangle: 1.51:1
  • square: 1:1
Applies to all columns. The default value is rectangle.
imageSize String Optional Size of the image. Specify one of the following values:
  • cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed.
  • contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
Applies to all columns. The default value is cover.
Property Type Required Description
thumbnailImageUrl String Optional Image URL (Max: 1000 characters)
HTTPS
JPEG or PNG
Aspect ratio: 1:1.51
Max width: 1024px
Max: 1 MB
imageBackgroundColor String Optional Background color of image. Specify a RGB color value. The default value is #FFFFFF (white).
title String Optional Title
Max: 40 characters
text String Required Message text
Max: 120 characters (no image or title)
Max: 60 characters (message with an image or title)
defaultAction Action object Optional Action when image is tapped; set for the entire image, title, and text area
actions Array of action objects Required Action when tapped
Max: 3

Carousel template message example

{
  "type": "template",
  "altText": "this is a carousel template",
  "template": {
      "type": "carousel",
      "columns": [
          {
            "thumbnailImageUrl": "https://example.com/bot/images/item1.jpg",
            "imageBackgroundColor": "#FFFFFF",
            "title": "this is menu",
            "text": "description",
            "defaultAction": {
                "type": "uri",
                "label": "View detail",
                "uri": "http://example.com/page/123"
            },
            "actions": [
                {
                    "type": "postback",
                    "label": "Buy",
                    "data": "action=buy&itemid=111"
                },
                {
                    "type": "postback",
                    "label": "Add to cart",
                    "data": "action=add&itemid=111"
                },
                {
                    "type": "uri",
                    "label": "View detail",
                    "uri": "http://example.com/page/111"
                }
            ]
          },
          {
            "thumbnailImageUrl": "https://example.com/bot/images/item2.jpg",
            "imageBackgroundColor": "#000000",
            "title": "this is menu",
            "text": "description",
            "defaultAction": {
                "type": "uri",
                "label": "View detail",
                "uri": "http://example.com/page/222"
            },
            "actions": [
                {
                    "type": "postback",
                    "label": "Buy",
                    "data": "action=buy&itemid=222"
                },
                {
                    "type": "postback",
                    "label": "Add to cart",
                    "data": "action=add&itemid=222"
                },
                {
                    "type": "uri",
                    "label": "View detail",
                    "uri": "http://example.com/page/222"
                }
            ]
          }
      ],
      "imageAspectRatio": "rectangle",
      "imageSize": "cover"
  }
}

Template with multiple images which can be cycled like a carousel. The images will be shown in order by scrolling horizontally.

Property Type Required Description
type String Required image_carousel
columns Array of column objects Required Array of columns
Max: 10
Property Type Required Description
imageUrl String Required Image URL (Max: 1000 characters)
HTTPS
JPEG or PNG
Aspect ratio: 1:1
Max width: 1024px
Max: 1 MB
action Action object Required Action when image is tapped

Image carousel template message example

{
  "type": "template",
  "altText": "this is a image carousel template",
  "template": {
      "type": "image_carousel",
      "columns": [
          {
            "imageUrl": "https://example.com/bot/images/item1.jpg",
            "action": {
              "type": "postback",
              "label": "Buy",
              "data": "action=buy&itemid=111"
            }
          },
          {
            "imageUrl": "https://example.com/bot/images/item2.jpg",
            "action": {
              "type": "message",
              "label": "Yes",
              "text": "yes"
            }
          },
          {
            "imageUrl": "https://example.com/bot/images/item3.jpg",
            "action": {
              "type": "uri",
              "label": "View detail",
              "uri": "http://example.com/page/222"
            }
          }
      ]
  }
}

Flex Message

Flex Messages are messages with a customizable layout. You can customize the layout freely by combining multiple elements. For more information, see Using Flex Messages.

Property Type Required Description
type String Required flex
altText String Required Alternative text
Max: 400 characters
contents Object Required Flex Message container object

Container

A container is the top-level structure of a Flex Message. Here are the types of containers available.

See Flex Message elements for the containers' JSON data samples and usage.

Flex Message example

{  
  "type": "flex",
  "altText": "this is a flex message",
  "contents": {
    "type": "bubble",
    "body": {
      "type": "box",
      "layout": "vertical",
      "contents": [
        {
          "type": "text",
          "text": "hello"
        },
        {
          "type": "text",
          "text": "world"
        }
      ]
    }
  }
}
Bubble container

This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer. For more information about using each block, see Block.

The maximum size of JSON data that defines a bubble container is 10 KB.

Property Type Required Description
type String Required bubble
direction String Optional Text directionality and the order of components in horizontal boxes in the container. Specify one of the following values:
  • ltr: Left to right
  • rtl: Right to left
The default value is ltr.
header Object Optional Header block. Specify a box component.
hero Object Optional Hero block. Specify an image component.
body Object Optional Body block. Specify a box component.
footer Object Optional Footer block. Specify a box component.
styles Object Optional Style of each block. Specify a bubble style object. For more information, see Objects for the block style.

Bubble container example

{
  "type": "bubble",
  "header": {
    "type": "box",
    "layout": "vertical",
    "contents": [
      {
        "type": "text",
        "text": "Header text"
      }
    ]
  },
  "hero": {
    "type": "image",
    "url": "https://example.com/flex/images/image.jpg"
  },
  "body": {
    "type": "box",
    "layout": "vertical",
    "contents": [
      {
        "type": "text",
        "text": "Body text"
      }
    ]
  },
  "footer": {
    "type": "box",
    "layout": "vertical",
    "contents": [
      {
        "type": "text",
        "text": "Footer text"
      }
    ]
  },
  "styles": {
    "comment": "See the example of a bubble style object"
  }
}
Objects for the block style

Use the following two objects to define the style of blocks in a bubble.

Bubble style

Property Type Required Description
header Block style object Optional Style of the header block
hero Block style object Optional Style of the hero block
body Block style object Optional Style of the body block
footer Block style object Optional Style of the footer block

Block style

Property Type Required Description
backgroundColor String Optional Background color of the block. Use a hexadecimal color code.
separator Boolean Optional true to place a separator above the block. true will be ignored for the first block in a container because you cannot place a separator above the first block. The default value is false.
separatorColor String Optional Color of the separator. Use a hexadecimal color code.

Example of a bubble style object with block style objects

  "styles": {
    "header": {
      "backgroundColor": "#00ffff"
    },
    "hero": {
      "separator": true,
      "separatorColor": "#000000"
    },
    "footer": {
      "backgroundColor": "#00ffff",
      "separator": true,
      "separatorColor": "#000000"
    }
  }

This is a container that contains multiple bubble containers, or message bubbles. The bubbles will be shown in order by scrolling horizontally.

The maximum size of JSON data that defines a carousel container is 50 KB.

Property Type Required Description
type String Required carousel
contents Array of bubble containers Required Max: 10 bubbles

If any of the bubbles in a carousel container has a body block, the body block extends so that the bubble has the same height as the highest bubble in the carousel container.

Component

Components are objects that compose a Flex Message container. Here are the types of components available:

See Flex Message elements and Flex Message layout for the components' JSON data samples and usage.

Carousel container example

{
  "type": "carousel",
  "contents": [
    {
      "type": "bubble",
      "body": {
        "type": "box",
        "layout": "vertical",
        "contents": [
          {
            "type": "text",
            "text": "First bubble"
          }
        ]
      }
    },
    {
      "type": "bubble",
      "body": {
        "type": "box",
        "layout": "vertical",
        "contents": [
          {
            "type": "text",
            "text": "Second bubble"
          }
        ]
      }
    }
  ]
}
Box component

This is a component that defines the layout of child components. You can also include a box in a box.

Property Type Required Description
type String Required box
layout String Required The placement style of components in this box. Specify one of the following values:
  • horizontal: Components are placed horizontally. The direction property of the bubble container specifies the order.
  • vertical: Components are placed vertically from top to bottom.
  • baseline: Components are placed in the same way as horizontal is specified except the baselines of the components are aligned.
For more information, see Types of box layouts.
contents Array of objects Required Components in this box. Here are the types of components available:
flex Number Optional The ratio of the width or height of this box within the parent box. The default value for the horizontal parent box is 1, and the default value for the vertical parent box is 0. For more information, see Width and height of components.
spacing String Optional Minimum space between components in this box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is none.
To override this setting for a specific component, set the margin property of that component.
margin String Optional Minimum space between this box and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this box is the first component in the parent box, the margin property will be ignored.
action Object Optional Action performed when this box is tapped. Specify an action object. This property is supported on the following versions of LINE.
  • LINE for iOS and Android: 8.11.0 and later
  • LINE for Windows and macOS: 5.9.0 and later

Box component example

{
  "type": "box",
  "layout": "vertical",
  "contents": [
    {
      "type": "image",
      "url": "https://example.com/flex/images/image.jpg"
    },
    {
      "type": "separator"
    },
    {
      "type": "text",
      "text": "Text in the box"
    }
  ]
}
Button component

This component draws a button. When the user taps a button, a specified action is performed.

Property Type Required Description
type String Required button
action Object Required Action performed when this button is tapped. Specify an action object.
flex Number Optional The ratio of the width or height of this component within the parent box. The default value for the horizontal parent box is 1, and the default value for the vertical parent box is 0. For more information, see Width and height of components.
margin String Optional Minimum space between this component and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this component is the first component in the parent box, the margin property will be ignored.
height String Optional Height of the button. You can specify sm or md. The default value is md.
style String Optional Style of the button. Specify one of the following values:
  • link: HTML link style
  • primary: Style for dark color buttons
  • secondary: Style for light color buttons
The default value is link.
color String Optional Character color when the style property is link. Background color when the style property is primary or secondary. Use a hexadecimal color code.
gravity String Optional Vertical alignment style. Specify one of the following values:
  • top: Top-aligned
  • bottom: Bottom-aligned
  • center: Center-aligned
The default value is top.
If the layout property of the parent box is baseline, the gravity property will be ignored.

Button component example

{
  "type": "button",
  "action": {
    "type": "uri",
    "label": "Tap me",
    "uri": "https://example.com"
  },
  "style": "primary",
  "color": "#0000ff"
}
Filler component

This is an invisible component to fill extra space between components.

Property Type Required Description
type String Required filler
  • The filler's flex property is fixed to 1.
  • The spacing property of the parent box will be ignored for fillers.

Filler component example

{
  "type": "filler"
}
Icon component

This component draws an icon.

Property Type Required Description
type String Required icon
url String Required Image URL
Protocol: HTTPS
Image format: JPEG or PNG
Maximum image size: 240×240 pixels
Maximum data size: 1 MB
margin String Optional Minimum space between this component and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this component is the first component in the parent box, the margin property will be ignored.
size String Optional Maximum size of the icon width. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md.
aspectRatio String Optional Aspect ratio of the icon. Specify in the {width}:{height} format. Specify the value of the {width} property and the {height} property in the range from 1 to 100000. However, you cannot set the {height} property to a value that is more than three times the value of the {width} property. The default value is 1:1.

The icon's flex property is fixed to 0.

Icon component example

{
  "type": "icon",
  "url": "https://example.com/icon/png/caution.png",
  "size": "lg",
  "aspectRatio": "1.91:1"
}
Image component

This component draws an image.

Property Type Required Description
type String Required image
url String Required Image URL
Protocol: HTTPS
Image format: JPEG or PNG
Maximum image size: 1024×1024 pixels
Maximum data size: 1 MB
flex Number Optional The ratio of the width or height of this component within the parent box. The default value for the horizontal parent box is 1, and the default value for the vertical parent box is 0. For more information, see Width and height of components.
margin String Optional Minimum space between this component and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this component is the first component in the parent box, the margin property will be ignored.
align String Optional Horizontal alignment style. Specify one of the following values:
  • start: Left-aligned
  • end: Right-aligned
  • center: Center-aligned
The default value is center.
gravity String Optional Vertical alignment style. Specify one of the following values:
  • top: Top-aligned
  • bottom: Bottom-aligned
  • center: Center-aligned
The default value is top.
If the layout property of the parent box is baseline, the gravity property will be ignored.
size String Optional Maximum size of the image width. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, 5xl, or full. The size increases in the order of listing. The default value is md.
aspectRatio String Optional Aspect ratio of the image. Specify in the {width}:{height} format. Specify the value of the {width} property and the {height} property in the range from 1 to 100000. However, you cannot set the {height} property to a value that is more than three times the value of the {width} property. The default value is 1:1.
aspectMode String Optional Style of the image. Specify one of the following values:
  • cover: The image fills the entire drawing area. Parts of the image that do not fit in the drawing area are not displayed.
  • fit: The entire image is displayed in the drawing area. The background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
  • The default value is fit.
backgroundColor String Optional Background color of the image. Use a hexadecimal color code.
action Object Optional Action performed when this image is tapped. Specify an action object.

Image component example

{
  "type": "image",
  "url": "https://example.com/flex/images/image.jpg",
  "size": "full",
  "aspectRatio": "1.91:1"
}
Separator component

This component draws a separator between components in the parent box.

Property Type Required Description
type String Required separator
margin String Optional Minimum space between this component and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this component is the first component in the parent box, the margin property will be ignored.
color String Optional Color of the separator. Use a hexadecimal color code.

Separator component example

{
  "type": "separator",
  "color": "#000000"
}
Spacer component

This is an invisible component that places a fixed-size space at the beginning or end of the box.

Property Type Required Description
type String Required spacer
size String Optional Size of the space. You can specify one of the following values: xs, sm, md, lg, xl, or xxl. The size increases in the order of listing. The default value is md.

The spacing property of the parent box will be ignored for spacers.

Spacer component example

{
  "type": "spacer",
  "size": "md"
}
Text component

This component draws text. You can format the text.

Property Type Required Description
type String Required text
text String Required Text
flex Number Optional The ratio of the width or height of this component within the parent box. The default value for the horizontal parent box is 1, and the default value for the vertical parent box is 0. For more information, see Width and height of components.
margin String Optional Minimum space between this component and the previous component in the parent box. You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl. none does not set a space while the other values set a space whose size increases in the order of listing. The default value is the value of the spacing property of the parent box.
If this component is the first component in the parent box, the margin property will be ignored.
size String Optional Font size. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md.
align String Optional Horizontal alignment style. Specify one of the following values:
  • start: Left-aligned
  • end: Right-aligned
  • center: Center-aligned
The default value is start.
gravity String Optional Vertical alignment style. Specify one of the following values:
  • top: Top-aligned
  • bottom: Bottom-aligned
  • center: Center-aligned
The default value is top.
If the layout property of the parent box is baseline, the gravity property will be ignored.
wrap Boolean Optional true to wrap text. The default value is false. If set to true, you can use a new line character (\n) to begin on a new line.
maxLines Number Optional Max number of lines. If the text does not fit in the specified number of lines, an ellipsis (…) is displayed at the end of the last line. If set to 0, all the text is displayed. The default value is 0. This property is supported on the following versions of LINE.
  • LINE for iOS and Android: 8.11.0 and later
  • LINE for Windows and macOS: 5.9.0 and later
weight String Optional Font weight. You can specify one of the following values: regular or bold. Specifying bold makes the font bold. The default value is regular.
color String Optional Font color. Use a hexadecimal color code.
action Object Optional Action performed when this text is tapped. Specify an action object.

Text component example

{
  "type": "text",
  "text": "Hello, World!",
  "size": "xl",
  "weight": "bold",
  "color": "#0000ff"
}

Action objects

These are types of actions for your bot to take when a user taps a button or an image in a message.

Postback action

When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property.

Property Type Required Description
type String Required postback
label String See description Label for the action
  • Required for templates other than image carousel. Max: 20 characters.
  • Optional for image carousel templates. Max: 12 characters.
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max: 20 characters. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max: 20 characters. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button component of Flex Message. This property can be specified for the box, image, and text components but its value is not displayed. Max: 20 characters.
data String Required String returned via webhook in the postback.data property of the postback event
Max: 300 characters
displayText String See description Text displayed in the chat as a message sent by the user when the action is performed. Required for quick reply buttons. Optional for the other message types.
Max: 300 characters
The displayText and text properties cannot both be used at the same time.
text String Optional 【Deprecated】 Text displayed in the chat as a message sent by the user when the action is performed. Returned from the server through a webhook. This property shouldn't be used with quick reply buttons.
Max: 300 characters
The displayText and text properties cannot both be used at the same time.

Example postback action object

{  
   "type":"postback",
   "label":"Buy",
   "data":"action=buy&itemid=111",
   "text":"Buy"
}

Message action

When a control associated with this action is tapped, the string in the text property is sent as a message from the user.

Property Type Required Description
type String Required message
label String See description Label for the action
  • Required for templates other than image carousel. Max: 20 characters.
  • Optional for image carousel templates. Max: 12 characters.
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max: 20 characters. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max: 20 characters. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button component of Flex Message. This property can be specified for the box, image, and text components but its value is not displayed. Max: 20 characters.
text String Required Text sent when the action is performed
Max: 300 characters

Example message action object

{  
   "type":"message",
   "label":"Yes",
   "text":"Yes"
}

URI action

When a control associated with this action is tapped, the URI specified in the uri property is opened.

Property Type Required Description
type String Required uri
label String See description Label for the action
  • Required for templates other than image carousel. Max: 20 characters.
  • Optional for image carousel templates. Max: 12 characters.
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max: 20 characters. Supported on LINE 8.2.0 and later for iOS.
  • Required for the button component of Flex Message. This property can be specified for the box, image, and text components but its value is not displayed. Max: 20 characters.
uri String Required URI opened when the action is performed (Max: 1000 characters)
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme.
altUri.desktop String Optional URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme. This property is supported on the following version of LINE.
  • LINE 5.12.0 or later for macOS and Windows
Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.

Example URI action object

{  
   "type":"uri",
   "label":"View details",
   "uri":"http://example.com/page/222",
   "altUri": {
      "desktop" : "http://example.com/pc/page/222"
   }
}

Datetime picker action

Note: The datetime picker action is only supported on versions equal to or later than LINE 7.9.0 for iOS and LINE 7.12.0 for Android.

When a control associated with this action is tapped, a postback event is returned via webhook with the date and time selected by the user from the date and time selection dialog. The datetime picker action does not support time zones.

Property Type Required Description
type String Required datetimepicker
label String See description Label for the action
  • Required for templates other than image carousel. Max: 20 characters.
  • Optional for image carousel templates. Max: 12 characters.
  • Optional for rich menus. Spoken when the accessibility feature is enabled on the client device. Max: 20 characters. Supported on LINE 8.2.0 and later for iOS.
  • Required for quick reply buttons. Max: 20 characters. Supported on LINE 8.11.0 and later for iOS and Android.
  • Required for the button component of Flex Message. This property can be specified for the box, image, and text components but its value is not displayed. Max: 20 characters.
data String Required String returned via webhook in the postback.data property of the postback event
Max: 300 characters
mode String Required Action mode
date: Pick date
time: Pick time
datetime: Pick date and time
initial String Optional Initial value of date or time
max String Optional Largest date or time value that can be selected. Must be greater than the min value.
min String Optional Smallest date or time value that can be selected. Must be less than the max value.

Date and time format

The date and time formats for the initial, max, and min values are shown below. The full-date, time-hour, and time-minute formats follow the RFC3339 protocol.

Mode Format Example
date full-date
Max: 2100-12-31
Min: 1900-01-01
2017-06-18
time time-hour:time-minute
Max: 23:59
Min: 00:00
00:00
06:15
23:59
datetime full-dateTtime-hour:time-minute or full-datettime-hour:time-minute
Max: 2100-12-31T23:59
Min: 1900-01-01T00:00
2017-06-18T06:15
2017-06-18t06:15

Example datetime picker action object

{  
   "type":"datetimepicker",
   "label":"Select date",
   "data":"storeId=12345",
   "mode":"datetime",
   "initial":"2017-12-25t00:00",
   "max":"2018-01-24t23:59",
   "min":"2017-12-25t00:00"
}

Camera action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera screen in LINE is opened.

Property Type Required Description
type String Required camera
label String Required Label for the action
Max: 20 characters

Example camera action object

{  
   "type":"camera",
   "label":"Camera"
}

Camera roll action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera roll screen in LINE is opened.

Property Type Required Description
type String Required cameraRoll
label String Required Label for the action
Max: 20 characters

Example camera roll action object

{  
   "type":"cameraRoll",
   "label":"Camera roll"
}

Location action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the location screen in LINE is opened.

Property Type Required Description
type String Required location
label String Required Label for the action
Max: 20 characters

Example location action object

{  
   "type":"location",
   "label":"Location"
}

Rich menu structure

Rich menus consist of either of these objects.

Area objects and action objects are included in these objects.

Rich menu object

Property Type Required Description
size Object Required size object which contains the width and height of the rich menu displayed in the chat. Rich menu images must be one of the following sizes (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270
selected Boolean Required true to display the rich menu by default. Otherwise, false.
name String Required Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users.
Max: 300 characters
chatBarText String Required Text displayed in the chat bar
Max: 14 characters
areas Array Required Array of area objects which define the coordinates and size of tappable areas
Max: 20 area objects

Example rich menu object

{
  "size": {
    "width": 2500,
    "height": 1686
  },
  "selected": false,
  "name": "Nice richmenu",
  "chatBarText": "Tap to open",
  "areas": [
    {
      "bounds": {
        "x": 0,
        "y": 0,
        "width": 2500,
        "height": 1686
      },
      "action": {
        "type": "postback",
        "data": "action=buy&itemid=123"
      }
    }
  ]
}

Rich menu response object

Property Type Description
richMenuId  String Rich menu ID
size Object size object which contains the width and height of the rich menu displayed in the chat. Rich menu images must be one of the following sizes (pixels): 2500x1686, 2500x843, 1200x810, 1200x405, 800x540, 800x270
selected Boolean true to display the rich menu by default. Otherwise, false.
name String Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users.
Max: 300 characters
chatBarText String Text displayed in the chat bar
Max: 14 characters
areas Array Array of area objects which define the coordinates and size of tappable areas
Max: 20 area objects

Example rich menu response object

{
  "richMenuId": "{richMenuId}",
  "size": {
    "width": 2500,
    "height": 1686
  },
  "selected": false,
  "name": "Nice richmenu",
  "chatBarText": "Tap to open",
  "areas": [
    {
      "bounds": {
        "x": 0,
        "y": 0,
        "width": 2500,
        "height": 1686
      },
      "action": {
        "type": "postback",
        "label":"Buy",
        "data": "action=buy&itemid=123"
      }
    }
  ]
}

size object

Property Type Required Description
width Number Required Width of the rich menu. Must be 2500.
height Number Required Height of the rich menu. Possible values: 1686, 843.

Example size object

{
   "width":520,
   "height":1040
}

Area object

Property Type Required Description
bounds Object Required Object describing the boundaries of the area in pixels. See bounds object.
action Object Required Action performed when the area is tapped. See action objects.

Example area object

{
  "bounds": {
    "x": 0,
    "y": 0,
    "width": 2500,
    "height": 1686
  },
  "action": {
    "type": "postback",
    "label":"Buy",
    "data": "action=buy&itemid=123"
  }
}
bounds object
Property Type Required Description
x Number Required Horizontal position relative to the left edge of the area. Value must be 0 or higher.
y Number Required Vertical position relative to the top of the area. Value must be 0 or higher.
width Number Required Width of the area.
height Number Required Height of the area.

Example bounds object

{
   "x":0,
   "y":0,
   "width":2500,
   "height":1686
}

{{ $t("form.question.helpful") }}

{{ $t("form.question.detail") }}

{{ $t("form.question.improve") }}

{{ $t("form.info.start") }}{{ $t("form.info.link") }}{{ $t("form.info.end") }}


{{ $t("form.result.success") }}
{{ $t("form.result.error") }}
{{ $t("form.result.errorLink") }}