# 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](https://www.lycbiz.com/jp/partner/sales/). ## 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. - LINE notification messages (template) - [Send a LINE notification message (template)](https://developers.line.biz/en/reference/line-notification-messages/#send-line-notification-message-template) - [Get number of sent LINE notification messages (template)](https://developers.line.biz/en/reference/line-notification-messages/#get-number-of-sent-line-notification-messages-template) - LINE notification messages (flexible) - [Send a LINE notification message (flexible)](https://developers.line.biz/en/reference/line-notification-messages/#send-line-notification-message-flexible) - [Get number of sent LINE notification messages (flexible)](https://developers.line.biz/en/reference/line-notification-messages/#get-number-of-sent-line-notification-messages-flexible) For more information, see the [LINE notification messages API reference](https://developers.line.biz/en/reference/line-notification-messages/). ### 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](https://www.lycbiz.com/sites/default/files/media/jp/download/LINE_Official_Notification_Template_UXGuideline.pdf) (only available in Japanese).  With LINE notification messages (flexible), you can use [Flex Message](https://developers.line.biz/en/docs/messaging-api/message-types/#flex-messages) and other similar message types for more flexible message creation. However, messages containing images, videos, or audio aren't permitted. Additionally, 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](https://www.lycbiz.com/sites/default/files/media/jp/download/LINE%E9%80%9A%E7%9F%A5%E3%83%A1%E3%83%83%E3%82%BB%E3%83%BC%E3%82%B8UX%E3%82%AC%E3%82%A4%E3%83%89%E3%83%A9%E3%82%A4%E3%83%B3.pdf) (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](https://developers.line.biz/en/glossary/#e164) format, such as `+818000001234` hashed with SHA256. Don't include hyphens. Here is an example of hashing a phone number using Python3. ```python 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](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/message-sending-complete-webhook-event/#receive-delivery-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](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/message-sending-complete-webhook-event/#receive-delivery-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](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/message-sending-complete-webhook-event/) for more information. ### Get the number of sent LINE notification messages You can get the number of sent LINE notification messages using the following APIs: - [Get number of sent LINE notification messages (template)](https://developers.line.biz/en/reference/line-notification-messages/#get-number-of-sent-line-notification-messages-template) - [Get number of sent LINE notification messages (flexible)](https://developers.line.biz/en/reference/line-notification-messages/#get-number-of-sent-line-notification-messages-flexible) **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](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#conditions-for-sending-line-notification-messages). ## 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: - The phone number you specify as the destination of a LINE notification message matches the phone number registered in the user's LINE account. - The phone number registered in the user's LINE account is valid (the user has authenticated the phone number by SMS within a certain period of time). - User agrees to receive LINE notification messages. - User hasn't blocked your LINE Official Account. - The phone number is issued in Japan, Thailand, and Taiwan, and [the phone number can be used to authenticate by phone number in the LINE app](https://help.line.me/line/smartphone/pc?lang=en&contentId=20000104). - User agrees to [LINE's Privacy Policy (revised March 2022)](https://guide.line.me/privacy-policy_update/2022/0001/?lang=en-jp). For more information on setting up LINE notification messages in the LINE app, see [How to receive LINE notification messages](https://guide.line.me/ja/services/notification-message.html) (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](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#about-recive-the-new-line-notification-message) - [How to consent to get LINE notification messages](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#how-to-consent-for-line-notification-messages) - [Messages sent when you haven't consented to get LINE notification messages](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#user-has-not-given-consent-when-receive-line-notification-messages) - [About LINE notification messages API requests for users who have blocked the LINE Official Account](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#about-pnp-api-block-response) - [When the LINE notification messages API request is successful but the message isn't sent](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#why-i-cant-receive-line-notification-messages) - [About adding and blocking friends when sending LINE notification messages to users who aren't friends with the LINE Official Account](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#when-user-add-or-block-oa) - [Rich menu display when sending LINE notification messages to users who aren't friends with the LINE Official Account](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#about-richmenu-displayed) - [For what will be billed for usage fees in the LINE notification messages API](https://developers.line.biz/en/docs/partner-docs/line-notification-messages/technical-specs/#about-delivered-pnp-messages) ### 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.  **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. ### How to consent to get LINE notification messages 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**.  **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.