# 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).

# What is LINE notification messages API?

With the LINE notification messages API, you can send LINE notification messages to users with specified phone numbers and get the number of sent messages.

For more information, see the LINE notification messages API in the Option API reference for corporate customers.

# Messages that can be sent via the LINE notification messages API

You can send all Message types with the LINE notification messages API. However, the content of the messages sent must follow the contents of the LINE notification messages UX guidelines (opens new window) (Only available in Japanese).

Messages are reviewed

LINE notification messages sent using the LINE notification messages API are reviewed using a predetermined screening process. Only messages that pass the review can be sent.

# 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 in these ways:

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 in the Option API reference for corporate customers.

# Use the LINE Developers Console

Log in to the LINE Developers Console and select "Outgoing messages using phone numbers (PnP)" under the "Statistics" tab.

Statistics in the LINE Developers Console

# Use the API

# 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.

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.