- Using quick replies
- Using rich menus
- Using Flex Messages
- Using the LINE URL scheme
- Using beacons
- Sharing your bot with users
- Linking user accounts
This topic explains the LINE Beacon specification for enterprise users who wish to deploy beacon devices to use the LINE Beacon feature. To use the LINE Beacon feature, you need to prepare beacon devices compliant with this specification.
Requirements for devices compliant with the LINE Beacon specification
A beacon device compliant with the LINE Beacon specification supports Bluetooth® Low Energy Version 4.0 and Apple's iBeacon and can advertise LINE Beacon packets. Specifically, the device must meet the following requirements:
LINE Beacon packet
You need to control beacon devices according to the broadcaster role (BLUETOOTH SPECIFICATION Version 4.0 [Vol 3], Part C Section 188.8.131.52) specified in the generic access profile so that LINE can detect the beacon devices quickly.
Format of the advertising data
The advertising data of a LINE Beacon packet consists of three AD structures.
The format and values to specify are as follows.
|00||Length||0x02||The data length of the first AD structure (2 bytes)|
|01||AD type||0x01||This value indicates that AD type is Flags.|
|02||AD data||0x06||This value indicates that the flags are LE General Discoverable Mode and BR/EDR Not Supported.|
|03||Length||0x03||The data length of the second AD structure (3 bytes)|
|04||AD type||0x03||This value indicates that AD type is Complete list of 16-bit UUIDs available.|
|05||16-bit UUID||0x6F||Together with the next byte, this value indicates the 16-bit UUID of LINE (0xFE6F).|
|06||16-bit UUID||0xFE||Together with the previous byte, this value indicates the 16-bit UUID of LINE (0xFE6F).|
|07||Length||0x11||The data length of the third AD structure (17 bytes)|
|08||AD type||0x16||This value indicates that AD type is Service Data - 16-bit UUID.|
|09||16-bit UUID||0x6F||Together with the next byte, this value indicates the 16-bit UUID of LINE (0xFE6F).|
|10||16-bit UUID||0xFE||Together with the previous byte, this value indicates the 16-bit UUID of LINE (0xFE6F).|
|11||Frame type||0x02||This value indicates that the frame type is LINE Beacon.|
|12-16||HWID||Device-specific value||5-byte unique ID of the beacon device. For more information, see HWID.|
|17||Measured TxPower||Device-specific value||RSSI (Received Signal Strength Indicator) when the distance between the device with LINE installed and the beacon device is 1 meter. Set the same value as for the iBeacon packet. For more information, see the iBeacon documentation.
Set this field to 0x7F if you don't use RSSI data.
|18-21||Message authentication code||Variable||4-byte code for message authentication. For more information, see Generating a secure message.|
|22-23||Masked timestamp||Variable||2-byte masked timestamp. For more information, see Generating a secure message.|
|24||Battery level||Variable||Remaining battery capacity. For more information, see Battery level.|
|25-31||Non-significant part||0x00||Unused part. Set each byte to 0x00.|
Packet transmission interval
We strongly recommend sending LINE Beacon packets at 152.5-ms intervals.
The secure message is 7-byte data that consists of the message authentication code, masked timestamp, and battery level. It is used to prevent packet tampering and replay attacks. Secure messages transmitted from beacon devices are sent to the LINE Platform via LINE and then verified.
This section explains how to generate a secure message.
Generating a secure message
A secure message is generated by performing the XOR (exclusive OR) operation three times on a hash value computed with SHA-256. The following figure shows the generation flow of the secure message. For the required parameters, see Required parameters.
Generate a secure message by following the steps below.
1. Generate a message authentication code
Concatenate the following items in the order listed and generate a 32-byte hash value with SHA-256.
Perform the XOR operation on the first 16 bytes and the second 16 bytes of the hash value.
Perform the XOR operation on the first 8 bytes and second 8 bytes of the value computed in the previous step.
Perform the XOR operation on the first 4 bytes and second 4 bytes of the value computed in the previous step.
Now you have generated a message authentication code.
2. Generate a masked timestamp
Mask 6 bytes from the beginning of the timestamp and leave the last 2 bytes. This is a masked timestamp.
3. Concatenate items
Concatenate the following items in the order listed:
- Message authentication code generated in step 1
- Masked timestamp generated in step 2
- Battery level
Now you have generated a secure message.
See Sample code and data for generating secure messages. This topic helps you develop and test a function to embed in beacon devices to generate secure messages.
The following parameters are used to generate a secure message.
LINE Corporation generates and manages the HWID, lot key, and vendor key. For details about how to obtain them, contact your LINE representative.
Services using the lot key and vendor key are available only to enterprise users.
This is remaining battery capacity. Use this parameter to determine when to replace the battery. The following table shows the meaning of each value.
|Decimal value||Hexadecimal value||Description|
|0||0x00||Unknown or connected to an external power supply.|
|1||0x01||0% available. The battery is fully discharged.|
|11||0x0B||100% available. The battery is fully charged.|
|(12-255)||0x0C-0xFF||Reserved for future use. Do not use.|
An HWID is the identifier of a beacon device. HWIDs issued by LINE Corporation are a 10-character strings. Convert it to a byte array and write it to the beacon device as 5-byte binary data.
Print the HWID on the body of the beacon device.
A lot key is assigned to each lot. Lot keys issued by LINE Corporation are 16-character strings. Convert it to a byte array and write it to the beacon device as 8-byte binary data in the same way as the HWID.
A timestamp is an unsigned 64-bit integer.
- Start incrementing when the beacon device is turned on for the first time.
- Start the timestamp with zero and increment every 15 seconds. Four is the timestamp one minute after power-on.
- Do not reset the timestamp to zero when the beacon device is turned on again. Continue to increment the timestamp value at power-off.
A vendor key is assigned to each vendor. Vendor keys issued by LINE Corporation are 8-character strings. Convert it to a byte array and write it to the beacon device as 4-byte binary data in the same way as the HWID.
We recommend sending iBeacon packets to notify iOS devices that the LINE Beacon device is nearby.
For the AD structure and transmission interval of the iBeacon packet, refer to Apple's Proximity Beacon Specification document. You can download this document from the iBeacon section of the Apple Developer site.
The following table shows the parameters specific to the LINE Beacon specification that you need to include in the iBeacon packet.