# 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 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.
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.
Example request
# 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 tokens in the Messaging API documentation.
You may not use a channel access token for which you can designate an arbitrary expiration date (Channel Access Token v2.1).
# Request body
liffAccessToken
String
User access token obtained with liff.getAccessToken()
.
# 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
remainingCount
Number
The number of times you can send a service message with the issued service notification token
Example response
# 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:
|
403 Forbidden | This channel is not authorized to send service messages. |
500 Internal Server Error | Error on the internal server |
Example error response
# 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.
Example request
# 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 tokens in the Messaging API documentation.
You may not use a channel access token for which you can designate an arbitrary expiration date (Channel Access Token v2.1).
# 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.
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.
- If
notifiationToken
,expiresIn
andremainingCount
are set to an empty string and0
, it means that the service message was sent, but the service notification token could not be renewed. - An empty JSON object (
{ }
) is returned to indicate that you made multiple requests with the same content.
Example response
# 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 | Valid channel access token is not specified |
403 Forbidden | This channel is not authorized to send service messages. |
404 Not found | Could not find the specified template. |
500 Internal Server Error | Error on the internal server |
Example error response