# LINE MINI App API reference
# Service Messages
The Service Message API enables you to send service messages from your service to your LINE MINI App users.
Sending service messages requires a service notification token and a template.
# Issuing a service notification token
Issues a service notification token. Service notification tokens are used to send a service message to the associated user.
Service notification tokens have the following features:
- A service notification token expires 1 year (31,536,000 seconds) after being issued. While it is still valid, up to 5 service messages can be sent.
- Every time you use the service notification token, the token value is renewed unless it expired or no longer has remaining message counts. If you are planning to send successive service messages to a user, keep the renewed service notification token.
Issuing multiple service notification tokens reusing an access token obtained by liff.getAccessToken()
(LIFF access token) is not allowed.
Only one service notification token can be issued per LIFF access token.
Each service notification token is associated with one user. You cannot use a service notification token associated with one user to send a service message to other users.
# HTTP request
POST https://api.line.me/message/v3/notifier/token
# Request headers
Content-Type
application/json
Authorization
Bearer {channel access token}
For more information, see Channel access token in the LINE Platform basics.
Long-lived channel access tokens and channel access token with a user-specified expiration (Channel Access Token v2.1) cannot be used for LINE MINI App channels.
When developing LINE MINI Apps, either stateless channel access tokens or short-lived channel access tokens can be used. Stateless channel access tokens are recommended among those two. Stateless channel access tokens have an unlimited number of issuances, so there is no need for the application to manage the token lifecycle.
# Request body
liffAccessToken
String
User access token obtained by liff.getAccessToken()
(LIFF access token).
# Response
Returns status code 200
and a JSON object with the following information.
notificationToken
String
Service notification token
expiresIn
Number
The amount of time remaining in seconds before the service notification token expires. A service notification token expires 1 year (31,536,000 seconds) after being issued.
remainingCount
Number
The number of times you can send a service message with the issued service notification token
sessionId
String
The session ID. For more information, see Sending service messages.
# Error response
Returns one of the following status codes and error messages.
Status code | Description |
---|---|
400 Bad request | This status code means one of the following:
|
401 Unauthorized | This status code means one or both of the following:
|
403 Forbidden | This channel isn't authorized to issue service messages. |
500 Internal Server Error | Error on the internal server |
# Sending service messages
Sends a service message to a user specified in the service notification token.
Once a service message is sent, the token's value is renewed unless the token expired or no longer has remaining message counts. If you are planning to send successive service messages to a user, keep the renewed service notification token.
# HTTP request
POST https://api.line.me/message/v3/notifier/send
# Request headers
Content-Type
application/json
Authorization
Bearer {channel access token}
For more information, see Channel access token in the LINE Platform basics.
Long-lived channel access tokens and channel access token with a user-specified expiration (Channel Access Token v2.1) cannot be used for LINE MINI App channels.
When developing LINE MINI Apps, either stateless channel access tokens or short-lived channel access tokens can be used. Stateless channel access tokens are recommended among those two. Stateless channel access tokens have an unlimited number of issuances, so there is no need for the application to manage the token lifecycle.
# Query parameters
target
service
# Request body
templateName
String
The name of a pre-registered template to use for the service message, with a BCP 47 language tag suffix.
- Format:
{template name}_{BCP 47 language tag}
- Maximum length: 30 characters
The languages and language tags supported by the service message are as follows.
- Arabic:
ar
- Chinese (Simplified):
zh-CN
- Chinese (Traditional):
zh-TW
- English:
en
- French:
fr
- German:
de
- Indonesian:
id
- Italian:
it
- Japanese:
ja
- Korean:
ko
- Malay:
ms
- Portuguese (Brazil):
pt-BR
- Portuguese (Portugal):
pt-PT
- Russian:
ru
- Spanish (Spain):
es-ES
- Thai:
th
- Turkish:
tr
- Vietnamese:
vi
params
object
JSON Object to specify each template variable-value pair.
If the template has no template variable, specify an empty JSON object ({ }
).
The template variables are defined for each template. If a template variable is part of the required elements, be sure to specify a template variable-value pair.
For more information, see Adding service message templates.
notificationToken
String
Service notification token
# Response
Returns status code 200
and a JSON object with the following information.
notificationToken
String
A renewed service notification token. Use this service notification token to send successive service messages.
expiresIn
Number
The remaning amount of time in seconds until renewed service notification token expires
remainingCount
Number
The number of times you can send successive service messages with the renewed service notification token.
sessionId
String
The session ID. For more information, see Sending service messages.
If the values of expiresIn
and remainingCount
are 0
, it means that the service message was sent, but the service notification token couldn't be renewed.
# Error response
Returns one of the following status codes and error messages.
Status code | Description |
---|---|
400 Bad request | This status code means one of the following:
|
401 Unauthorized | This status code means one or both of the following:
|
403 Forbidden | This status code means one of the following:
|