Skip to content

@line/bot-sdk / Exports

@line/bot-sdk

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

AccountLinkEvent

Ƭ AccountLinkEvent: ReplyableEvent & { link: { nonce: string ; result: "ok" | "failed" } ; type: "accountLink" }

Event object for when a user has linked his/her LINE account with a provider's service account.

Defined in

lib/types.ts:261


Action

Ƭ Action<ExtraFields>: PostbackAction | MessageAction | URIAction | DatetimePickerAction | RichMenuSwitchAction | { type: "camera" } | { type: "cameraRoll" } | { type: "location" } & ExtraFields

These are types of actions for your bot to take when a user taps a button or an image in a message.

Type parameters

NameType
ExtraFields{ label: string }

Defined in

lib/types.ts:2149


AltURI

Ƭ AltURI: Object

URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters) If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows. The available schemes are http, https, line, and tel. For more information about the LINE URL scheme, see Using the LINE URL scheme. This property is supported on the following version of LINE.

LINE 5.12.0 or later for macOS and Windows Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.

Type declaration

NameType
desktopstring

Defined in

lib/types.ts:2249


Area

Ƭ Area: Object

Type declaration

NameTypeDescription
heightnumberHeight of the tappable area
widthnumberWidth of the tappable area
xnumberHorizontal position relative to the top-left corner of the area
ynumberVertical position relative to the top-left corner of the area

Defined in

lib/types.ts:951


AudienceGroup

Ƭ AudienceGroup: _AudienceGroup & { jobs: AudienceGroupJob[] }

Defined in

lib/types.ts:2848


AudienceGroupAuthorityLevel

Ƭ AudienceGroupAuthorityLevel: "PUBLIC" | "PRIVATE"

Defined in

lib/types.ts:2854


AudienceGroupCreateRoute

Ƭ AudienceGroupCreateRoute: "OA_MANAGER" | "MESSAGING_API"

Defined in

lib/types.ts:2815


AudienceGroupStatus

Ƭ AudienceGroupStatus: "IN_PROGRESS" | "READY" | "EXPIRED" | "FAILED"

Defined in

lib/types.ts:2809


AudienceGroups

Ƭ AudienceGroups: _AudienceGroup[]

Defined in

lib/types.ts:2852


AudioEventMessage

Ƭ AudioEventMessage: { contentProvider: ContentProvider<false> ; duration: number ; type: "audio" } & EventMessageBase

Message object which contains the audio content sent from the source. The binary audio data can be retrieved using Client#getMessageContent.

Defined in

lib/types.ts:530


AudioMessage

Ƭ AudioMessage: MessageCommon & { duration: number ; originalContentUrl: string ; type: "audio" }

See

Audio message

Defined in

lib/types.ts:765


Background

Ƭ Background: Object

Type declaration

NameTypeDescription
anglestringThe angle at which a linear gradient moves. Specify the angle using an integer value like 90deg (90 degrees) or a decimal number like 23.5deg (23.5 degrees) in the half-open interval [0, 360). The direction of the linear gradient rotates clockwise as the angle increases. Given a value of 0deg, the gradient starts at the bottom and ends at the top; given a value of 45deg, the gradient starts at the bottom-left corner and ends at the top-right corner; given a value of 90deg, the gradient starts at the left and ends at the right; and given a value of 180deg, the gradient starts at the top and ends at the bottom. For more information, see Direction (angle) of linear gradient backgrounds in the Messaging API documentation.
centerColor?stringThe color in the middle of the gradient. Use a hexadecimal color code in the #RRGGBB or #RRGGBBAA format. Specify a value for the background.centerColor property to create a gradient that has three colors. For more information, see Intermediate color stops for linear gradients in the Messaging API documentation.
centerPosition?stringThe position of the intermediate color stop. Specify an integer or decimal value between 0% (the starting point) and 100% (the ending point). This is 50% by default. For more information, see Intermediate color stops for linear gradients in the Messaging API documentation.
endColorstringThe color at the gradient's ending point. Use a hexadecimal color code in the #RRGGBB or #RRGGBBAA format.
startColorstringThe color at the gradient's starting point. Use a hexadecimal color code in the #RRGGBB or #RRGGBBAA format.
type"linearGradient"The type of background used. Specify these values: - linearGradient: Linear gradient. For more information, see Linear gradient backgrounds in the Messaging API documentation.

Defined in

lib/types.ts:1271


BeaconEvent

Ƭ BeaconEvent: ReplyableEvent & { beacon: { dm?: string ; hwid: string ; type: "enter" | "leave" | "banner" | "stay" } ; type: "beacon" }

Event object for when a user enters or leaves the range of a LINE Beacon.

Defined in

lib/types.ts:233


BotInfoResponse

Ƭ BotInfoResponse: Object

Response body of get bot info.

See

Get bot info

Type declaration

NameType
basicIdstring
chatMode"chat" | "bot"
displayNamestring
markAsReadMode"auto" | "manual"
pictureUrl?string
premiumId?string
userIdstring

Defined in

lib/types.ts:2921


ChannelAccessToken

Ƭ ChannelAccessToken: Object

Type declaration

NameType
access_tokenstring
expires_innumber
key_id?string
token_type"Bearer"

Defined in

lib/types.ts:2856


ContentProvider

Ƭ ContentProvider<WithPreview>: { type: "line" } | { originalContentUrl: string ; previewImageUrl: WithPreview extends true ? string : undefined ; type: "external" }

Type parameters

NameType
WithPreviewextends boolean = true

Defined in

lib/types.ts:458


DatetimePickerAction

Ƭ DatetimePickerAction: Object

When a control associated with this action is tapped, a postback event is returned via webhook with the date and time selected by the user from the date and time selection dialog.

The datetime picker action does not support time zones.

Date and time format

The date and time formats for the initial, max, and min values are shown below. The full-date, time-hour, and time-minute formats follow the RFC3339 protocol.

ModeFormatExample
datefull-date (Max: 2100-12-31; Min: 1900-01-01)2017-06-18
timetime-hour:time-minute (Max: 23:59; Min: 00:00)00:0006:1523:59
datetimefull-dateTtime-hour:time-minute or full-datettime-hour:time-minute (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00)2017-06-18T06:152017-06-18t06:15

Type declaration

NameTypeDescription
datastringString returned via webhook in the postback.data property of the postback event (Max: 300 characters)
initial?stringInitial value of date or time
max?stringLargest date or time value that can be selected. Must be greater than the min value.
min?stringSmallest date or time value that can be selected. Must be less than the max value.
mode"date" | "time" | "datetime"-
type"datetimepicker"-

Defined in

lib/types.ts:2273


DeliveryContext

Ƭ DeliveryContext: Object

Type declaration

NameType
isRedeliveryboolean

Defined in

lib/types.ts:125


DeliveryEvent

Ƭ DeliveryEvent: { delivery: Delivery ; type: "delivery" } & EventBase

Completed Delivery Event

See

https://developers.line.biz/en/docs/partner-docs/line-notification-messages/message-sending-complete-webhook-event/#receive-delivery-event

Defined in

lib/types.ts:381


DemographicFilterObject

Ƭ DemographicFilterObject: DemographicObject | FilterOperatorObject<DemographicObject>

Defined in

lib/types.ts:2765


DeviceLinkEvent

Ƭ DeviceLinkEvent: ReplyableEvent & { things: { deviceId: string ; type: "link" } ; type: "things" }

Indicates that a LINE Things-compatible device has been linked with LINE by a user operation. For more information, see Receiving device link events via webhook.

Defined in

lib/types.ts:277


DeviceUnlinkEvent

Ƭ DeviceUnlinkEvent: ReplyableEvent & { things: { deviceId: string ; type: "unlink" } ; type: "things" }

Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation. For more information, see Receiving device unlink events via webhook.

Defined in

lib/types.ts:292


EventBase

Ƭ EventBase: Object

Type declaration

NameTypeDescription
deliveryContextDeliveryContextWhether the webhook event is a redelivered one or not
mode"active" | "standby"Channel state. active: The channel is active. You can send a reply message or push message from the bot server that received this webhook event. standby: The channel is waiting. The bot server that received this webhook event shouldn't send any messages.
sourceEventSourceSource user, group, or room object with information about the source of the event.
timestampnumberTime of the event in milliseconds
webhookEventIdstringWebhook Event ID, an ID that uniquely identifies a webhook event

Defined in

lib/types.ts:68


EventMessage

Ƭ EventMessage: TextEventMessage | ImageEventMessage | VideoEventMessage | AudioEventMessage | LocationEventMessage | FileEventMessage | StickerEventMessage

Defined in

lib/types.ts:392


EventMessageBase

Ƭ EventMessageBase: Object

Type declaration

NameType
idstring

Defined in

lib/types.ts:401


EventSource

Ƭ EventSource: User | Group | Room

Defined in

lib/types.ts:95


FileEventMessage

Ƭ FileEventMessage: { fileName: string ; fileSize: string ; type: "file" } & EventMessageBase

Message object which contains the file sent from the source. The binary data can be retrieved using Client#getMessageContent.

Defined in

lib/types.ts:540


FlexBlockStyle

Ƭ FlexBlockStyle: Object

Type declaration

NameTypeDescription
backgroundColor?stringBackground color of the block. Use a hexadecimal color code.
separator?boolean- true to place a separator above the block. - true will be ignored for the first block in a container because you cannot place a separator above the first block. - The default value is false.
separatorColor?stringColor of the separator. Use a hexadecimal color code.

Defined in

lib/types.ts:1016


FlexBox

Ƭ FlexBox: { action?: Action ; alignItems?: "flex-start" | "center" | "flex-end" ; background?: Background ; backgroundColor?: string ; borderColor?: string ; borderWidth?: string | "none" | "light" | "normal" | "medium" | "semi-bold" | "bold" ; contents: FlexComponent[] ; cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; flex?: number ; height?: string ; justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly" ; layout: "horizontal" | "vertical" | "baseline" ; margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; maxHeight?: string ; maxWidth?: string ; paddingAll?: string ; paddingBottom?: string ; paddingEnd?: string ; paddingStart?: string ; paddingTop?: string ; spacing?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; type: "box" ; width?: string } & Offset

This is a component that defines the layout of child components. You can also include a box in a box.

Defined in

lib/types.ts:1078


FlexBubble

Ƭ FlexBubble: Object

This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer.

For more information about using each block, see Block.

Type declaration

NameTypeDescription
action?Action-
body?FlexBox-
direction?"ltr" | "rtl"Text directionality and the order of components in horizontal boxes in the container. Specify one of the following values: - ltr: Left to right - rtl: Right to left The default value is ltr.
footer?FlexBox-
header?FlexBox-
hero?FlexBox | FlexImage | FlexVideo-
size?"nano" | "micro" | "kilo" | "mega" | "giga"-
styles?FlexBubbleStyle-
type"bubble"-

Defined in

lib/types.ts:988


FlexBubbleStyle

Ƭ FlexBubbleStyle: Object

Type declaration

NameType
body?FlexBlockStyle
footer?FlexBlockStyle
header?FlexBlockStyle
hero?FlexBlockStyle

Defined in

lib/types.ts:1009


FlexButton

Ƭ FlexButton: { action: Action ; adjustMode?: "shrink-to-fit" ; color?: string ; flex?: number ; gravity?: "top" | "bottom" | "center" ; height?: "sm" | "md" ; margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; style?: "link" | "primary" | "secondary" ; type: "button" } & Offset

This component draws a button.

When the user taps a button, a specified action is performed.

Defined in

lib/types.ts:1319


FlexCarousel

Ƭ FlexCarousel: Object

Type declaration

NameTypeDescription
contentsFlexBubble[](Max: 12 bubbles)
type"carousel"-

Defined in

lib/types.ts:1034


FlexComponent

Ƭ FlexComponent: FlexBox | FlexButton | FlexImage | FlexVideo | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer

Components are objects that compose a Flex Message container. Here are the types of components available:

See the followings for the components' JSON data samples and usage.

Defined in

lib/types.ts:1062


FlexContainer

Ƭ FlexContainer: FlexBubble | FlexCarousel

A container is the top-level structure of a Flex Message. Here are the types of containers available.

See Flex Message elements for the containers' JSON data samples and usage.

Defined in

lib/types.ts:979


FlexFiller

Ƭ FlexFiller: Object

This is an invisible component to fill extra space between components.

  • The filler's flex property is fixed to 1.
  • The spacing property of the parent box will be ignored for fillers.

Type declaration

NameTypeDescription
flex?numberThe ratio of the width or height of this component within the parent box. For more information, see Width and height of components.
type"filler"-

Defined in

lib/types.ts:1402


FlexIcon

Ƭ FlexIcon: { aspectRatio?: string ; margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" ; type: "icon" ; url: string } & Offset

This component draws an icon.

Defined in

lib/types.ts:1413


FlexImage

Ƭ FlexImage: { action?: Action ; align?: "start" | "end" | "center" ; animated?: Boolean ; aspectMode?: "cover" | "fit" ; aspectRatio?: string ; backgroundColor?: string ; flex?: number ; gravity?: "top" | "bottom" | "center" ; margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" ; size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full" ; type: "image" ; url: string } & Offset

This component draws an image.

Defined in

lib/types.ts:1466


FlexMessage

Ƭ FlexMessage: MessageCommon & { altText: string ; contents: FlexContainer ; type: "flex" }

Flex Messages are messages with a customizable layout. You can customize the layout freely by combining multiple elements. For more information, see Using Flex Messages.

See

Flex messages

Defined in

lib/types.ts:909


FlexSeparator

Ƭ FlexSeparator: Object

This component draws a separator between components in the parent box.

Type declaration

NameTypeDescription
color?stringColor of the separator. Use a hexadecimal color code.
margin?string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"Minimum space between this box and the previous component in the parent box. - none does not set a space while the other values set a space whose size increases in the order of listing. - The default value is the value of the spacing property of the parent box. - If this box is the first component in the parent box, the margin property will be ignored.
type"separator"-

Defined in

lib/types.ts:1628


FlexSpacer

Ƭ FlexSpacer: Object

This is an invisible component that places a fixed-size space at the beginning or end of the box.

Deprecated

Type declaration

NameTypeDescription
size?"xs" | "sm" | "md" | "lg" | "xl" | "xxl"Size of the space. The size increases in the order of listing. The default value is md.
type"spacer"-

Defined in

lib/types.ts:1653


FlexSpan

Ƭ FlexSpan: Object

This component renders multiple text strings with different designs in one row. You can specify the color, size, weight, and decoration for the font. Span is set to contents property in Text.

Type declaration

NameTypeDescription
color?stringFont color. Use a hexadecimal color code.
decoration?stringDecoration of the text. Specify one of the following values: none: No decoration underline: Underline line-through: Strikethrough The default value is none. Note: The decoration set in the decoration property of the text cannot be overwritten by the decoration property of the span.
size?string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl"Font size. You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl. The size increases in the order of listing. The default value is md. For more information, see Icon, text, and span size in the Messaging API documentation.
style?stringStyle of the text. Specify one of the following values: - normal: Normal - italic: Italic The default value is normal.
textstringText. If the wrap property of the parent text is set to true, you can use a new line character (\n) to begin on a new line.
type"span"-
weight?stringFont weight. You can specify one of the following values: regular or bold. Specifying bold makes the font bold. The default value is regular.

Defined in

lib/types.ts:1814


FlexText

Ƭ FlexText: FlexTextWithText | FlexTextWithContents & Offset

Defined in

lib/types.ts:1809


FlexVideo

Ƭ FlexVideo: Object

This component draws a video.

Type declaration

NameTypeDescription
action?ActionAction performed when this button is tapped. Specify an action object.
altContentFlexBox | FlexImageAlternative content. The alternative content will be displayed on the screen of a user device that is using a version of LINE that doesn't support the video component. Specify a box or an image. - Protocol: HTTPS (TLS 1.2 or later) - Image format: JPEG or PNG - Maximum data size: 1 MB
aspectRatio?stringAspect ratio of the video. {width}:{height} format. Specify the value of {width} and {height} in the range from 1 to 100000. However, you cannot set {height} to a value that is more than three times the value of {width}. The default value is 1:1.
previewUrlstringPreview image URL (Max character limit: 2000) - Protocol: HTTPS (TLS 1.2 or later) - Image format: JPEG or PNG - Maximum data size: 1 MB
type"video"-
urlstringVideo file URL (Max character limit: 2000) - Protocol: HTTPS (TLS 1.2 or later) - Video format: mp4 - Maximum data size: 200 MB

Defined in

lib/types.ts:1581


FollowEvent

Ƭ FollowEvent: { type: "follow" } & ReplyableEvent

Event object for when your account is added as a friend (or unblocked).

Defined in

lib/types.ts:158


FriendDemographics

Ƭ FriendDemographics: Object

Type declaration

NameTypeDescription
ages?{ age: string } & PercentageAble[]Percentage per age group
appTypes?{ appType: "ios" | "android" | "others" } & PercentageAble[]Percentage by OS
areas?{ area: string } & PercentageAble[]Percentage per area
availablebooleantrue if friend demographic information is available.
genders?{ gender: "unknown" | "male" | "female" } & PercentageAble[]Percentage per gender
subscriptionPeriods?{ subscriptionPeriod: "over365days" | "within365days" | "within180days" | "within90days" | "within30days" | "within7days" | "unknown" } & PercentageAble[]Percentage per friendship duration

Defined in

lib/types.ts:2485


GetRichMenuAliasListResponse

Ƭ GetRichMenuAliasListResponse: Object

Type declaration

NameType
aliasesGetRichMenuAliasResponse[]

Defined in

lib/types.ts:2912


GetRichMenuAliasResponse

Ƭ GetRichMenuAliasResponse: Object

Type declaration

NameType
richMenuAliasIdstring
richMenuIdstring

Defined in

lib/types.ts:2907


Group

Ƭ Group: Object

Type declaration

NameTypeDescription
groupIdstring-
type"group"-
userId?stringID of the source user. Only included in message events. Not included if the user has not agreed to the Official Accounts Terms of Use.

Defined in

lib/types.ts:99


GroupSummaryResponse

Ƭ GroupSummaryResponse: Object

Response body of get group summary.

See

Get group summary

Type declaration

NameType
groupIdstring
groupNamestring
pictureUrl?string

Defined in

lib/types.ts:2891


ImageEventMessage

Ƭ ImageEventMessage: { contentProvider: ContentProvider ; imageSet?: { id: string ; index: number ; total: number } ; type: "image" } & QuotableMessage & EventMessageBase

Message object which contains the image content sent from the source. The binary image data can be retrieved using Client#getMessageContent.

Defined in

lib/types.ts:488


ImageMapAction

Ƭ ImageMapAction: ImageMapURIAction | ImageMapMessageAction

Object which specifies the actions and tappable regions of an imagemap.

When a region is tapped, the user is redirected to the URI specified in uri and the message specified in message is sent.

See

Imagemap action objects

Defined in

lib/types.ts:923


ImageMapActionBase

Ƭ ImageMapActionBase: Object

Type declaration

NameTypeDescription
areaAreaDefined tappable area
label?stringSpoken when the accessibility feature is enabled on the client device. (Max: 50 characters) Supported on LINE 8.2.0 and later for iOS.

Defined in

lib/types.ts:925


ImageMapMessage

Ƭ ImageMapMessage: MessageCommon & { actions: ImageMapAction[] ; altText: string ; baseSize: Size ; baseUrl: string ; type: "imagemap" ; video?: { area: Area ; externalLink?: { label: string ; linkUri: string } ; originalContentUrl: string ; previewImageUrl: string } }

See

Imagemap message

Defined in

lib/types.ts:823


ImageMapMessageAction

Ƭ ImageMapMessageAction: { text: string ; type: "message" } & ImageMapActionBase

Defined in

lib/types.ts:943


ImageMapURIAction

Ƭ ImageMapURIAction: { linkUri: string ; type: "uri" } & ImageMapActionBase

Defined in

lib/types.ts:935


ImageMessage

Ƭ ImageMessage: MessageCommon & { originalContentUrl: string ; previewImageUrl: string ; type: "image" }

See

Image message

Defined in

lib/types.ts:713


InsightStatisticsResponse

Ƭ InsightStatisticsResponse: Object

Type declaration

NameTypeDescription
status"ready" | "unready" | "out_of_service"Calculation status. One of: - ready: Calculation has finished; the numbers are up-to-date. - unready: We haven't finished calculating the number of sent messages for the specified date. Calculation usually takes about a day. Please try again later. - out_of_service: The specified date is earlier than the date on which we first started calculating sent messages. Different APIs have different date. Check them at the document.

Defined in

lib/types.ts:2409


JoinEvent

Ƭ JoinEvent: { type: "join" } & ReplyableEvent

Event object for when your bot joins a group or room. You can reply to join events.

A join event is triggered at different times for groups and rooms.

  • For groups: A join event is sent when a user invites your bot.
  • For rooms: A join event is sent when the first event (for example when a user sends a message or is added to the room) occurs after your bot is added.

Defined in

lib/types.ts:175


LINEThingsActionResult

Ƭ LINEThingsActionResult: Object

Type declaration

NameTypeDescription
data?stringBase64-encoded binary data This property is always included when things.actionResults[].type is binary.
type"void" | "binary"void, binary Depends on type of the executed action. This property is always included if things.actionResults is not empty.

Defined in

lib/types.ts:363


LINEThingsScenarioExecutionEvent

Ƭ LINEThingsScenarioExecutionEvent: ReplyableEvent & { things: { deviceId: string ; result: { actionResults: LINEThingsActionResult[] ; bleNotificationPayload?: string ; endtime: number ; errorReason?: string ; resultCode: "success" | "gatt_error" | "runtime_error" ; revision: number ; scenarioId: string ; startTime: number } ; type: "scenarioResult" } ; type: "things" }

Defined in

lib/types.ts:303


LeaveEvent

Ƭ LeaveEvent: { type: "leave" } & EventBase

Event object for when a user removes your bot from a group or a room.

Defined in

lib/types.ts:180


LocationEventMessage

Ƭ LocationEventMessage: { address: string ; latitude: number ; longitude: number ; title: string ; type: "location" } & EventMessageBase

Message object which contains the location data sent from the source.

Defined in

lib/types.ts:549


LocationMessage

Ƭ LocationMessage: MessageCommon & { address: string ; latitude: number ; longitude: number ; title: string ; type: "location" }

See

Location message

Defined in

lib/types.ts:785


MemberJoinEvent

Ƭ MemberJoinEvent: { joined: { members: User[] } ; type: "memberJoined" } & ReplyableEvent

Event object for when a user joins a group or room that the bot is in.

Defined in

lib/types.ts:186


MemberLeaveEvent

Ƭ MemberLeaveEvent: { left: { members: User[] } ; type: "memberLeft" } & EventBase

Event object for when a user leaves a group or room that the bot is in.

Defined in

lib/types.ts:199


MembersCountResponse

Ƭ MembersCountResponse: Object

Response body of get members in group count and get members in room count.

See

Type declaration

NameType
countnumber

Defined in

lib/types.ts:2903


Message

Ƭ Message: TextMessage | ImageMessage | VideoMessage | AudioMessage | LocationMessage | StickerMessage | ImageMapMessage | TemplateMessage | FlexMessage

JSON object which contains the contents of the message you send.

See

Message objects

Defined in

lib/types.ts:634


MessageAPIResponseBase

Ƭ MessageAPIResponseBase: Object

Type declaration

NameType
x-line-request-id?string

Defined in

lib/types.ts:2403


MessageAction

Ƭ MessageAction: Object

When a control associated with this action is tapped, the string in the text property is sent as a message from the user.

Type declaration

NameTypeDescription
textstringText sent when the action is performed (Max: 300 characters)
type"message"-

Defined in

lib/types.ts:2217


MessageCommon

Ƭ MessageCommon: Object

See

Common properties for messages

Type declaration

NameTypeDescription
quickReply?QuickReplyFor the quick reply feature. For more information, see Using quick replies. If the user receives multiple message objects, the quickReply property of the last message object is displayed.
sender?SenderChange icon and display name When sending a message from the LINE Official Account, you can specify the sender.name and the sender.iconUrl properties in Message objects.

Defined in

lib/types.ts:648


MessageEvent

Ƭ MessageEvent: { message: EventMessage ; type: "message" } & ReplyableEvent

Webhook event object which contains the sent message.

The message property contains a message object which corresponds with the message type. You can reply to message events.

See

Message event

Defined in

lib/types.ts:137


NarrowcastProgressResponse

Ƭ NarrowcastProgressResponse: { phase: "waiting" } | { phase: "sending" | "succeeded" } | { failedDescription: string ; phase: "failed" } & { acceptedTime: string ; completedTime: string ; failureCount: number ; successCount: number ; targetCount: string } & { errorCode?: 1 | 2 }

Defined in

lib/types.ts:2769


NumberOfFollowers

Ƭ NumberOfFollowers: InsightStatisticsResponse & { blocks: Number ; followers: Number ; targetedReaches: Number }

Defined in

lib/types.ts:2458


NumberOfFollowersResponse

Ƭ NumberOfFollowersResponse: InsightStatisticsResponse | NumberOfFollowers

Defined in

lib/types.ts:2477


NumberOfMessageDeliveries

Ƭ NumberOfMessageDeliveries: InsightStatisticsResponse & { apiBroadcast: number ; apiMulticast: number ; apiPush: number ; apiReply: number ; autoResponse: number ; broadcast: number ; chat: number ; targeting: number ; welcomeResponse: number }

Defined in

lib/types.ts:2419


NumberOfMessageDeliveriesResponse

Ƭ NumberOfMessageDeliveriesResponse: InsightStatisticsResponse | NumberOfMessageDeliveries

Defined in

lib/types.ts:2473


NumberOfMessagesSentResponse

Ƭ NumberOfMessagesSentResponse: InsightStatisticsResponse & { success?: number }

Defined in

lib/types.ts:2373


NumberOfMessagesSentThisMonth

Ƭ NumberOfMessagesSentThisMonth: Object

Type declaration

NameTypeDescription
totalUsagenumberThe number of sent messages in the current month

Defined in

lib/types.ts:2395


Offset

Ƭ Offset: Object

Type declaration

NameTypeDescription
offsetBottom?stringThe bottom offset. For more information, see Offset in the API documentation.
offsetEnd?stringThe right offset. For more information, see Offset in the API documentation.
offsetStart?stringThe left offset. For more information, see Offset in the API documentation.
offsetTop?stringThe top offset. For more information, see Offset in the API documentation.
position?"relative" | "absolute"Reference position for placing this box. Specify one of the following values: - relative: Use the previous box as reference. - absolute: Use the top left of parent element as reference. The default value is relative. For more information, see Offset in the API documentation.

Defined in

lib/types.ts:1239


Postback

Ƭ Postback: Object

Type declaration

NameType
datastring
params?DateTimePostback | RichMenuSwitchPostback

Defined in

lib/types.ts:588


PostbackAction

Ƭ PostbackAction: Object

When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property.

Type declaration

NameTypeDescription
datastringString returned via webhook in the postback.data property of the postback event (Max: 300 characters)
displayText?stringText displayed in the chat as a message sent by the user when the action is performed. - Required for quick reply buttons. - Optional for the other message types. Max: 300 characters The displayText and text properties cannot both be used at the same time.
fillInText?stringString to be pre-filled in the input field when the keyboard is opened. Valid only when the inputOption property is set to openKeyboard. The string can be broken by a newline character (\n). Max: 300 characters
inputOption?"closeRichMenu" | "openRichMenu" | "openKeyboard" | "openVoice"The display method of such as rich menu based on user action. Specify one of the following values: - closeRichMenu: Close rich menu - openRichMenu: Open rich menu - openKeyboard: Open keyboard - openVoice: Open voice message input mode This property is available on LINE version 12.6.0 or later for iOS or Android.
text?stringText displayed in the chat as a message sent by the user when the action is performed. Returned from the server through a webhook. - This property cannot be used with quick reply buttons. (Max: 300 characters) - The displayText and text properties cannot both be used at the same time. Deprecated
type"postback"-

Defined in

lib/types.ts:2165


PostbackEvent

Ƭ PostbackEvent: { postback: Postback ; type: "postback" } & ReplyableEvent

Event object for when a user performs an action on a template message.

Defined in

lib/types.ts:212


Profile

Ƭ Profile: Object

Type declaration

NameType
displayNamestring
language?string
pictureUrl?string
statusMessage?string
userIdstring

Defined in

lib/types.ts:20


QuickReply

Ƭ QuickReply: Object

These properties are used for the quick reply.

For more information, see Using quick replies.

Type declaration

NameTypeDescription
itemsQuickReplyItem[]This is a container that contains quick reply buttons. Array of objects (Max: 13)

Defined in

lib/types.ts:2066


QuickReplyItem

Ƭ QuickReplyItem: Object

This is a quick reply option that is displayed as a button.

For more information, see quick reply buttons.

Type declaration

NameTypeDescription
actionActionAction performed when this button is tapped. Specify an action object. The following is a list of the available actions: - Postback action - Message action - Datetime picker action - Camera action - Camera roll action - Location action - URI action
imageUrl?stringURL of the icon that is displayed at the beginning of the button (Max: 1000 characters) - URL scheme: https - Image format: PNG - Aspect ratio: 1:1 - Data size: Up to 1 MB There is no limit on the image size. If the action property has the following actions with empty imageUrl: - camera action - camera roll action - location action the default icon is displayed.
type"action"-

Defined in

lib/types.ts:2082


ReceieptObject

Ƭ ReceieptObject: AudienceObject | RedeliveryObject | FilterOperatorObject<AudienceObject> | FilterOperatorObject<RedeliveryObject>

Defined in

lib/types.ts:2627


ReplyableEvent

Ƭ ReplyableEvent: EventBase & { replyToken: string }

Defined in

lib/types.ts:127


RichMenu

Ƭ RichMenu: Object

Rich menus consist of either of these objects.

Area objects and action objects are included in these objects.

Type declaration

NameTypeDescription
areas{ action: Action<{ label?: string }> ; bounds: Area }[]Array of area objects which define the coordinates and size of tappable areas (Max: 20 area objects)
chatBarTextstringText displayed in the chat bar (Max: 14 characters)
namestringName of the rich menu. This value can be used to help manage your rich menus and is not displayed to users. (Max: 300 characters)
selectedbooleantrue to display the rich menu by default. Otherwise, false.
sizeSizesize object which contains the width and height of the rich menu displayed in the chat. Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.

Defined in

lib/types.ts:2339


RichMenuResponse

Ƭ RichMenuResponse: { richMenuId: string } & RichMenu

Defined in

lib/types.ts:2371


RichMenuSwitchAction

Ƭ RichMenuSwitchAction: Object

When a control associated with this action is tapped, the URI specified in the uri property is opened.

Type declaration

NameTypeDescription
datastringString returned by the postback.data property of the postback event via a webhook Max character limit: 300
label?stringAction label. Optional for rich menus. Read when the user's device accessibility feature is enabled. Max character limit: 20. Supported on LINE for iOS 8.2.0 or later.
richMenuAliasIdstringRich menu alias ID to switch to.
type"richmenuswitch"-

Defined in

lib/types.ts:2306


Room

Ƭ Room: Object

Type declaration

NameTypeDescription
roomIdstring-
type"room"-
userId?stringID of the source user. Only included in message events. Not included if the user has not agreed to the Official Accounts Terms of Use.

Defined in

lib/types.ts:112


Sender

Ƭ Sender: Object

Type declaration

NameTypeDescription
iconUrl?stringIcon image URL - Max character limit: 1000 - URL scheme: https
name?stringDisplay name - Max character limit: 20 - Certain words such as LINE may not be used.

Defined in

lib/types.ts:2120


Size

Ƭ Size: Object

Type declaration

NameType
heightnumber
widthnumber

Defined in

lib/types.ts:2297


StatisticsPerUnit

Ƭ StatisticsPerUnit: Object

https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit

Type declaration

NameType
clicksUserInteractionStatisticsOfEachURL[]
messagesUserInteractionStatisticsOfEachMessage[]
overview{ uniqueClick: number ; uniqueImpression: number ; uniqueMediaPlayed: number ; uniqueMediaPlayed100Percent: number }
overview.uniqueClicknumber
overview.uniqueImpressionnumber
overview.uniqueMediaPlayednumber
overview.uniqueMediaPlayed100Percentnumber

Defined in

lib/types.ts:2592


StickerEventMessage

Ƭ StickerEventMessage: { keywords: string[] ; packageId: string ; quotedMessageId?: string ; stickerId: string ; stickerResourceType: "STATIC" | "ANIMATION" | "SOUND" | "ANIMATION_SOUND" | "POPUP" | "POPUP_SOUND" | "CUSTOM" | "MESSAGE" ; text?: string ; type: "sticker" } & QuotableMessage & EventMessageBase

Message object which contains the sticker data sent from the source. For a list of basic LINE stickers and sticker IDs, see sticker list.

Defined in

lib/types.ts:562


StickerMessage

Ƭ StickerMessage: MessageCommon & CanQuoteMessage & { packageId: string ; stickerId: string ; type: "sticker" }

See

Sticker message

Defined in

lib/types.ts:802


TargetLimitForAdditionalMessages

Ƭ TargetLimitForAdditionalMessages: Object

Type declaration

NameTypeDescription
type"none" | "limited"One of the following values to indicate whether a target limit is set or not. - none: This indicates that a target limit is not set. - limited: This indicates that a target limit is set.
value?numberThe target limit for additional messages in the current month. This property is returned when the type property has a value of limited.

Defined in

lib/types.ts:2381


TemplateButtons

Ƭ TemplateButtons: Object

Template with an image, title, text, and multiple action buttons.

Because of the height limitation for buttons template messages, the lower part of the text display area will get cut off if the height limitation is exceeded. For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits.

Type declaration

NameTypeDescription
actionsAction[]Action when tapped (Max: 4)
imageAspectRatio?"rectangle" | "square"Aspect ratio of the image. Specify one of the following values: - rectangle: 1.51:1 - square: 1:1 The default value is rectangle
imageBackgroundColor?stringBackground color of image. Specify a RGB color value. The default value is #FFFFFF (white).
imageSize?"cover" | "contain"Size of the image. Specify one of the following values: - cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. - contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. The default value is cover.
textstringMessage text - Max: 160 characters (no image or title) - Max: 60 characters (message with an image or title)
thumbnailImageUrl?stringImage URL (Max: 2000 characters) - HTTPS - JPEG or PNG - Max width: 1024px - Max: 1 MB
title?stringTitle (Max: 40 characters)
type"buttons"-

Defined in

lib/types.ts:1879


TemplateCarousel

Ƭ TemplateCarousel: Object

Template with multiple columns which can be cycled like a carousel. The columns will be shown in order by scrolling horizontally.

Because of the height limitation for carousel template messages, the lower part of the text display area will get cut off if the height limitation is exceeded. For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits.

Keep the number of actions consistent for all columns. If you use an image or title for a column, make sure to do the same for all other columns.

Type declaration

NameTypeDescription
columnsTemplateColumn[]Array of columns (Max: 10)
imageAspectRatio?"rectangle" | "square"Aspect ratio of the image. Specify one of the following values: - rectangle: 1.51:1 - square: 1:1 Applies to all columns. The default value is rectangle.
imageSize?"cover" | "contain"Size of the image. Specify one of the following values: - cover: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. - contain: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. Applies to all columns. The default value is cover.
type"carousel"-

Defined in

lib/types.ts:1965


TemplateColumn

Ƭ TemplateColumn: Object

Type declaration

NameTypeDescription
actionsAction[]Action when tapped (Max: 3)
defaultAction?ActionAction when image is tapped; set for the entire image, title, and text area
imageBackgroundColor?stringBackground color of image. Specify a RGB color value. The default value is #FFFFFF (white).
textstringMessage text - Max: 120 characters (no image or title) - Max: 60 characters (message with an image or title)
thumbnailImageUrl?stringImage URL (Max: 2000 characters) - HTTPS - JPEG or PNG - Aspect ratio: 1:1.51 - Max width: 1024px - Max: 1 MB
title?stringTitle (Max: 40 characters)

Defined in

lib/types.ts:1994


TemplateConfirm

Ƭ TemplateConfirm: Object

Template with two action buttons.

Because of the height limitation for confirm template messages, the lower part of the text display area will get cut off if the height limitation is exceeded. For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits.

Type declaration

NameTypeDescription
actionsAction[]Action when tapped. Set 2 actions for the 2 buttons
textstringMessage text (Max: 240 characters)
type"confirm"-

Defined in

lib/types.ts:1941


TemplateContent

Ƭ TemplateContent: TemplateButtons | TemplateConfirm | TemplateCarousel | TemplateImageCarousel

Defined in

lib/types.ts:1865


TemplateImageCarousel

Ƭ TemplateImageCarousel: Object

Template with multiple images which can be cycled like a carousel. The images will be shown in order by scrolling horizontally.

Type declaration

NameTypeDescription
columnsTemplateImageColumn[]Array of columns (Max: 10)
type"image_carousel"-

Defined in

lib/types.ts:2035


TemplateImageColumn

Ƭ TemplateImageColumn: Object

Type declaration

NameTypeDescription
actionAction<{ label?: string }>Action when image is tapped
imageUrlstringImage URL (Max: 2000 characters) - HTTPS - JPEG or PNG - Aspect ratio: 1:1 - Max width: 1024px - Max: 1 MB

Defined in

lib/types.ts:2043


TemplateMessage

Ƭ TemplateMessage: MessageCommon & { altText: string ; template: TemplateContent ; type: "template" }

Template messages are messages with predefined layouts which you can customize. For more information, see template messages.

The following template types are available:

See

Template messages

Defined in

lib/types.ts:889


TestWebhookEndpointResponse

Ƭ TestWebhookEndpointResponse: Object

Response body of test webhook endpoint.

See

Test webhook endpoint

Type declaration

NameType
detailstring
reasonstring
statusCodenumber
successboolean
timestampstring

Defined in

lib/types.ts:2946


TextEventMessage

Ƭ TextEventMessage: { emojis?: { emojiId: string ; index: number ; length: number ; productId: string }[] ; mention?: { mentionees: { index: number ; length: number ; type: "user" | "all" ; userId?: string }[] } ; quotedMessageId?: string ; text: string ; type: "text" } & QuotableMessage & EventMessageBase

Message object which contains the text sent from the source.

Defined in

lib/types.ts:406


TextMessage

Ƭ TextMessage: MessageCommon & CanQuoteMessage & { emojis?: { emojiId: string ; index: number ; productId: string }[] ; text: string ; type: "text" }

See

Text message

Defined in

lib/types.ts:683


URIAction

Ƭ URIAction: Object

When a control associated with this action is tapped, the URI specified in the uri property is opened.

Type declaration

NameTypeDescription
altUri?AltURI-
type"uri"-
uristringURI opened when the action is performed (Max: 1000 characters). Must start with http, https, or tel.

Defined in

lib/types.ts:2229


UnfollowEvent

Ƭ UnfollowEvent: { type: "unfollow" } & EventBase

Event object for when your account is blocked.

Defined in

lib/types.ts:163


UnsendEvent

Ƭ UnsendEvent: { type: "unsend" ; unsend: { messageId: string } } & EventBase

Event object for when the user unsends a message in a group or room. Unsend event

Defined in

lib/types.ts:147


User

Ƭ User: Object

Type declaration

NameType
type"user"
userIdstring

Defined in

lib/types.ts:97


UserInteractionStatistics

Ƭ UserInteractionStatistics: Object

https://developers.line.biz/en/reference/messaging-api/#get-message-event

Type declaration

NameType
clicksUserInteractionStatisticsOfEachURL[]
messagesUserInteractionStatisticsOfEachMessage[]
overview{ delivered: number ; requestId: string ; timestamp: number ; uniqueClick: number ; uniqueImpression: number ; uniqueMediaPlayed: number ; uniqueMediaPlayed100Percent: number }
overview.deliverednumber
overview.requestIdstring
overview.timestampnumber
overview.uniqueClicknumber
overview.uniqueImpressionnumber
overview.uniqueMediaPlayednumber
overview.uniqueMediaPlayed100Percentnumber

Defined in

lib/types.ts:2575


VerifyAccessToken

Ƭ VerifyAccessToken: Object

Type declaration

NameType
client_idstring
expires_innumber
scopestring

Defined in

lib/types.ts:2863


VerifyIDToken

Ƭ VerifyIDToken: Object

Type declaration

NameType
amrstring[]
audnumber
client_idstring
emailstring
expnumber
expires_innumber
iatnumber
issstring
namestring
noncestring
picturestring
scopestring
substring

Defined in

lib/types.ts:2869


VideoEventMessage

Ƭ VideoEventMessage: { contentProvider: ContentProvider ; type: "video" } & QuotableMessage & EventMessageBase

Message object which contains the video content sent from the source. The binary video data can be retrieved using Client#getMessageContent.

Defined in

lib/types.ts:520


VideoMessage

Ƭ VideoMessage: MessageCommon & { originalContentUrl: string ; previewImageUrl: string ; type: "video" }

See

Video message

Defined in

lib/types.ts:738


VideoPlayCompleteEvent

Ƭ VideoPlayCompleteEvent: { type: "videoPlayComplete" ; videoPlayComplete: { trackingId: string } } & ReplyableEvent

Event for when a user finishes viewing a video at least once with the specified trackingId sent by the LINE Official Account.

Defined in

lib/types.ts:220


WebhookEndpointInfoResponse

Ƭ WebhookEndpointInfoResponse: Object

Response body of get webhook endpoint info.

See

Get get webhook endpoint info

Type declaration

NameType
activeboolean
endpointstring

Defined in

lib/types.ts:2936


WebhookEvent

Ƭ WebhookEvent: MessageEvent | UnsendEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | VideoPlayCompleteEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent | DeliveryEvent

JSON objects which contain events generated on the LINE Platform.

See

Webhook event objects

Defined in

lib/types.ts:50


WebhookRequestBody

Ƭ WebhookRequestBody: Object

Request body which is sent by webhook.

See

Request body

Type declaration

NameTypeDescription
destinationstringUser ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, U[0-9a-f]{32}.
eventsWebhookEvent[]Information about the event

Defined in

lib/types.ts:33

Variables

LINE_REQUEST_ID_HTTP_HEADER_NAME

Const LINE_REQUEST_ID_HTTP_HEADER_NAME: "x-line-request-id"

Defined in

lib/types.ts:2402


LINE_SIGNATURE_HTTP_HEADER_NAME

Const LINE_SIGNATURE_HTTP_HEADER_NAME: "x-line-signature"

Defined in

lib/types.ts:2407

Functions

middleware

middleware(config): Middleware

Parameters

NameType
configMiddlewareConfig

Returns

Middleware

Defined in

lib/middleware.ts:28


validateSignature

validateSignature(body, channelSecret, signature): boolean

Parameters

NameType
bodystring | Buffer
channelSecretstring
signaturestring

Returns

boolean

Defined in

lib/validate-signature.ts:14