Line Messaging API
Overview
The Line Messaging API enables businesses to send secure, real-time messages via the LINE Official Account (OA) API. This API allows businesses to manage and automate messaging for improved customer engagement. Designed for transactional messaging, this API ensures timely notifications and seamless interactions between businesses and their customers on the LINE platform.
Use Case Examples
The Line Messaging API is ideal for sending critical notifications and updates, including:
- Order Notifications – Inform customers about order statuses (e.g., "Your order #12345 has been shipped.") 
- Payment Confirmations – Notify users when payments are received (e.g., "Payment of $50 was successfully received.") 
- Appointment Reminders – Send reminders for upcoming bookings (e.g., "Reminder: Your appointment is scheduled for tomorrow at 10 AM.") 
- Account Alerts – Enhance security with login alerts or password reset confirmations (e.g., "Suspicious login detected on your account.") 
- Delivery Updates – Keep customers informed about their package delivery status. 
Prerequisites
Before using this API, ensure the following:
- Admin Access – The user must have admin privileges in the klink.cloud platform. 
- Access Token – An access token must be generated in the Settings > Developer section of the klink.cloud dashboard. 
- Connected LINE Official Account – Your LINE Official Account must be connected to the klink.cloud platform. Check Settings > Message Integration to ensure the LINE OA channel is properly linked. 
- Retrieve Channel ID – You must retrieve the correct - channelIdfor the LINE channel using the Channel Listing API.
Retrieving Channel ID
Before sending messages, you need to find the correct channelId by querying the Channel Listing API.
List Channels
Endpoint:
GET /api/v1/channelsThis endpoint allows you to retrieve a paginated list of all available channels.
Optional Parameters
Name
Type
Description
keyword
string
Search channels by keyword. Supports partial matching.
Request Example
curl -G https://api.klink.cloud/api/v1/channels \
  -H "Authorization: Bearer {token}" \
  -d keyword={your_keyword_here}
import ApiClient from '@example/protocol-api'
const client = new ApiClient(token)
await client.channels.list()
from protocol_api import ApiClient
client = ApiClient(token)
client.channels.list()
$client = new \Protocol\ApiClient($token);
$client->channels->list();
{
  "requestId": "557520e4-7197-4d56-8a24-ee8c2782d6e4",
  "page": 1,
  "pageSize": 10,
  "lastPage": 8,
  "total": 73
    "data":[
      {
      "id": "f6154dda-bd9a-4d03-8a77-ff3421070009",
      "createdAt": "2025-03-02T16:42:53.796Z",
      "updatedAt": "2025-03-02T16:42:54.078Z",
      "deletedAt": null,
      "name": "K-Link BSS UAT DEMO KURO",
      "type": "line",
      "brandName": "K-Link BSS UAT DEMO KURO"
    },
    {
      "id": ...............
    }
  ]
}
Messaging Endpoints
Send Message
Endpoint:
POST /api/v1/message/sendThis endpoint allows you to send a transactional message to a contact on the Line channel using the secure LINE Official Account (OA) API.
Required Parameters
channelId
string
The unique identifier of channel. Retrieve it using the Channel Listing API.
message
string
The message content to be sent.
One of the Following is Required:
contactId
string
The unique identifier of a contact in klink.cloud's platform. Required if platformUserId is not provided.
platformUserId
string
The unique user identifier (UID) of the customer’s Line account. Required if contactId is not provided.
Request Examples
Endpoint
POST /api/v1/message/send
Authentication
Include the Authorization header with a Bearer token:
Authorization: Bearer {token}Request Format
curl -G https://api.klink.cloud/api/v1/message/send \
  -H "Authorization: Bearer {token}" \
  -d channelId="..." \
  -d message="Hello" \
  -d contactId="..."import ApiClient from '@example/protocol-api'
const client = new ApiClient(token);
await client.line.create({
  channelId: '...',
  message: 'Hello',
  contactId: '...',
});from protocol_api import ApiClient
client = ApiClient(token)
client.line.create(
    channelId='...',
    message='Hello',
    contactId='...',
)$client = new \Protocol\ApiClient($token);
$client->line->create([
    'channelId' => '...',
    'message' => 'Hello',
    'contactId' => '...',
]);Response
{
  "status": "success",
  "channel": "Line",
  "message": "Successfully sent message to platform user Id ...",
  "requestId": "..."
}Notes
- Ensure that the - Authorizationtoken is valid.
- Either - contactIdor- platformUserIdmust be provided.
- contactIdrefers to the unique contact ID stored within klink.cloud’s platform.
- platformUserIdis the unique user identifier (UID) of the customer’s Line account.
- The - channelIdmust be retrieved using the Channel Listing API
- This API is designed for sending transactional messages via the secure LINE Official Account API. 
For more details, visit klink.cloud API Documentation.
Last updated
