Appearance
@line/bot-sdk / insight / InsightClient
Class: InsightClient
Defined in: lib/insight/api/insightClient.ts:57
See
LineBotClient for a unified interface that wraps this client.
Constructors
Constructor
new InsightClient(
config):InsightClient
Defined in: lib/insight/api/insightClient.ts:73
Initializes a new InsightClient.
Parameters
config
httpClientConfig
Configuration for this API client.
Returns
InsightClient
Example
ts
const client = new InsightClient({
channelAccessToken: process.env.LINE_CHANNEL_ACCESS_TOKEN!,
});Methods
getFriendsDemographics()
getFriendsDemographics():
Promise<GetFriendsDemographicsResponse>
Defined in: lib/insight/api/insightClient.ts:91
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). Calls GET https://api.line.me/v2/bot/insight/demographic. To inspect the HTTP status code or response headers, use getFriendsDemographicsWithHttpInfo.
Returns
Promise<GetFriendsDemographicsResponse>
A promise resolving to the response body.
See
getFriendsDemographicsWithHttpInfo()
getFriendsDemographicsWithHttpInfo():
Promise<ApiResponseType<GetFriendsDemographicsResponse>>
Defined in: lib/insight/api/insightClient.ts:102
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). Calls GET https://api.line.me/v2/bot/insight/demographic. This method returns the response body together with the underlying httpResponse.
Returns
Promise<ApiResponseType<GetFriendsDemographicsResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getMessageEvent()
getMessageEvent(
requestId):Promise<GetMessageEventResponse>
Defined in: lib/insight/api/insightClient.ts:119
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. Calls GET https://api.line.me/v2/bot/insight/message/event. To inspect the HTTP status code or response headers, use getMessageEventWithHttpInfo.
Parameters
requestId
string
Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID.
Returns
Promise<GetMessageEventResponse>
A promise resolving to the response body.
See
getMessageEventWithHttpInfo()
getMessageEventWithHttpInfo(
requestId):Promise<ApiResponseType<GetMessageEventResponse>>
Defined in: lib/insight/api/insightClient.ts:134
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. Calls GET https://api.line.me/v2/bot/insight/message/event. This method returns the response body together with the underlying httpResponse.
Parameters
requestId
string
Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID.
Returns
Promise<ApiResponseType<GetMessageEventResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getNumberOfFollowers()
getNumberOfFollowers(
date?):Promise<GetNumberOfFollowersResponse>
Defined in: lib/insight/api/insightClient.ts:158
Returns the number of users who have added the LINE Official Account on or before a specified date. Calls GET https://api.line.me/v2/bot/insight/followers. To inspect the HTTP status code or response headers, use getNumberOfFollowersWithHttpInfo.
Parameters
date?
string
Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9
Returns
Promise<GetNumberOfFollowersResponse>
A promise resolving to the response body.
See
getNumberOfFollowersWithHttpInfo()
getNumberOfFollowersWithHttpInfo(
date?):Promise<ApiResponseType<GetNumberOfFollowersResponse>>
Defined in: lib/insight/api/insightClient.ts:173
Returns the number of users who have added the LINE Official Account on or before a specified date. Calls GET https://api.line.me/v2/bot/insight/followers. This method returns the response body together with the underlying httpResponse.
Parameters
date?
string
Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9
Returns
Promise<ApiResponseType<GetNumberOfFollowersResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getNumberOfMessageDeliveries()
getNumberOfMessageDeliveries(
date):Promise<GetNumberOfMessageDeliveriesResponse>
Defined in: lib/insight/api/insightClient.ts:201
Returns the number of messages sent from LINE Official Account on a specified day. Calls GET https://api.line.me/v2/bot/insight/message/delivery. To inspect the HTTP status code or response headers, use getNumberOfMessageDeliveriesWithHttpInfo.
Parameters
date
string
Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9
Returns
Promise<GetNumberOfMessageDeliveriesResponse>
A promise resolving to the response body.
See
getNumberOfMessageDeliveriesWithHttpInfo()
getNumberOfMessageDeliveriesWithHttpInfo(
date):Promise<ApiResponseType<GetNumberOfMessageDeliveriesResponse>>
Defined in: lib/insight/api/insightClient.ts:216
Returns the number of messages sent from LINE Official Account on a specified day. Calls GET https://api.line.me/v2/bot/insight/message/delivery. This method returns the response body together with the underlying httpResponse.
Parameters
date
string
Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9
Returns
Promise<ApiResponseType<GetNumberOfMessageDeliveriesResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getRichMenuInsightDaily()
getRichMenuInsightDaily(
richMenuId,from,to):Promise<GetRichMenuInsightDailyResponse>
Defined in: lib/insight/api/insightClient.ts:242
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted. Calls GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/daily. To inspect the HTTP status code or response headers, use getRichMenuInsightDailyWithHttpInfo.
Parameters
richMenuId
string
ID of the rich menu created via the Messaging API.
from
string
Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9
to
string
End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9
Returns
Promise<GetRichMenuInsightDailyResponse>
A promise resolving to the response body.
See
getRichMenuInsightDailyWithHttpInfo()
getRichMenuInsightDailyWithHttpInfo(
richMenuId,from,to):Promise<ApiResponseType<GetRichMenuInsightDailyResponse>>
Defined in: lib/insight/api/insightClient.ts:263
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted. Calls GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/daily. This method returns the response body together with the underlying httpResponse.
Parameters
richMenuId
string
ID of the rich menu created via the Messaging API.
from
string
Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9
to
string
End date of the aggregation period (inclusive). The end date can be specified for up to 99 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9
Returns
Promise<ApiResponseType<GetRichMenuInsightDailyResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getRichMenuInsightSummary()
getRichMenuInsightSummary(
richMenuId,from,to):Promise<GetRichMenuInsightSummaryResponse>
Defined in: lib/insight/api/insightClient.ts:296
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted. Calls GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/summary. To inspect the HTTP status code or response headers, use getRichMenuInsightSummaryWithHttpInfo.
Parameters
richMenuId
string
ID of the rich menu created via the Messaging API.
from
string
Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9
to
string
End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9
Returns
Promise<GetRichMenuInsightSummaryResponse>
A promise resolving to the response body.
See
getRichMenuInsightSummaryWithHttpInfo()
getRichMenuInsightSummaryWithHttpInfo(
richMenuId,from,to):Promise<ApiResponseType<GetRichMenuInsightSummaryResponse>>
Defined in: lib/insight/api/insightClient.ts:317
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted. Calls GET https://api.line.me/v2/bot/insight/richmenu/{richMenuId}/summary. This method returns the response body together with the underlying httpResponse.
Parameters
richMenuId
string
ID of the rich menu created via the Messaging API.
from
string
Start date of the aggregation period (inclusive). Must be within the most recent 3 years. Format: yyyyMMdd (e.g. 20260213) Time zone: UTC+9
to
string
End date of the aggregation period (inclusive). The end date can be specified for up to 396 days after the start date. Format: yyyyMMdd (e.g. 20260215) Time zone: UTC+9
Returns
Promise<ApiResponseType<GetRichMenuInsightSummaryResponse>>
A promise resolving to the response body together with the underlying httpResponse.
See
getStatisticsPerUnit()
getStatisticsPerUnit(
customAggregationUnit,from,to):Promise<GetStatisticsPerUnitResponse>
Defined in: lib/insight/api/insightClient.ts:349
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. Calls GET https://api.line.me/v2/bot/insight/message/event/aggregation. To inspect the HTTP status code or response headers, use getStatisticsPerUnitWithHttpInfo.
Parameters
customAggregationUnit
string
Name of aggregation unit specified when sending the message. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names.
from
string
Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9
to
string
End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9
Returns
Promise<GetStatisticsPerUnitResponse>
A promise resolving to the response body.
See
getStatisticsPerUnitWithHttpInfo()
getStatisticsPerUnitWithHttpInfo(
customAggregationUnit,from,to):Promise<ApiResponseType<GetStatisticsPerUnitResponse>>
Defined in: lib/insight/api/insightClient.ts:373
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. Calls GET https://api.line.me/v2/bot/insight/message/event/aggregation. This method returns the response body together with the underlying httpResponse.
Parameters
customAggregationUnit
string
Name of aggregation unit specified when sending the message. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names.
from
string
Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9
to
string
End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9
Returns
Promise<ApiResponseType<GetStatisticsPerUnitResponse>>
A promise resolving to the response body together with the underlying httpResponse.