# Technical specifications of the LINE notification messages API

Use of optional functions requires an application

Only corporate users who have submitted the required applications can use the functions described in this document. To use these functions with your LINE Official Account, contact your sales representative or contact our Sales partners (opens new window).

# Send LINE notification messages to users

Based on the customer's phone number held by the company, a message request is sent to the LINE Platform server, and a LINE notification message is sent to the account of the user whose phone number is registered to LINE. Phone numbers sent by companies are hashed, and LY Corporation uses the received information only for matching the destination of message transmission, and immediately destroys it after matching. It may also be necessary to verify your identity by SMS to confirm the content of notifications including personal information, and to continue the procedure.

There are two types of LINE notification messages: LINE notification messages (template) and LINE notification messages (flexible). Each type has different API endpoints.

For more information, see the LINE notification messages API reference.

# Message types that can be sent in LINE notification messages

With LINE notification messages (template), you can easily create messages by combining premade templates, items, and buttons. When creating messages, follow the LINE notification messages (template) UX guidelines (opens new window) (only available in Japanese).

Sample of a LINE notification message (template)

With LINE notification messages (flexible), you can send all message types for more flexible message creation. However, LINE notification messages (flexible) require prior UX review, and only messages that pass the review can be sent. When creating messages, follow the LINE notification messages (flexible) UX guidelines (opens new window) (only available in Japanese).

# Phone number hashing

When specifying the destination to in the LINE notification messages API, specify a string that is a phone number normalized to E.164 format, such as +818000001234 hashed with SHA256. Don't include hyphens. Here is an example of hashing a phone number using Python3.

import hashlib

phone_number = "+818000001234"
hashed_phone_number = hashlib.sha256(phone_number.encode()).hexdigest()
print(hashed_phone_number)

# d41e0ad70dddfeb68f149ad6fc61574b9c5780ab7bcb2fba5517771ffbb2409c

# Get message delivery notifications

When you request the LINE notification messages API and send a LINE notification message to the user, a dedicated webhook event (delivery completion event) will be sent from the LINE Platform.

If you specify any string in the X-Line-Delivery-Tag of the request header when making a request, that string will be returned in the delivery.data property of the webhook's delivery completion event. X-Line-Delivery-Tag can be used for purposes such as determining which message has been delivered when a webhook is received.

See Webhook delivery completion event for more information.

# Get the number of sent LINE notification messages

You can get the number of sent LINE notification messages using either of the following methods:

Note

Only the number of LINE notification messages actually sent to the user is counted in the number of messages sent. For more information on sending conditions, see Conditions for sending LINE notification messages.

# Use the LINE Developers Console

Log in to the LINE Developers Console and select Phone number Push under the Statistics tab. The number of messages you sent will be displayed in the "LINE Notification messages (template)" column and the "LINE Notification messages (old spec)" (flexible) column.

Statistics in the LINE Developers Console

# Use the API

You can get the number of sent LINE notification messages using the following API:

# Conditions for sending LINE notification messages

The LINE Notification Message API sends a message to the user if all of the following conditions are met:

For more information on setting up LINE notification messages in the LINE app, see How to receive LINE notification messages (opens new window) (only available in Japanese) in the LINE user's guide.

# Additional information about LINE notification messages and API

# About the "LINE notification message received" message

When sending a LINE notification message, the following message will be sent from the LINE Official Account (system account) named "LINE". This message is always sent each time a LINE notification message is sent. The sender of a LINE notification message can't prevent this message from being sent or reduce the number of times it's sent.

Message received notification

Behavior when blocking

If the user designated by the LINE notification messages API as the receiver of a notification message has blocked the LINE Official Account from which the message was sent, the notification message and the "LINE notification message received" message from the "LINE" system account won't be sent.

Additionally, LINE notification messages sent while the user had blocked the LINE Official Account won't be delivered even after the user unblock it.

In addition to when you actually get LINE notification messages, you can also consent (or refuse) to get LINE notification messages from the LINE app by going to Settings > Privacy > Provide usage data > LINE notification messages.

Agree to receive LINE notification messages

Settings for getting LINE notification messages

There are three states for setting up the receipt of LINE notification messages.

State Description
Agree (on) Get LINE notification messages.
Reject (off) Refuse to get LINE notification messages. Line notification messages won't be sent.
Not set Neither consent or refuse. When getting a LINE notification message, a message will be sent asking for consent to get LINE Notification messages.
  • If you created a new LINE account in the LINE app version 8.0.0 or earlier, your consent to get LINE notification messages will be "not set".
  • If you change the status to anything other than "not set" even once, you can't return to the "not set" state.
State Description
Reject (off) The requested LINE notification message won't be sent and will be deleted.
Not set If you agree to get LINE notification messages within 24 hours after receiving the setting to get LINE notification messages, the message will be sent. If you don't give your consent to get LINE notification messages within 24 hours, the requested message won't be sent and will be deleted.

# About LINE notification messages API requests for users who have blocked the LINE Official Account

If a request is made to send a LINE notification message via the LINE notification messages API to a user who has blocked the LINE Official Account, a response with the HTTP status code 200 will be returned. However, in this case, the LINE notification message isn't actually sent, and the Webhook delivery completion event isn't sent.

# When the LINE notification messages API request is successful but the message isn't sent

If you have successfully requested a LINE notification messages API (received HTTP status code 200) to a user who didn't block the LINE Official Account, but the LINE notification message isn't actually sent to the user, these reasons may be why:

  • The user associated with the phone number specified when requesting the LINE notification messages API has not set the setting to get LINE notification messages, and when the setting for getting LINE notification messages was received, it was changed to "reject".
  • The user associated with the phone number specified when requesting the LINE notification messages API has not set the setting to get LINE notification messages, and when the setting for getting LINE notification messages was received, it was left unconfigured.
  • SMS authentication is required for the user associated with the phone number specified when requesting the LINE notification messages API, but the user didn't perform SMS authentication when the phone number authentication message was received.

# About adding and blocking friends when sending LINE notification messages to users who aren't friends with the LINE Official Account

If a user who isn't friends with the LINE Official Account of the sender of the LINE notification message gets a LINE notification message, they can choose whether or not to add the LINE official account as a friend. A follow event is sent when you add a friend. An unfollow event is sent if you block. When using LINE notification messages, unfollow events may be sent from users who have never received follow events.

# Rich menu display when sending LINE notification messages to users who aren't friends with the LINE Official Account

Even if you aren't friends with the LINE Official Account, the default rich menu set with the Messaging API or in the LINE Official Account Manager will still be displayed and available. However, the per-user rich menu set with the Messaging API for users who aren't friends won't be displayed and isn't available.

# For what will be billed for usage fees in the LINE notification messages API

For LINE notification messages, only messages actually sent to the user will be billed for usage fees.

You can check the number of messages actually sent to the user by using the LINE Developers Console or by using the API.