UNPKG

93 kBTypeScriptView Raw
1/**
2 * @deprecated Use types generated by openapi spec instead.
3 */
4import { AxiosRequestConfig } from "axios";
5export interface Config {
6 channelAccessToken?: string;
7 channelSecret?: string;
8}
9export interface ClientConfig extends Config {
10 channelAccessToken: string;
11 httpConfig?: Partial<AxiosRequestConfig>;
12}
13export interface MiddlewareConfig extends Config {
14 channelSecret: string;
15}
16export type Profile = {
17 displayName: string;
18 userId: string;
19 pictureUrl?: string;
20 statusMessage?: string;
21 language?: string;
22};
23/**
24 * Request body which is sent by webhook.
25 *
26 * @see [Request body](https://developers.line.biz/en/reference/messaging-api/#request-body)
27 */
28export type WebhookRequestBody = {
29 /**
30 * User 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}.
31 */
32 destination: string;
33 /**
34 * Information about the event
35 */
36 events: Array<WebhookEvent>;
37};
38/**
39 * JSON objects which contain events generated on the LINE Platform.
40 *
41 * @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
42 */
43export type WebhookEvent = MessageEvent | UnsendEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | VideoPlayCompleteEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent | DeliveryEvent;
44export type EventBase = {
45 /**
46 * Channel state.
47 *
48 * `active`: The channel is active. You can send a reply message or push message from the bot server that received this webhook event.
49 *
50 * `standby`: The channel is waiting. The bot server that received this webhook event shouldn't send any messages.
51 */
52 mode: "active" | "standby";
53 /**
54 * Time of the event in milliseconds
55 */
56 timestamp: number;
57 /**
58 * Source user, group, or room object with information about the source of the event.
59 */
60 source: EventSource;
61 /**
62 * Webhook Event ID, an ID that uniquely identifies a webhook event
63 */
64 webhookEventId: string;
65 /**
66 * Whether the webhook event is a redelivered one or not
67 */
68 deliveryContext: DeliveryContext;
69};
70export type EventSource = User | Group | Room;
71export type User = {
72 type: "user";
73 userId: string;
74};
75export type Group = {
76 type: "group";
77 groupId: string;
78 /**
79 * ID of the source user.
80 *
81 * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
82 * Not included if the user has not agreed to the
83 * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
84 */
85 userId?: string;
86};
87export type Room = {
88 type: "room";
89 roomId: string;
90 /**
91 * ID of the source user.
92 *
93 * Only included in [message events](https://developers.line.biz/en/reference/messaging-api/#message-event).
94 * Not included if the user has not agreed to the
95 * [Official Accounts Terms of Use](https://developers.line.biz/en/docs/messaging-api/user-consent/).
96 */
97 userId?: string;
98};
99export type DeliveryContext = {
100 isRedelivery: boolean;
101};
102export type ReplyableEvent = EventBase & {
103 replyToken: string;
104};
105/**
106 * Webhook event object which contains the sent message.
107 *
108 * The `message` property contains a message object which corresponds with the
109 * message type. You can reply to message events.
110 *
111 * @see [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)
112 */
113export type MessageEvent = {
114 type: "message";
115 message: EventMessage;
116} & ReplyableEvent;
117/**
118 * Event object for when the user unsends a message in a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
119 * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room).
120 * [Unsend event](https://developers.line.biz/en/reference/messaging-api/#unsend-event)
121 */
122export type UnsendEvent = {
123 type: "unsend";
124 /**
125 * The message ID of the unsent message
126 */
127 unsend: {
128 messageId: string;
129 };
130} & EventBase;
131/**
132 * Event object for when your account is added as a friend (or unblocked).
133 */
134export type FollowEvent = {
135 type: "follow";
136} & ReplyableEvent;
137/**
138 * Event object for when your account is blocked.
139 */
140export type UnfollowEvent = {
141 type: "unfollow";
142} & EventBase;
143/**
144 * Event object for when your bot joins a group or room. You can reply to join events.
145 *
146 * A join event is triggered at different times for groups and rooms.
147 *
148 * - For groups: A join event is sent when a user invites your bot.
149 * - For rooms: A join event is sent when the first event (for example when a
150 * user sends a message or is added to the room) occurs after your bot is
151 * added.
152 */
153export type JoinEvent = {
154 type: "join";
155} & ReplyableEvent;
156/**
157 * Event object for when a user removes your bot from a group or a room.
158 */
159export type LeaveEvent = {
160 type: "leave";
161} & EventBase;
162/**
163 * Event object for when a user joins a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
164 * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
165 */
166export type MemberJoinEvent = {
167 type: "memberJoined";
168 /**
169 * User ID of users who joined
170 * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
171 */
172 joined: {
173 members: Array<User>;
174 };
175} & ReplyableEvent;
176/**
177 * Event object for when a user leaves a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
178 * or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room) that the bot is in.
179 */
180export type MemberLeaveEvent = {
181 type: "memberLeft";
182 /**
183 * User ID of users who left
184 * Array of [source user](https://developers.line.biz/en/reference/messaging-api/#source-user) objects
185 */
186 left: {
187 members: Array<User>;
188 };
189} & EventBase;
190/**
191 * Event object for when a user performs an action on a
192 * [template message](https://developers.line.biz/en/reference/messaging-api/#template-messages).
193 */
194export type PostbackEvent = {
195 type: "postback";
196 postback: Postback;
197} & ReplyableEvent;
198/**
199 * Event for when a user finishes viewing a video at least once with the specified trackingId sent by the LINE Official Account.
200 */
201export type VideoPlayCompleteEvent = {
202 type: "videoPlayComplete";
203 /**
204 * ID used to identify a video. Returns the same value as the trackingId assigned to the [video message](https://developers.line.biz/en/reference/messaging-api/#video-message).
205 * String
206 */
207 videoPlayComplete: {
208 trackingId: string;
209 };
210} & ReplyableEvent;
211/**
212 * Event object for when a user enters or leaves the range of a
213 * [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
214 */
215export type BeaconEvent = ReplyableEvent & {
216 type: "beacon";
217 beacon: {
218 /**
219 * `leave` will be deprecated
220 */
221 type: "enter" | "leave" | "banner" | "stay";
222 /**
223 * Hardware ID of the beacon that was detected
224 */
225 hwid: string;
226 /**
227 * Device message of beacon that was detected.
228 *
229 * This message consists of data generated by the beacon to send notifications to bots.
230 * Only included in webhooks from devices that support the "device message" property.
231 * For more information, see the
232 * [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame).
233 */
234 dm?: string;
235 };
236};
237/**
238 * Event object for when a user has linked his/her LINE account with a provider's service account.
239 */
240export type AccountLinkEvent = ReplyableEvent & {
241 type: "accountLink";
242 link: {
243 result: "ok" | "failed";
244 /**
245 * Specified nonce when verifying the user ID
246 */
247 nonce: string;
248 };
249};
250/**
251 * Indicates that a LINE Things-compatible device has been linked with LINE by a user operation.
252 * For more information, see [Receiving device link events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#link-event).
253 */
254export type DeviceLinkEvent = ReplyableEvent & {
255 type: "things";
256 things: {
257 /**
258 * Device ID of the LINE Things-compatible device that was linked with LINE
259 */
260 deviceId: string;
261 type: "link";
262 };
263};
264/**
265 * Indicates that a LINE Things-compatible device has been unlinked from LINE by a user operation.
266 * For more information, see [Receiving device unlink events via webhook](https://developers.line.biz/en/docs/line-things/develop-bot/#unlink-event).
267 */
268export type DeviceUnlinkEvent = ReplyableEvent & {
269 type: "things";
270 things: {
271 /**
272 * Device ID of the LINE Things-compatible device that was unlinked with LINE
273 */
274 deviceId: string;
275 type: "unlink";
276 };
277};
278export type LINEThingsScenarioExecutionEvent = ReplyableEvent & {
279 type: "things";
280 things: {
281 type: "scenarioResult";
282 /**
283 * Device ID of the device that executed the scenario
284 */
285 deviceId: string;
286 result: {
287 /**
288 * Scenario ID executed
289 */
290 scenarioId: string;
291 /**
292 * Revision number of the scenario set containing the executed scenario
293 */
294 revision: number;
295 /**
296 * Timestamp for when execution of scenario action started (milliseconds, LINE app time)
297 */
298 startTime: number;
299 /**
300 * Timestamp for when execution of scenario was completed (milliseconds, LINE app time)
301 */
302 endtime: number;
303 /**
304 * Scenario execution completion status
305 * See also [things.resultCode definitions](https://developers.line.biz/en/reference/messaging-api/#things-resultcode).
306 */
307 resultCode: "success" | "gatt_error" | "runtime_error";
308 /**
309 * Execution result of individual operations specified in action
310 * Note that an array of actions specified in a scenario has the following characteristics
311 * - The actions defined in a scenario are performed sequentially, from top to bottom.
312 * - Each action produces some result when executed.
313 * Even actions that do not generate data, such as `SLEEP`, return an execution result of type `void`.
314 * The number of items in an action array may be 0.
315 *
316 * Therefore, things.actionResults has the following properties:
317 * - The number of items in the array matches the number of actions defined in the scenario.
318 * - The order of execution results matches the order in which actions are performed.
319 * That is, in a scenario set with multiple `GATT_READ` actions,
320 * the results are returned in the order in which each individual `GATT_READ` action was performed.
321 * - If 0 actions are defined in the scenario, the number of items in things.actionResults will be 0.
322 */
323 actionResults: Array<LINEThingsActionResult>;
324 /**
325 * Data contained in notification
326 * The value is Base64-encoded binary data.
327 * Only included for scenarios where `trigger.type = BLE_NOTIFICATION`.
328 */
329 bleNotificationPayload?: string;
330 /**
331 * Error reason
332 */
333 errorReason?: string;
334 };
335 };
336};
337export type LINEThingsActionResult = {
338 /**
339 * `void`, `binary`
340 * Depends on `type` of the executed action.
341 * This property is always included if `things.actionResults` is not empty.
342 */
343 type: "void" | "binary";
344 /**
345 * Base64-encoded binary data
346 * This property is always included when `things.actionResults[].type` is `binary`.
347 */
348 data?: string;
349};
350/**
351 * Completed Delivery Event
352 * @see {@link https://developers.line.biz/en/docs/partner-docs/line-notification-messages/message-sending-complete-webhook-event/#receive-delivery-event}
353 */
354export type DeliveryEvent = {
355 type: "delivery";
356 /** A delivery object containing a hashed phone number string or a string specified by X-Line-Delivery-Tag. */
357 delivery: Delivery;
358} & EventBase;
359type Delivery = {
360 /** A hashed phone number string or a string specified by X-Line-Delivery-Tag. */
361 data: string;
362};
363export type EventMessage = TextEventMessage | ImageEventMessage | VideoEventMessage | AudioEventMessage | LocationEventMessage | FileEventMessage | StickerEventMessage;
364export type EventMessageBase = {
365 id: string;
366};
367/**
368 * Message object which contains the text sent from the source.
369 */
370export type TextEventMessage = {
371 type: "text";
372 text: string;
373 /**
374 * Sendable LINE emojis
375 */
376 emojis?: {
377 index: number;
378 length: number;
379 productId: string;
380 emojiId: string;
381 }[];
382 /**
383 * Object containing the contents of the mentioned user.
384 */
385 mention?: {
386 /**
387 * Mentioned user information.
388 * Max: 20 mentions
389 */
390 mentionees: {
391 /**
392 * Index position of the user mention for a character in `text`,
393 * with the first character being at position 0.
394 */
395 index: number;
396 /**
397 * The length of the text of the mentioned user. For a mention `@example`,
398 * 8 is the length.
399 */
400 length: number;
401 /**
402 * Mentioned target.
403 *
404 * - `user`: User.
405 * - `all`: Entire group.
406 */
407 type: "user" | "all";
408 /**
409 * User ID of the mentioned user. Only included if mention.mentions[].type is user
410 * and the user consents to the LINE Official Account obtaining their user profile information.
411 */
412 userId?: string;
413 }[];
414 };
415 /**
416 * Message ID of a quoted message. Only included when the received message quotes a past message.
417 */
418 quotedMessageId?: string;
419} & QuotableMessage & EventMessageBase;
420export type ContentProvider<WithPreview extends boolean = true> = {
421 /**
422 * The content is provided by LINE.
423 *
424 * The data itself can be retrieved from the content API.
425 */
426 type: "line";
427} | {
428 /**
429 * The content is provided by a provider other than LINE
430 */
431 type: "external";
432 /**
433 * URL of the content. Only included when contentProvider.type is external.
434 */
435 originalContentUrl: string;
436 /**
437 * URL of the content preview. Only included when contentProvider.type is external.
438 *
439 * For contents without preview (e.g. audio), it's undefined.
440 */
441 previewImageUrl: WithPreview extends true ? string : undefined;
442};
443/**
444 * Message object which contains the image content sent from the source.
445 * The binary image data can be retrieved using Client#getMessageContent.
446 */
447export type ImageEventMessage = {
448 type: "image";
449 contentProvider: ContentProvider;
450 /**
451 * Object containing the number of images sent simultaneously.
452 */
453 imageSet?: {
454 /**
455 * Image set ID. Only included when multiple images are sent simultaneously.
456 */
457 id: string;
458 /**
459 * An index starting from 1, indicating the image number in a set of images sent simultaneously.
460 * Only included when multiple images are sent simultaneously.
461 * However, it won't be included if the sender is using LINE 11.15 or earlier for Android.
462 */
463 index: number;
464 /**
465 * The total number of images sent simultaneously.
466 * If two images are sent simultaneously, the number is 2.
467 * Only included when multiple images are sent simultaneously.
468 * However, it won't be included if the sender is using LINE 11.15 or earlier for Android.
469 */
470 total: number;
471 };
472} & QuotableMessage & EventMessageBase;
473/**
474 * Message object which contains the video content sent from the source.
475 * The binary video data can be retrieved using Client#getMessageContent.
476 */
477export type VideoEventMessage = {
478 type: "video";
479 contentProvider: ContentProvider;
480} & QuotableMessage & EventMessageBase;
481/**
482 * Message object which contains the audio content sent from the source.
483 * The binary audio data can be retrieved using Client#getMessageContent.
484 */
485export type AudioEventMessage = {
486 type: "audio";
487 duration: number;
488 contentProvider: ContentProvider<false>;
489} & EventMessageBase;
490/**
491 * Message object which contains the file sent from the source.
492 * The binary data can be retrieved using Client#getMessageContent.
493 */
494export type FileEventMessage = {
495 type: "file";
496 fileName: string;
497 fileSize: string;
498} & EventMessageBase;
499/**
500 * Message object which contains the location data sent from the source.
501 */
502export type LocationEventMessage = {
503 type: "location";
504 title: string;
505 address: string;
506 latitude: number;
507 longitude: number;
508} & EventMessageBase;
509/**
510 * Message object which contains the sticker data sent from the source.
511 * For a list of basic LINE stickers and sticker IDs, see
512 * [sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
513 */
514export type StickerEventMessage = {
515 type: "sticker";
516 packageId: string;
517 stickerId: string;
518 stickerResourceType: "STATIC" | "ANIMATION" | "SOUND" | "ANIMATION_SOUND" | "POPUP" | "POPUP_SOUND" | "CUSTOM" | "MESSAGE";
519 keywords: string[];
520 /**
521 * Any text entered by the user. This property is only included for message stickers.
522 * Max character limit: 100
523 */
524 text?: string;
525 /**
526 * Message ID of a quoted message. Only included when the received message quotes a past message.
527 */
528 quotedMessageId?: string;
529} & QuotableMessage & EventMessageBase;
530export type Postback = {
531 data: string;
532 params?: DateTimePostback | RichMenuSwitchPostback;
533};
534/**
535 * Object with the date and time selected by a user through a
536 * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
537 * Only returned for postback actions via a
538 * [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
539 * The `full-date`, `time-hour`, and `time-minute` formats follow the
540 * [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt).
541 */
542type DateTimePostback = {
543 /**
544 * Date selected by user. Only included in the `date` mode.
545 */
546 date?: string;
547 /**
548 * Time selected by the user. Only included in the `time` mode.
549 */
550 time?: string;
551 /**
552 * Date and time selected by the user. Only included in the `datetime` mode.
553 */
554 datetime?: string;
555};
556/**
557 * Object with rich menu alias ID selected by user via rich menu switch action.
558 * https://developers.line.biz/en/reference/messaging-api/#postback-params-object-for-richmenu-switch-action
559 */
560type RichMenuSwitchPostback = {
561 newRichMenuAliasId: string;
562 status: "SUCCESS" | "RICHMENU_ALIAS_ID_NOTFOUND" | "RICHMENU_NOTFOUND" | "FAILED";
563};
564/**
565 * JSON object which contains the contents of the message you send.
566 *
567 * @see [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
568 */
569export type Message = TextMessage | ImageMessage | VideoMessage | AudioMessage | LocationMessage | StickerMessage | ImageMapMessage | TemplateMessage | FlexMessage;
570/**
571 * @see [Common properties for messages](https://developers.line.biz/en/reference/messaging-api/#common-properties-for-messages)
572 */
573export type MessageCommon = {
574 /**
575 * For the quick reply feature.
576 * For more information, see [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
577 *
578 * If the user receives multiple
579 * [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects),
580 * the quickReply property of the last message object is displayed.
581 */
582 quickReply?: QuickReply;
583 /**
584 * [Change icon and display name](https://developers.line.biz/en/docs/messaging-api/icon-nickname-switch/)
585 *
586 * When sending a message from the LINE Official Account, you can specify the `sender.name` and the `sender.iconUrl` properties in [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects).
587 */
588 sender?: Sender;
589};
590type QuotableMessage = {
591 /**
592 * Quote token to quote this message.
593 */
594 quoteToken: string;
595};
596type CanQuoteMessage = {
597 /**
598 * Quote token of the message you want to quote.
599 */
600 quoteText?: string;
601};
602/**
603 * @see [Text message](https://developers.line.biz/en/reference/messaging-api/#text-message)
604 */
605export type TextMessage = MessageCommon & CanQuoteMessage & {
606 type: "text";
607 /**
608 * Message text. You can include the following emoji:
609 *
610 * - LINE emojis. Use a $ character as a placeholder and specify the product ID and emoji ID of the LINE emoji you want to use in the emojis property.
611 * - Unicode emoji
612 * - (Deprecated) LINE original unicode emojis
613 * ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
614 *
615 * Max: 5000 characters
616 */
617 text: string;
618 /**
619 * One or more LINE emoji.
620 *
621 * Max: 20 LINE emoji
622 */
623 emojis?: {
624 index: number;
625 productId: string;
626 emojiId: string;
627 }[];
628};
629/**
630 * @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
631 */
632export type ImageMessage = MessageCommon & {
633 type: "image";
634 /**
635 * Image URL (Max: 2000 characters)
636 *
637 * - **HTTPS**
638 * - JPEG
639 * - Max: 1024 x 1024
640 * - Max: 1 MB
641 */
642 originalContentUrl: string;
643 /**
644 * Preview image URL (Max: 2000 characters)
645 *
646 * - **HTTPS**
647 * - JPEG
648 * - Max: 240 x 240
649 * - Max: 1 MB
650 */
651 previewImageUrl: string;
652};
653/**
654 * @see [Video message](https://developers.line.biz/en/reference/messaging-api/#video-message)
655 */
656export type VideoMessage = MessageCommon & {
657 type: "video";
658 /**
659 * URL of video file (Max: 2000 characters)
660 *
661 * - **HTTPS**
662 * - mp4
663 * - Max: 1 minute
664 * - Max: 10 MB
665 *
666 * A very wide or tall video may be cropped when played in some environments.
667 */
668 originalContentUrl: string;
669 /**
670 * URL of preview image (Max: 2000 characters)
671 *
672 * - **HTTPS**
673 * - JPEG
674 * - Max: 240 x 240
675 * - Max: 1 MB
676 */
677 previewImageUrl: string;
678};
679/**
680 * @see [Audio message](https://developers.line.biz/en/reference/messaging-api/#audio-message)
681 */
682export type AudioMessage = MessageCommon & {
683 type: "audio";
684 /**
685 * URL of audio file (Max: 2000 characters)
686 *
687 * - **HTTPS**
688 * - m4a
689 * - Max: 1 minute
690 * - Max: 10 MB
691 */
692 originalContentUrl: string;
693 /**
694 * Length of audio file (milliseconds)
695 */
696 duration: number;
697};
698/**
699 * @see [Location message](https://developers.line.biz/en/reference/messaging-api/#location-message)
700 */
701export type LocationMessage = MessageCommon & {
702 type: "location";
703 /**
704 * Title (Max: 100 characters)
705 */
706 title: string;
707 /**
708 * Address (Max: 100 characters)
709 */
710 address: string;
711 latitude: number;
712 longitude: number;
713};
714/**
715 * @see [Sticker message](https://developers.line.biz/en/reference/messaging-api/#sticker-message)
716 */
717export type StickerMessage = MessageCommon & CanQuoteMessage & {
718 type: "sticker";
719 /**
720 * Package ID for a set of stickers.
721 * For information on package IDs, see the
722 * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
723 */
724 packageId: string;
725 /**
726 * Sticker ID.
727 * For a list of sticker IDs for stickers that can be sent with the Messaging
728 * API, see the
729 * [Sticker list](https://developers.line.biz/media/messaging-api/sticker_list.pdf).
730 */
731 stickerId: string;
732};
733/**
734 * @see [Imagemap message](https://developers.line.biz/en/reference/messaging-api/#imagemap-message)
735 */
736export type ImageMapMessage = MessageCommon & {
737 type: "imagemap";
738 /**
739 * [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
740 * (Max: 2000 characters, **HTTPS**)
741 */
742 baseUrl: string;
743 /**
744 * Alternative text (Max: 400 characters)
745 */
746 altText: string;
747 baseSize: Size;
748 /**
749 * Video to play inside a image map messages
750 */
751 video?: {
752 /**
753 * URL of video file (Max: 2000 characters)
754 *
755 * - **HTTPS**
756 * - mp4
757 * - Max: 1 minute
758 * - Max: 10 MB
759 *
760 * A very wide or tall video may be cropped when played in some environments.
761 */
762 originalContentUrl: string;
763 /**
764 * URL of preview image (Max: 2000 characters)
765 *
766 * - **HTTPS**
767 * - JPEG
768 * - Max: 240 x 240
769 * - Max: 1 MB
770 */
771 previewImageUrl: string;
772 area: Area;
773 /**
774 * External link to be displayed after a video is played
775 * This property is required if you set a video to play and a label to display after the video on the imagemap
776 */
777 externalLink?: {
778 linkUri: string;
779 label: string;
780 };
781 };
782 /**
783 * Action when tapped (Max: 50)
784 */
785 actions: ImageMapAction[];
786};
787/**
788 * Template messages are messages with predefined layouts which you can
789 * customize. For more information, see
790 * [template messages](https://developers.line.biz/en/docs/messaging-api/message-types/#template-messages).
791 *
792 * The following template types are available:
793 *
794 * - [Buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)
795 * - [Confirm](https://developers.line.biz/en/reference/messaging-api/#confirm)
796 * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)
797 * - [Image carousel](https://developers.line.biz/en/reference/messaging-api/#image-carousel)
798 *
799 * @see [Template messages](https://developers.line.biz/en/reference/messaging-api/#template-messages)
800 */
801export type TemplateMessage = MessageCommon & {
802 type: "template";
803 /**
804 * Alternative text (Max: 400 characters)
805 */
806 altText: string;
807 /**
808 * Carousel template content
809 */
810 template: TemplateContent;
811};
812/**
813 * Flex Messages are messages with a customizable layout.
814 * You can customize the layout freely by combining multiple elements.
815 * For more information, see
816 * [Using Flex Messages](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/).
817 *
818 * @see [Flex messages](https://developers.line.biz/en/reference/messaging-api/#flex-message)
819 */
820export type FlexMessage = MessageCommon & {
821 type: "flex";
822 altText: string;
823 contents: FlexContainer;
824};
825/**
826 * Object which specifies the actions and tappable regions of an imagemap.
827 *
828 * When a region is tapped, the user is redirected to the URI specified in
829 * `uri` and the message specified in `message` is sent.
830 *
831 * @see [Imagemap action objects](https://developers.line.biz/en/reference/messaging-api/#imagemap-action-objects)
832 */
833export type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
834export type ImageMapActionBase = {
835 /**
836 * Spoken when the accessibility feature is enabled on the client device. (Max: 50 characters)
837 * Supported on LINE 8.2.0 and later for iOS.
838 */
839 label?: string;
840 /** Defined tappable area */
841 area: Area;
842};
843export type ImageMapURIAction = {
844 type: "uri";
845 /**
846 * Webpage URL (Max: 1000 characters)
847 */
848 linkUri: string;
849} & ImageMapActionBase;
850export type ImageMapMessageAction = {
851 type: "message";
852 /**
853 * Message to send (Max: 400 characters)
854 */
855 text: string;
856} & ImageMapActionBase;
857export type Area = {
858 /**
859 * Horizontal position relative to the top-left corner of the area
860 */
861 x: number;
862 /**
863 * Vertical position relative to the top-left corner of the area
864 */
865 y: number;
866 /**
867 * Width of the tappable area
868 */
869 width: number;
870 /**
871 * Height of the tappable area
872 */
873 height: number;
874};
875/**
876 * A container is the top-level structure of a Flex Message. Here are the types of containers available.
877 *
878 * - [Bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
879 * - [Carousel](https://developers.line.biz/en/reference/messaging-api/#f-carousel)
880 *
881 * See [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
882 * for the containers' JSON data samples and usage.
883 */
884export type FlexContainer = FlexBubble | FlexCarousel;
885/**
886 * This is a container that contains one message bubble. It can contain four
887 * blocks: header, hero, body, and footer.
888 *
889 * For more information about using each block, see
890 * [Block](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#block).
891 */
892export type FlexBubble = {
893 type: "bubble";
894 size?: "nano" | "micro" | "kilo" | "mega" | "giga";
895 /**
896 * Text directionality and the order of components in horizontal boxes in the
897 * container. Specify one of the following values:
898 *
899 * - `ltr`: Left to right
900 * - `rtl`: Right to left
901 *
902 * The default value is `ltr`.
903 */
904 direction?: "ltr" | "rtl";
905 header?: FlexBox;
906 hero?: FlexBox | FlexImage | FlexVideo;
907 body?: FlexBox;
908 footer?: FlexBox;
909 styles?: FlexBubbleStyle;
910 action?: Action;
911};
912export type FlexBubbleStyle = {
913 header?: FlexBlockStyle;
914 hero?: FlexBlockStyle;
915 body?: FlexBlockStyle;
916 footer?: FlexBlockStyle;
917};
918export type FlexBlockStyle = {
919 /**
920 * Background color of the block. Use a hexadecimal color code.
921 */
922 backgroundColor?: string;
923 /**
924 * - `true` to place a separator above the block.
925 * - `true` will be ignored for the first block in a container because you
926 * cannot place a separator above the first block.
927 * - The default value is `false`.
928 */
929 separator?: boolean;
930 /**
931 * Color of the separator. Use a hexadecimal color code.
932 */
933 separatorColor?: string;
934};
935export type FlexCarousel = {
936 type: "carousel";
937 /**
938 * (Max: 12 bubbles)
939 */
940 contents: FlexBubble[];
941};
942/**
943 * Components are objects that compose a Flex Message container. Here are the
944 * types of components available:
945 *
946 * - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
947 * - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
948 * - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
949 * - [Video](https://developers.line.biz/en/reference/messaging-api/#f-video)
950 * - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
951 * - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
952 * - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
953 * - [Separator](https://developers.line.biz/en/reference/messaging-api/#separator)
954 * - [Filler](https://developers.line.biz/en/reference/messaging-api/#filler)
955 * - [Spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
956 *
957 * See the followings for the components' JSON data samples and usage.
958 *
959 * - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
960 * - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
961 */
962export type FlexComponent = FlexBox | FlexButton | FlexImage | FlexVideo | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer;
963/**
964 * This is a component that defines the layout of child components.
965 * You can also include a box in a box.
966 */
967export type FlexBox = {
968 type: "box";
969 /**
970 * The placement style of components in this box. Specify one of the following values:
971 *
972 * - `horizontal`: Components are placed horizontally. The `direction`
973 * property of the [bubble](https://developers.line.biz/en/reference/messaging-api/#bubble)
974 * container specifies the order.
975 * - `vertical`: Components are placed vertically from top to bottom.
976 * - `baseline`: Components are placed in the same way as `horizontal` is
977 * specified except the baselines of the components are aligned.
978 *
979 * For more information, see
980 * [Types of box layouts](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-layout-types).
981 */
982 layout: "horizontal" | "vertical" | "baseline";
983 /**
984 * Components in this box. Here are the types of components available:
985 *
986 * - When the `layout` property is `horizontal` or `vertical`:
987 * + [Box](https://developers.line.biz/en/reference/messaging-api/#box)
988 * + [button](https://developers.line.biz/en/reference/messaging-api/#button)
989 * + [image](https://developers.line.biz/en/reference/messaging-api/#f-image)
990 * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
991 * + [separator](https://developers.line.biz/en/reference/messaging-api/#separator)
992 * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
993 * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
994 * - When the `layout` property is `baseline`:
995 * + [icon](https://developers.line.biz/en/reference/messaging-api/#icon)
996 * + [text](https://developers.line.biz/en/reference/messaging-api/#f-text)
997 * + [filler](https://developers.line.biz/en/reference/messaging-api/#filler)
998 * + [spacer (not recommended)](https://developers.line.biz/en/reference/messaging-api/#spacer)
999 */
1000 contents: FlexComponent[];
1001 /**
1002 * Background color of the block. In addition to the RGB color, an alpha
1003 * channel (transparency) can also be set. Use a hexadecimal color code.
1004 * (Example:#RRGGBBAA) The default value is `#00000000`.
1005 */
1006 backgroundColor?: string;
1007 /**
1008 * Color of box border. Use a hexadecimal color code.
1009 */
1010 borderColor?: string;
1011 /**
1012 * Width of box border. You can specify a value in pixels or any one of none,
1013 * light, normal, medium, semi-bold, or bold. none does not render a border
1014 * while the others become wider in the order of listing.
1015 */
1016 borderWidth?: string | "none" | "light" | "normal" | "medium" | "semi-bold" | "bold";
1017 /**
1018 * Radius at the time of rounding the corners of the border. You can specify a
1019 * value in pixels or any one of `none`, `xs`, `sm`, `md`, `lg`, `xl`, or `xxl`. none does not
1020 * round the corner while the others increase in radius in the order of listing. The default value is none.
1021 */
1022 cornerRadius?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1023 /**
1024 * Width of the box. For more information, see [Width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-width) in the API documentation.
1025 */
1026 width?: string;
1027 /**
1028 * Max width of the box. For more information, see [Max width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-max-width) in the API documentation.
1029 */
1030 maxWidth?: string;
1031 /**
1032 * Height of the box. For more information, see [Height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-height) in the API documentation.
1033 */
1034 height?: string;
1035 /**
1036 * Max height of the box. For more information, see [Max height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-max-height) in the API documentation.
1037 */
1038 maxHeight?: string;
1039 /**
1040 * The ratio of the width or height of this box within the parent box. The
1041 * default value for the horizontal parent box is `1`, and the default value
1042 * for the vertical parent box is `0`.
1043 *
1044 * For more information, see
1045 * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1046 */
1047 flex?: number;
1048 /**
1049 * Minimum space between components in this box.
1050 *
1051 * - `none` does not set a space while the other values set a space whose
1052 * size increases in the order of listing.
1053 * - The default value is `none`.
1054 * - To override this setting for a specific component, set the `margin`
1055 * property of that component.
1056 */
1057 spacing?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1058 /**
1059 * Minimum space between this box and the previous component in the parent box.
1060 *
1061 * - `none` does not set a space while the other values set a space whose
1062 * size increases in the order of listing.
1063 * - The default value is the value of the `spacing` property of the parent
1064 * box.
1065 * - If this box is the first component in the parent box, the `margin`
1066 * property will be ignored.
1067 */
1068 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1069 /**
1070 * Free space between the borders of this box and the child element.
1071 * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
1072 */
1073 paddingAll?: string;
1074 /**
1075 * Free space between the border at the upper end of this box and the upper end of the child element.
1076 * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
1077 */
1078 paddingTop?: string;
1079 /**
1080 * Free space between the border at the lower end of this box and the lower end of the child element.
1081 * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
1082 */
1083 paddingBottom?: string;
1084 /**
1085 * Free space between the border at the left end of this box and the left end of the child element.
1086 * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
1087 */
1088 paddingStart?: string;
1089 /**
1090 * Free space between the border at the right end of this box and the right end of the child element.
1091 * For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
1092 */
1093 paddingEnd?: string;
1094 /**
1095 * Action performed when this button is tapped.
1096 *
1097 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1098 */
1099 action?: Action;
1100 /**
1101 * How child elements are aligned along the main axis of the parent element. If the
1102 * parent element is a horizontal box, this only takes effect when its child elements have
1103 * their `flex` property set equal to 0. For more information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property)
1104 * in the Messaging API documentation.
1105 */
1106 justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
1107 /**
1108 * How child elements are aligned along the cross axis of the parent element. For more
1109 * information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property) in the Messaging API documentation.
1110 */
1111 alignItems?: "flex-start" | "center" | "flex-end";
1112 background?: Background;
1113} & Offset;
1114export type Offset = {
1115 /**
1116 * Reference position for placing this box. Specify one of the following values:
1117 * - `relative`: Use the previous box as reference.
1118 * - `absolute`: Use the top left of parent element as reference.
1119 *
1120 * The default value is relative.
1121 * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1122 */
1123 position?: "relative" | "absolute";
1124 /**
1125 * The top offset.
1126 * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1127 */
1128 offsetTop?: string;
1129 /**
1130 * The bottom offset.
1131 * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1132 */
1133 offsetBottom?: string;
1134 /**
1135 * The left offset.
1136 * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1137 */
1138 offsetStart?: string;
1139 /**
1140 * The right offset.
1141 * For more information, see [Offset](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-offset) in the API documentation.
1142 */
1143 offsetEnd?: string;
1144};
1145export type Background = {
1146 /**
1147 * The type of background used. Specify these values:
1148 * - `linearGradient`: Linear gradient. For more information, see [Linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg) in the Messaging API documentation.
1149 */
1150 type: "linearGradient";
1151 /**
1152 * The angle at which a linear gradient moves. Specify the angle using an integer value
1153 * like `90deg` (90 degrees) or a decimal number like `23.5deg` (23.5 degrees) in the
1154 * half-open interval [0, 360). The direction of the linear gradient rotates clockwise as the
1155 * angle increases. Given a value of `0deg`, the gradient starts at the bottom and ends at
1156 * the top; given a value of `45deg`, the gradient starts at the bottom-left corner and ends
1157 * at the top-right corner; given a value of 90deg, the gradient starts at the left and ends
1158 * at the right; and given a value of `180deg`, the gradient starts at the top and ends at
1159 * the bottom. For more information, see [Direction (angle) of linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-angle) in the Messaging API documentation.
1160 */
1161 angle: string;
1162 /**
1163 * The color at the gradient's starting point. Use a hexadecimal color code in the
1164 * `#RRGGBB` or `#RRGGBBAA` format.
1165 */
1166 startColor: string;
1167 /**
1168 * The color at the gradient's ending point. Use a hexadecimal color code in the
1169 * `#RRGGBB` or `#RRGGBBAA` format.
1170 */
1171 endColor: string;
1172 /**
1173 * The color in the middle of the gradient. Use a hexadecimal color code in the `#RRGGBB`
1174 * or `#RRGGBBAA` format. Specify a value for the `background.centerColor` property to
1175 * create a gradient that has three colors. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1176 * Messaging API documentation.
1177 */
1178 centerColor?: string;
1179 /**
1180 * The position of the intermediate color stop. Specify an integer or decimal value
1181 * between `0%` (the starting point) and `100%` (the ending point). This is `50%` by
1182 * default. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1183 * Messaging API documentation.
1184 */
1185 centerPosition?: string;
1186};
1187/**
1188 * This component draws a button.
1189 *
1190 * When the user taps a button, a specified action is performed.
1191 */
1192export type FlexButton = {
1193 type: "button";
1194 /**
1195 * Action performed when this button is tapped.
1196 *
1197 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1198 */
1199 action: Action;
1200 /**
1201 * The ratio of the width or height of this box within the parent box.
1202 *
1203 * The default value for the horizontal parent box is `1`, and the default
1204 * value for the vertical parent box is `0`.
1205 *
1206 * For more information, see
1207 * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1208 */
1209 flex?: number;
1210 /**
1211 * Minimum space between this box and the previous component in the parent box.
1212 *
1213 * - `none` does not set a space while the other values set a space whose
1214 * size increases in the order of listing.
1215 * - The default value is the value of the `spacing` property of the parent
1216 * box.
1217 * - If this box is the first component in the parent box, the `margin`
1218 * property will be ignored.
1219 */
1220 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1221 /**
1222 * Height of the button. The default value is `md`.
1223 */
1224 height?: "sm" | "md";
1225 /**
1226 * Style of the button. Specify one of the following values:
1227 *
1228 * - `link`: HTML link style
1229 * - `primary`: Style for dark color buttons
1230 * - `secondary`: Style for light color buttons
1231 *
1232 * The default value is `link`.
1233 */
1234 style?: "link" | "primary" | "secondary";
1235 /**
1236 * Use a hexadecimal color code.
1237 *
1238 * - Character color when the `style` property is `link`.
1239 * - Background color when the `style` property is `primary` or `secondary`.
1240 */
1241 color?: string;
1242 /**
1243 * Vertical alignment style. Specify one of the following values:
1244 *
1245 * - `top`: Top-aligned
1246 * - `bottom`: Bottom-aligned
1247 * - `center`: Center-aligned
1248 *
1249 * The default value is `top`.
1250 *
1251 * If the `layout` property of the parent box is `baseline`, the `gravity`
1252 * property will be ignored.
1253 */
1254 gravity?: "top" | "bottom" | "center";
1255 /**
1256 * The method by which to adjust the text font size. Specify this value:
1257 *
1258 * - `shrink-to-fit`: Automatically shrink the font
1259 * size to fit the width of the component. This
1260 * property takes a "best-effort" approach that may
1261 * work differently—or not at all!—on some platforms.
1262 * For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1263 * in the Messaging API documentation.
1264 * - LINE 10.13.0 or later for iOS and Android
1265 */
1266 adjustMode?: "shrink-to-fit";
1267} & Offset;
1268/**
1269 * This is an invisible component to fill extra space between components.
1270 *
1271 * - The filler's `flex` property is fixed to 1.
1272 * - The `spacing` property of the parent box will be ignored for fillers.
1273 */
1274export type FlexFiller = {
1275 type: "filler";
1276 /**
1277 * The ratio of the width or height of this component within the parent box. For more information, see [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1278 */
1279 flex?: number;
1280};
1281/**
1282 * This component draws an icon.
1283 */
1284export type FlexIcon = {
1285 type: "icon";
1286 /**
1287 * Image URL (Max character limit: 2000)
1288 *
1289 * Protocol: HTTPS
1290 * Image format: JPEG or PNG
1291 * Maximum image size: 240×240 pixels
1292 * Maximum data size: 1 MB
1293 */
1294 url: string;
1295 /**
1296 * Minimum space between this box and the previous component in the parent
1297 * box.
1298 *
1299 * - `none` does not set a space while the other values set a space whose
1300 * size increases in the order of listing.
1301 * - The default value is the value of the `spacing` property of the parent
1302 * box.
1303 * - If this box is the first component in the parent box, the `margin`
1304 * property will be ignored.
1305 */
1306 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1307 /**
1308 * Maximum size of the icon width.
1309 * The size increases in the order of listing.
1310 * The default value is `md`.
1311 * For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
1312 */
1313 size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
1314 /**
1315 * Aspect ratio of the icon. `{width}:{height}` format.
1316 * The values of `{width}` and `{height}` must be in the range 1–100000.
1317 * `{height}` can't be more than three times the value of `{width}`.
1318 * The default value is `1:1`.
1319 */
1320 aspectRatio?: string;
1321} & Offset;
1322/**
1323 * This component draws an image.
1324 */
1325export type FlexImage = {
1326 type: "image";
1327 /**
1328 * Image URL (Max character limit: 2000)
1329 *
1330 * - Protocol: HTTPS
1331 * - Image format: JPEG or PNG
1332 * - Maximum image size: 1024×1024 pixels
1333 * - Maximum data size: 1 MB
1334 */
1335 url: string;
1336 /**
1337 * The ratio of the width or height of this box within the parent box.
1338 *
1339 * The default value for the horizontal parent box is `1`, and the default
1340 * value for the vertical parent box is `0`.
1341 *
1342 * - For more information, see
1343 * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1344 */
1345 flex?: number;
1346 /**
1347 * Minimum space between this box and the previous component in the parent
1348 * box.
1349 *
1350 * - `none` does not set a space while the other values set a space whose
1351 * size increases in the order of listing.
1352 * - The default value is the value of the `spacing` property of the parent
1353 * box.
1354 * - If this box is the first component in the parent box, the `margin`
1355 * property will be ignored.
1356 */
1357 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1358 /**
1359 * Horizontal alignment style. Specify one of the following values:
1360 *
1361 * - `start`: Left-aligned
1362 * - `end`: Right-aligned
1363 * - `center`: Center-aligned
1364 *
1365 * The default value is `center`.
1366 */
1367 align?: "start" | "end" | "center";
1368 /**
1369 * Vertical alignment style. Specify one of the following values:
1370 *
1371 * - `top`: Top-aligned
1372 * - `bottom`: Bottom-aligned
1373 * - `center`: Center-aligned
1374 *
1375 * The default value is `top`.
1376 *
1377 * If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored.
1378 */
1379 gravity?: "top" | "bottom" | "center";
1380 /**
1381 * Maximum size of the image width.
1382 * The size increases in the order of listing.
1383 * The default value is `md`.
1384 * For more information, see [Image size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#image-size) in the Messaging API documentation.
1385 */
1386 size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full";
1387 /**
1388 * Aspect ratio of the image. `{width}:{height}` format.
1389 * Specify the value of `{width}` and `{height}` in the range from 1 to 100000. However,
1390 * you cannot set `{height}` to a value that is more than three times the value of `{width}`.
1391 * The default value is `1:1`.
1392 */
1393 aspectRatio?: string;
1394 /**
1395 * Style of the image. Specify one of the following values:
1396 *
1397 * - `cover`: The image fills the entire drawing area. Parts of the image
1398 * that do not fit in the drawing area are not displayed.
1399 * - `fit`: The entire image is displayed in the drawing area. The background
1400 * is displayed in the unused areas to the left and right of vertical images
1401 * and in the areas above and below horizontal images.
1402 *
1403 * The default value is `fit`.
1404 */
1405 aspectMode?: "cover" | "fit";
1406 /**
1407 * Background color of the image. Use a hexadecimal color code.
1408 */
1409 backgroundColor?: string;
1410 /**
1411 * Action performed when this button is tapped.
1412 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1413 */
1414 action?: Action;
1415 /**
1416 * When this is `true`, an animated image (APNG) plays.
1417 * You can specify a value of `true` up to three times in a single message.
1418 * You can't send messages that exceed this limit.
1419 * This is `false` by default.
1420 * Animated images larger than 300 KB aren't played back.
1421 */
1422 animated?: Boolean;
1423} & Offset;
1424/**
1425 * This component draws a video.
1426 */
1427export type FlexVideo = {
1428 type: "video";
1429 /**
1430 * Video file URL (Max character limit: 2000)
1431 *
1432 * - Protocol: HTTPS (TLS 1.2 or later)
1433 * - Video format: mp4
1434 * - Maximum data size: 200 MB
1435 */
1436 url: string;
1437 /**
1438 * Preview image URL (Max character limit: 2000)
1439 *
1440 * - Protocol: HTTPS (TLS 1.2 or later)
1441 * - Image format: JPEG or PNG
1442 * - Maximum data size: 1 MB
1443 */
1444 previewUrl: string;
1445 /**
1446 * Alternative content.
1447 *
1448 * The alternative content will be displayed on the screen of a user device
1449 * that is using a version of LINE that doesn't support the video component.
1450 * Specify a box or an image.
1451 *
1452 * - Protocol: HTTPS (TLS 1.2 or later)
1453 * - Image format: JPEG or PNG
1454 * - Maximum data size: 1 MB
1455 */
1456 altContent: FlexBox | FlexImage;
1457 /**
1458 * Aspect ratio of the video. `{width}:{height}` format.
1459 * Specify the value of `{width}` and `{height}` in the range from 1 to 100000. However,
1460 * you cannot set `{height}` to a value that is more than three times the value of `{width}`.
1461 * The default value is `1:1`.
1462 */
1463 aspectRatio?: string;
1464 /**
1465 * Action performed when this button is tapped.
1466 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1467 */
1468 action?: Action;
1469};
1470/**
1471 * This component draws a separator between components in the parent box.
1472 */
1473export type FlexSeparator = {
1474 type: "separator";
1475 /**
1476 * Minimum space between this box and the previous component in the parent
1477 * box.
1478 *
1479 * - `none` does not set a space while the other values set a space whose
1480 * size increases in the order of listing.
1481 * - The default value is the value of the `spacing` property of the parent
1482 * box.
1483 * - If this box is the first component in the parent box, the `margin`
1484 * property will be ignored.
1485 */
1486 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1487 /**
1488 * Color of the separator. Use a hexadecimal color code.
1489 */
1490 color?: string;
1491};
1492/**
1493 * This is an invisible component that places a fixed-size space at the
1494 * beginning or end of the box.
1495 * @deprecated
1496 */
1497export type FlexSpacer = {
1498 type: "spacer";
1499 /**
1500 * Size of the space.
1501 * The size increases in the order of listing.
1502 * The default value is `md`.
1503 */
1504 size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1505};
1506type FlexTextBase = {
1507 type: "text";
1508 /**
1509 * The method by which to adjust the text font size. Specify this value:
1510 *
1511 * - `shrink-to-fit`: Automatically shrink the font
1512 * size to fit the width of the component. This
1513 * property takes a "best-effort" approach that may
1514 * work differently—or not at all!—on some platforms.
1515 * For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1516 * in the Messaging API documentation.
1517 * - LINE 10.13.0 or later for iOS and Android
1518 */
1519 adjustMode?: "shrink-to-fit";
1520 /**
1521 * The ratio of the width or height of this box within the parent box.
1522 *
1523 * The default value for the horizontal parent box is `1`, and the default
1524 * value for the vertical parent box is `0`.
1525 *
1526 * For more information, see
1527 * [Width and height of components](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#component-width-and-height).
1528 */
1529 flex?: number;
1530 /**
1531 * Minimum space between this box and the previous component in the parent
1532 * box.
1533 *
1534 * - `none` does not set a space while the other values set a space whose
1535 * size increases in the order of listing.
1536 * - The default value is the value of the `spacing` property of the parent
1537 * box.
1538 * - If this box is the first component in the parent box, the `margin`
1539 * property will be ignored.
1540 */
1541 margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
1542 /**
1543 * Font size.
1544 * The size increases in the order of listing.
1545 * The default value is `md`.
1546 * For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
1547 */
1548 size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
1549 /**
1550 * Horizontal alignment style. Specify one of the following values:
1551 *
1552 * - `start`: Left-aligned
1553 * - `end`: Right-aligned
1554 * - `center`: Center-aligned
1555 *
1556 * The default value is `start`.
1557 */
1558 align?: "start" | "end" | "center";
1559 /**
1560 * Vertical alignment style. Specify one of the following values:
1561 *
1562 * - `top`: Top-aligned
1563 * - `bottom`: Bottom-aligned
1564 * - `center`: Center-aligned
1565 *
1566 * The default value is `top`.
1567 *
1568 * If the `layout` property of the parent box is `baseline`, the `gravity`
1569 * property will be ignored.
1570 */
1571 gravity?: "top" | "bottom" | "center";
1572 /**
1573 * `true` to wrap text.
1574 *
1575 * The default value is `false`.
1576 *
1577 * If set to `true`, you can use a new line character (\n) to begin on a new
1578 * line.
1579 */
1580 wrap?: boolean;
1581 /**
1582 * Line spacing in a wrapping text.
1583 *
1584 * Specify a positive integer or decimal number that ends in px.
1585 * The `lineSpacing` property doesn't apply to the top of the start line and the bottom of the last line.
1586 * For more information, see [Increase the line spacing in a text](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#text-line-spacing) in the Messaging API documentation.
1587 */
1588 lineSpacing?: string;
1589 /**
1590 * Max number of lines. If the text does not fit in the specified number of
1591 * lines, an ellipsis (…) is displayed at the end of the last line. If set to
1592 * 0, all the text is displayed. The default value is 0.
1593 */
1594 maxLines?: number;
1595 /**
1596 * Font weight.
1597 * Specifying `bold`makes the font bold.
1598 * The default value is `regular`.
1599 */
1600 weight?: "regular" | "bold";
1601 /**
1602 * Font color. Use a hexadecimal color code.
1603 */
1604 color?: string;
1605 /**
1606 * Action performed when this text is tapped.
1607 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1608 */
1609 action?: Action;
1610 /**
1611 * Style of the text. Specify one of the following values:
1612 * - `normal`: Normal
1613 * - `italic`: Italic
1614 *
1615 * The default value is `normal`.
1616 */
1617 style?: string;
1618 /**
1619 * Decoration of the text. Specify one of the following values:
1620 * `none`: No decoration
1621 * `underline`: Underline
1622 * `line-through`: Strikethrough
1623 *
1624 * The default value is `none`.
1625 */
1626 decoration?: string;
1627};
1628type FlexTextWithText = FlexTextBase & {
1629 text: string;
1630 contents?: never;
1631};
1632type FlexTextWithContents = FlexTextBase & {
1633 /**
1634 * Array of spans. Be sure to set either one of the `text` property or `contents` property. If you set the `contents` property, `text` is ignored.
1635 */
1636 contents: FlexSpan[];
1637 text?: never;
1638};
1639export type FlexText = (FlexTextWithText | FlexTextWithContents) & Offset;
1640/**
1641 * 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](https://developers.line.biz/en/reference/messaging-api/#f-text).
1642 */
1643export type FlexSpan = {
1644 type: "span";
1645 /**
1646 * Text. 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.
1647 */
1648 text: string;
1649 /**
1650 * Font color. Use a hexadecimal color code.
1651 */
1652 color?: string;
1653 /**
1654 * 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`.
1655 * For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
1656 */
1657 size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
1658 /**
1659 * Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
1660 */
1661 weight?: string;
1662 /**
1663 * Style of the text. Specify one of the following values:
1664 * - `normal`: Normal
1665 * - `italic`: Italic
1666 *
1667 * The default value is `normal`.
1668 */
1669 style?: string;
1670 /**
1671 * Decoration of the text. Specify one of the following values:
1672 * `none`: No decoration
1673 * `underline`: Underline
1674 * `line-through`: Strikethrough
1675 *
1676 * The default value is `none`.
1677 *
1678 * Note: The decoration set in the `decoration` property of the [text](https://developers.line.biz/en/reference/messaging-api/#f-text) cannot be overwritten by the `decoration` property of the span.
1679 */
1680 decoration?: string;
1681};
1682export type TemplateContent = TemplateButtons | TemplateConfirm | TemplateCarousel | TemplateImageCarousel;
1683/**
1684 * Template with an image, title, text, and multiple action buttons.
1685 *
1686 * Because of the height limitation for buttons template messages, the lower
1687 * part of the text display area will get cut off if the height limitation is
1688 * exceeded. For this reason, depending on the character width, the message
1689 * text may not be fully displayed even when it is within the character limits.
1690 */
1691export type TemplateButtons = {
1692 type: "buttons";
1693 /**
1694 * Image URL (Max: 2000 characters)
1695 *
1696 * - HTTPS
1697 * - JPEG or PNG
1698 * - Max width: 1024px
1699 * - Max: 1 MB
1700 */
1701 thumbnailImageUrl?: string;
1702 /**
1703 * Aspect ratio of the image. Specify one of the following values:
1704 *
1705 * - `rectangle`: 1.51:1
1706 * - `square`: 1:1
1707 *
1708 * The default value is `rectangle`
1709 */
1710 imageAspectRatio?: "rectangle" | "square";
1711 /**
1712 * Size of the image. Specify one of the following values:
1713 *
1714 * - `cover`: The image fills the entire image area. Parts of the image that
1715 * do not fit in the area are not displayed.
1716 * - `contain`: The entire image is displayed in the image area. A background
1717 * is displayed in the unused areas to the left and right of vertical images
1718 * and in the areas above and below horizontal images.
1719 *
1720 * The default value is `cover`.
1721 */
1722 imageSize?: "cover" | "contain";
1723 /**
1724 * Background color of image. Specify a RGB color value.
1725 * The default value is `#FFFFFF` (white).
1726 */
1727 imageBackgroundColor?: string;
1728 /**
1729 * Title (Max: 40 characters)
1730 */
1731 title?: string;
1732 /**
1733 * Message text
1734 *
1735 * - Max: 160 characters (no image or title)
1736 * - Max: 60 characters (message with an image or title)
1737 */
1738 text: string;
1739 /**
1740 * Action when tapped (Max: 4)
1741 */
1742 actions: Action[];
1743};
1744/**
1745 * Template with two action buttons.
1746 *
1747 * Because of the height limitation for confirm template messages, the lower
1748 * part of the `text` display area will get cut off if the height limitation is
1749 * exceeded. For this reason, depending on the character width, the message
1750 * text may not be fully displayed even when it is within the character limits.
1751 */
1752export type TemplateConfirm = {
1753 type: "confirm";
1754 /**
1755 * Message text (Max: 240 characters)
1756 */
1757 text: string;
1758 /**
1759 * Action when tapped. Set 2 actions for the 2 buttons
1760 */
1761 actions: Action[];
1762};
1763/**
1764 * Template with multiple columns which can be cycled like a carousel.
1765 * The columns will be shown in order by scrolling horizontally.
1766 *
1767 * Because of the height limitation for carousel template messages, the lower
1768 * part of the `text` display area will get cut off if the height limitation is
1769 * exceeded. For this reason, depending on the character width, the message
1770 * text may not be fully displayed even when it is within the character limits.
1771 *
1772 * Keep the number of actions consistent for all columns. If you use an image
1773 * or title for a column, make sure to do the same for all other columns.
1774 */
1775export type TemplateCarousel = {
1776 type: "carousel";
1777 /**
1778 * Array of columns (Max: 10)
1779 */
1780 columns: TemplateColumn[];
1781 /**
1782 * Aspect ratio of the image. Specify one of the following values:
1783 *
1784 * - `rectangle`: 1.51:1
1785 * - `square`: 1:1
1786 *
1787 * Applies to all columns. The default value is `rectangle`.
1788 */
1789 imageAspectRatio?: "rectangle" | "square";
1790 /**
1791 * Size of the image. Specify one of the following values:
1792 *
1793 * - `cover`: The image fills the entire image area. Parts of the image that
1794 * do not fit in the area are not displayed.
1795 * - `contain`: The entire image is displayed in the image area. A background
1796 * is displayed in the unused areas to the left and right of vertical images
1797 * and in the areas above and below horizontal images.
1798 *
1799 * Applies to all columns. The default value is `cover`.
1800 */
1801 imageSize?: "cover" | "contain";
1802};
1803export type TemplateColumn = {
1804 /**
1805 * Image URL (Max: 2000 characters)
1806 *
1807 * - HTTPS
1808 * - JPEG or PNG
1809 * - Aspect ratio: 1:1.51
1810 * - Max width: 1024px
1811 * - Max: 1 MB
1812 */
1813 thumbnailImageUrl?: string;
1814 /**
1815 * Background color of image. Specify a RGB color value.
1816 * The default value is `#FFFFFF` (white).
1817 */
1818 imageBackgroundColor?: string;
1819 /**
1820 * Title (Max: 40 characters)
1821 */
1822 title?: string;
1823 /**
1824 * Message text
1825 *
1826 * - Max: 120 characters (no image or title)
1827 * - Max: 60 characters (message with an image or title)
1828 */
1829 text: string;
1830 /**
1831 * Action when image is tapped; set for the entire image, title, and text area
1832 */
1833 defaultAction?: Action;
1834 /**
1835 * Action when tapped (Max: 3)
1836 */
1837 actions: Action[];
1838};
1839/**
1840 * Template with multiple images which can be cycled like a carousel.
1841 * The images will be shown in order by scrolling horizontally.
1842 */
1843export type TemplateImageCarousel = {
1844 type: "image_carousel";
1845 /**
1846 * Array of columns (Max: 10)
1847 */
1848 columns: TemplateImageColumn[];
1849};
1850export type TemplateImageColumn = {
1851 /**
1852 * Image URL (Max: 2000 characters)
1853 *
1854 * - HTTPS
1855 * - JPEG or PNG
1856 * - Aspect ratio: 1:1
1857 * - Max width: 1024px
1858 * - Max: 1 MB
1859 */
1860 imageUrl: string;
1861 /**
1862 * Action when image is tapped
1863 */
1864 action: Action<{
1865 label?: string;
1866 }>;
1867};
1868/**
1869 * These properties are used for the quick reply.
1870 *
1871 * For more information, see
1872 * [Using quick replies](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/).
1873 */
1874export type QuickReply = {
1875 /**
1876 * This is a container that contains
1877 * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1878 *
1879 * Array of objects (Max: 13)
1880 */
1881 items: QuickReplyItem[];
1882};
1883/**
1884 * This is a quick reply option that is displayed as a button.
1885 *
1886 * For more information, see
1887 * [quick reply buttons](https://developers.line.biz/en/reference/messaging-api/#quick-reply-button-object).
1888 */
1889export type QuickReplyItem = {
1890 type: "action";
1891 /**
1892 * URL of the icon that is displayed at the beginning of the button (Max: 1000 characters)
1893 *
1894 * - URL scheme: https
1895 * - Image format: PNG
1896 * - Aspect ratio: 1:1
1897 * - Data size: Up to 1 MB
1898 *
1899 * There is no limit on the image size. If the `action` property has the
1900 * following actions with empty `imageUrl`:
1901 *
1902 * - [camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1903 * - [camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1904 * - [location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1905 *
1906 * the default icon is displayed.
1907 */
1908 imageUrl?: string;
1909 /**
1910 * Action performed when this button is tapped.
1911 *
1912 * Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
1913 *
1914 * The following is a list of the available actions:
1915 *
1916 * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1917 * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1918 * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1919 * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1920 * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1921 * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1922 * - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
1923 */
1924 action: Action;
1925};
1926export type Sender = {
1927 /**
1928 * Display name
1929 *
1930 * - Max character limit: 20
1931 * - Certain words such as `LINE` may not be used.
1932 */
1933 name?: string;
1934 /**
1935 * Icon image URL
1936 *
1937 * - Max character limit: 1000
1938 * - URL scheme: https
1939 */
1940 iconUrl?: string;
1941};
1942/**
1943 * These are types of actions for your bot to take when a user taps a button or an image in a message.
1944 *
1945 * - [Postback action](https://developers.line.biz/en/reference/messaging-api/#postback-action)
1946 * - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
1947 * - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
1948 * - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
1949 * - [Rich menu switch action](https://developers.line.biz/en/reference/messaging-api/#richmenu-switch-action)
1950 * - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
1951 * - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
1952 * - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
1953 */
1954export type Action<ExtraFields = {
1955 label: string;
1956}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction | RichMenuSwitchAction | {
1957 type: "camera";
1958} | {
1959 type: "cameraRoll";
1960} | {
1961 type: "location";
1962}) & ExtraFields;
1963/**
1964 * When a control associated with this action is tapped, a postback event is
1965 * returned via webhook with the specified string in the data property.
1966 */
1967export type PostbackAction = {
1968 type: "postback";
1969 /**
1970 * String returned via webhook in the `postback.data` property of the
1971 * postback event (Max: 300 characters)
1972 */
1973 data: string;
1974 /**
1975 * Text displayed in the chat as a message sent by the user when the action
1976 * is performed. Returned from the server through a webhook.
1977 *
1978 * - This property cannot be used with quick reply buttons. (Max: 300 characters)
1979 * - The `displayText` and `text` properties cannot both be used at the same time.
1980 * @deprecated
1981 */
1982 text?: string;
1983 /**
1984 * Text displayed in the chat as a message sent by the user when the action is performed.
1985 *
1986 * - Required for quick reply buttons.
1987 * - Optional for the other message types.
1988 *
1989 * Max: 300 characters
1990 *
1991 * The `displayText` and `text` properties cannot both be used at the same time.
1992 */
1993 displayText?: string;
1994 /**
1995 * The display method of such as rich menu based on user action. Specify one of the following values:
1996 *
1997 * - `closeRichMenu`: Close rich menu
1998 * - `openRichMenu`: Open rich menu
1999 * - `openKeyboard`: Open keyboard
2000 * - `openVoice`: Open voice message input mode
2001 *
2002 * This property is available on LINE version 12.6.0 or later for iOS or Android.
2003 */
2004 inputOption?: "closeRichMenu" | "openRichMenu" | "openKeyboard" | "openVoice";
2005 /**
2006 * String to be pre-filled in the input field when the keyboard is opened.
2007 * Valid only when the inputOption property is set to openKeyboard.
2008 * The string can be broken by a newline character (\n).
2009 *
2010 * Max: 300 characters
2011 */
2012 fillInText?: string;
2013};
2014/**
2015 * When a control associated with this action is tapped, the string in the text
2016 * property is sent as a message from the user.
2017 */
2018export type MessageAction = {
2019 type: "message";
2020 /**
2021 * Text sent when the action is performed (Max: 300 characters)
2022 */
2023 text: string;
2024};
2025/**
2026 * When a control associated with this action is tapped, the URI specified in
2027 * the `uri` property is opened.
2028 */
2029export type URIAction = {
2030 type: "uri";
2031 /**
2032 * URI opened when the action is performed (Max: 1000 characters).
2033 * Must start with `http`, `https`, or `tel`.
2034 */
2035 uri: string;
2036 altUri?: AltURI;
2037};
2038/**
2039 * URI opened on LINE for macOS and Windows when the action is performed (Max: 1000 characters)
2040 * If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.
2041 * The available schemes are http, https, line, and tel.
2042 * For more information about the LINE URL scheme, see Using the LINE URL scheme.
2043 * This property is supported on the following version of LINE.
2044 *
2045 * LINE 5.12.0 or later for macOS and Windows
2046 * Note: The altUri.desktop property is supported only when you set URI actions in Flex Messages.
2047 */
2048export type AltURI = {
2049 desktop: string;
2050};
2051/**
2052 * When a control associated with this action is tapped, a
2053 * [postback event](https://developers.line.biz/en/reference/messaging-api/#postback-event)
2054 * is returned via webhook with the date and time selected by the user from the
2055 * date and time selection dialog.
2056 *
2057 * The datetime picker action does not support time zones.
2058 *
2059 * #### Date and time format
2060 *
2061 * The date and time formats for the `initial`, `max`, and `min` values are
2062 * shown below. The `full-date`, `time-hour`, and `time-minute` formats follow
2063 * the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol.
2064 *
2065 * | Mode | Format | Example |
2066 * | -------- | ------------------------------------------------------------ | -------------------------------- |
2067 * | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 |
2068 * | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 |
2069 * | datetime | `full-date`T`time-hour`:`time-minute` or `full-date`t`time-hour`:`time-minute` (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00) | 2017-06-18T06:152017-06-18t06:15 |
2070 */
2071export type DatetimePickerAction = {
2072 type: "datetimepicker";
2073 /**
2074 * String returned via webhook in the `postback.data` property of the
2075 * postback event (Max: 300 characters)
2076 */
2077 data: string;
2078 mode: "date" | "time" | "datetime";
2079 /**
2080 * Initial value of date or time
2081 */
2082 initial?: string;
2083 /**
2084 * Largest date or time value that can be selected. Must be greater than the
2085 * `min` value.
2086 */
2087 max?: string;
2088 /**
2089 * Smallest date or time value that can be selected. Must be less than the
2090 * `max` value.
2091 */
2092 min?: string;
2093};
2094export type Size = {
2095 width: number;
2096 height: number;
2097};
2098/**
2099 * When a control associated with this action is tapped, the URI specified in
2100 * the `uri` property is opened.
2101 */
2102export type RichMenuSwitchAction = {
2103 type: "richmenuswitch";
2104 /**
2105 * Action label. Optional for rich menus. Read when the user's device accessibility feature is enabled.
2106 * Max character limit: 20. Supported on LINE for iOS 8.2.0 or later.
2107 */
2108 label?: string;
2109 /**
2110 * Rich menu alias ID to switch to.
2111 */
2112 richMenuAliasId: string;
2113 /**
2114 * String returned by the postback.data property of the postback event via a webhook
2115 * Max character limit: 300
2116 */
2117 data: string;
2118};
2119/**
2120 * Rich menus consist of either of these objects.
2121 *
2122 * - [Rich menu object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-object)
2123 * without the rich menu ID. Use this object when you
2124 * [create a rich menu](https://developers.line.biz/en/reference/messaging-api/#create-rich-menu).
2125 * - [Rich menu response object](https://developers.line.biz/en/reference/messaging-api/#rich-menu-response-object)
2126 * with the rich menu ID. This object is returned when you
2127 * [get a rich menu](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu)
2128 * or [get a list of rich menus](https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list).
2129 *
2130 * [Area objects](https://developers.line.biz/en/reference/messaging-api/#area-object) and
2131 * [action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects)
2132 * are included in these objects.
2133 */
2134export type RichMenu = {
2135 /**
2136 * [`size` object](https://developers.line.biz/en/reference/messaging-api/#size-object)
2137 * which contains the width and height of the rich menu displayed in the chat.
2138 * Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px.
2139 */
2140 size: Size;
2141 /**
2142 * `true` to display the rich menu by default. Otherwise, `false`.
2143 */
2144 selected: boolean;
2145 /**
2146 * Name of the rich menu.
2147 *
2148 * This value can be used to help manage your rich menus and is not displayed
2149 * to users.
2150 *
2151 * (Max: 300 characters)
2152 */
2153 name: string;
2154 /**
2155 * Text displayed in the chat bar (Max: 14 characters)
2156 */
2157 chatBarText: string;
2158 /**
2159 * Array of [area objects](https://developers.line.biz/en/reference/messaging-api/#area-object)
2160 * which define the coordinates and size of tappable areas
2161 * (Max: 20 area objects)
2162 */
2163 areas: Array<{
2164 bounds: Area;
2165 action: Action<{
2166 label?: string;
2167 }>;
2168 }>;
2169};
2170export type RichMenuResponse = {
2171 richMenuId: string;
2172} & RichMenu;
2173export type NumberOfMessagesSentResponse = InsightStatisticsResponse & {
2174 /**
2175 * The number of messages sent with the Messaging API on the date specified in date.
2176 * The response has this property only when the value of status is `ready`.
2177 */
2178 success?: number;
2179};
2180export type TargetLimitForAdditionalMessages = {
2181 /**
2182 * One of the following values to indicate whether a target limit is set or not.
2183 * - `none`: This indicates that a target limit is not set.
2184 * - `limited`: This indicates that a target limit is set.
2185 */
2186 type: "none" | "limited";
2187 /**
2188 * The target limit for additional messages in the current month.
2189 * This property is returned when the `type` property has a value of `limited`.
2190 */
2191 value?: number;
2192};
2193export type NumberOfMessagesSentThisMonth = {
2194 /**
2195 * The number of sent messages in the current month
2196 */
2197 totalUsage: number;
2198};
2199export declare const LINE_REQUEST_ID_HTTP_HEADER_NAME = "x-line-request-id";
2200export type MessageAPIResponseBase = {
2201 [LINE_REQUEST_ID_HTTP_HEADER_NAME]?: string;
2202};
2203export declare const LINE_SIGNATURE_HTTP_HEADER_NAME = "x-line-signature";
2204export type InsightStatisticsResponse = {
2205 /**
2206 * Calculation status. One of:
2207 * - `ready`: Calculation has finished; the numbers are up-to-date.
2208 * - `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.
2209 * - `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](https://developers.line.biz/en/reference/messaging-api/).
2210 */
2211 status: "ready" | "unready" | "out_of_service";
2212};
2213export type NumberOfMessageDeliveries = InsightStatisticsResponse & {
2214 /**
2215 * Number of push messages sent to **all** of this LINE official account's friends (broadcast messages).
2216 */
2217 broadcast: number;
2218 /**
2219 * Number of push messages sent to **some** of this LINE official account's friends, based on specific attributes (targeted/segmented messages).
2220 */
2221 targeting: number;
2222 /**
2223 * Number of auto-response messages sent.
2224 */
2225 autoResponse: number;
2226 /**
2227 * Number of greeting messages sent.
2228 */
2229 welcomeResponse: number;
2230 /**
2231 * Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp-en/manual/OfficialAccountManager/chats/screens/).
2232 */
2233 chat: number;
2234 /**
2235 * Number of broadcast messages sent with the [Send broadcast message](https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message) Messaging API operation.
2236 */
2237 apiBroadcast: number;
2238 /**
2239 * Number of push messages sent with the [Send push message](https://developers.line.biz/en/reference/messaging-api/#send-push-message) Messaging API operation.
2240 */
2241 apiPush: number;
2242 /**
2243 * Number of multicast messages sent with the [Send multicast message](https://developers.line.biz/en/reference/messaging-api/#send-multicast-message) Messaging API operation.
2244 */
2245 apiMulticast: number;
2246 /**
2247 * Number of replies sent with the [Send reply message](https://developers.line.biz/en/reference/messaging-api/#send-reply-message) Messaging API operation.
2248 */
2249 apiReply: number;
2250};
2251export type NumberOfFollowers = InsightStatisticsResponse & {
2252 /**
2253 * The number of times, as of the specified `date`, that a user added this LINE official account as a friend. The number doesn't decrease when a user blocks the account after adding it, or when they delete their own account.
2254 */
2255 followers: Number;
2256 /**
2257 * The number of users, as of the specified `date`, that the official account can reach with messages targeted by gender, age, or area. This number includes users for whom we estimated demographic attributes based on their activity in LINE and LINE-connected services.
2258 */
2259 targetedReaches: Number;
2260 /**
2261 * The number of users blocking the account as of the specified `date`. The number decreases when a user unblocks the account.
2262 */
2263 blocks: Number;
2264};
2265export type NumberOfMessageDeliveriesResponse = InsightStatisticsResponse | NumberOfMessageDeliveries;
2266export type NumberOfFollowersResponse = InsightStatisticsResponse | NumberOfFollowers;
2267type PercentageAble = {
2268 percentage: number;
2269};
2270export type FriendDemographics = {
2271 /**
2272 * `true` if friend demographic information is available.
2273 */
2274 available: boolean;
2275 /**
2276 * Percentage per gender
2277 */
2278 genders?: Array<{
2279 /**
2280 * Gender
2281 */
2282 gender: "unknown" | "male" | "female";
2283 } & PercentageAble>;
2284 /**
2285 * Percentage per age group
2286 */
2287 ages?: Array<{
2288 /**
2289 * Age group
2290 */
2291 age: string;
2292 } & PercentageAble>;
2293 /**
2294 * Percentage per area
2295 */
2296 areas?: Array<{
2297 area: string;
2298 } & PercentageAble>;
2299 /**
2300 * Percentage by OS
2301 */
2302 appTypes?: Array<{
2303 appType: "ios" | "android" | "others";
2304 } & PercentageAble>;
2305 /**
2306 * Percentage per friendship duration
2307 */
2308 subscriptionPeriods?: Array<{
2309 /**
2310 * Friendship duration
2311 */
2312 subscriptionPeriod: "over365days" | "within365days" | "within180days" | "within90days" | "within30days" | "within7days" | "unknown";
2313 } & PercentageAble>;
2314};
2315type UserInteractionStatisticsOfEachMessage = {
2316 seq: number;
2317 impression: number;
2318 mediaPlayed: number;
2319 mediaPlayed25Percent: number;
2320 mediaPlayed50Percent: number;
2321 mediaPlayed75Percent: number;
2322 mediaPlayed100Percent: number;
2323 uniqueMediaPlayed: number;
2324 uniqueMediaPlayed25Percent: number;
2325 uniqueMediaPlayed50Percent: number;
2326 uniqueMediaPlayed75Percent: number;
2327 uniqueMediaPlayed100Percent: number;
2328};
2329type UserInteractionStatisticsOfEachURL = {
2330 seq: number;
2331 url: number;
2332 click: number;
2333 uniqueClick: number;
2334 uniqueClickOfRequest: number;
2335};
2336/**
2337 * https://developers.line.biz/en/reference/messaging-api/#get-message-event
2338 */
2339export type UserInteractionStatistics = {
2340 overview: {
2341 requestId: string;
2342 timestamp: number;
2343 delivered: number;
2344 uniqueImpression: number;
2345 uniqueClick: number;
2346 uniqueMediaPlayed: number;
2347 uniqueMediaPlayed100Percent: number;
2348 };
2349 messages: UserInteractionStatisticsOfEachMessage[];
2350 clicks: UserInteractionStatisticsOfEachURL[];
2351};
2352/**
2353 * https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit
2354 */
2355export type StatisticsPerUnit = {
2356 overview: {
2357 uniqueImpression: number;
2358 uniqueClick: number;
2359 uniqueMediaPlayed: number;
2360 uniqueMediaPlayed100Percent: number;
2361 };
2362 messages: UserInteractionStatisticsOfEachMessage[];
2363 clicks: UserInteractionStatisticsOfEachURL[];
2364};
2365type FilterOperatorObject<T> = {
2366 type: "operator";
2367} & ({
2368 and: (T | FilterOperatorObject<T>)[];
2369} | {
2370 or: (T | FilterOperatorObject<T>)[];
2371} | {
2372 not: T | (T | FilterOperatorObject<T>)[];
2373});
2374type AudienceObject = {
2375 type: "audience";
2376 audienceGroupId: number;
2377};
2378type RedeliveryObject = {
2379 type: "redelivery";
2380 requestId: string;
2381};
2382export type ReceieptObject = AudienceObject | RedeliveryObject | FilterOperatorObject<AudienceObject> | FilterOperatorObject<RedeliveryObject>;
2383type DemographicAge = "age_15" | "age_20" | "age_25" | "age_30" | "age_35" | "age_40" | "age_45" | "age_50";
2384type DemographicSubscriptionPeriod = "day_7" | "day_30" | "day_90" | "day_180" | "day_365";
2385type DemographicArea = "jp_01" | "jp_02" | "jp_03" | "jp_04" | "jp_05" | "jp_06" | "jp_07" | "jp_08" | "jp_09" | "jp_10" | "jp_11" | "jp_12" | "jp_13" | "jp_14" | "jp_15" | "jp_16" | "jp_17" | "jp_18" | "jp_19" | "jp_20" | "jp_21" | "jp_22" | "jp_23" | "jp_24" | "jp_25" | "jp_26" | "jp_27" | "jp_28" | "jp_29" | "jp_30" | "jp_31" | "jp_32" | "jp_33" | "jp_34" | "jp_35" | "jp_36" | "jp_37" | "jp_38" | "jp_39" | "jp_40" | "jp_41" | "jp_42" | "jp_43" | "jp_44" | "jp_45" | "jp_46" | "jp_47" | "tw_01" | "tw_02" | "tw_03" | "tw_04" | "tw_05" | "tw_06" | "tw_07" | "tw_08" | "tw_09" | "tw_10" | "tw_11" | "tw_12" | "tw_13" | "tw_14" | "tw_15" | "tw_16" | "tw_17" | "tw_18" | "tw_19" | "tw_20" | "tw_21" | "tw_22" | "th_01" | "th_02" | "th_03" | "th_04" | "th_05" | "th_06" | "th_07" | "th_08" | "id_01" | "id_02" | "id_03" | "id_04" | "id_06" | "id_07" | "id_08" | "id_09" | "id_10" | "id_11" | "id_12" | "id_05";
2386type DemographicObject = {
2387 type: "gender";
2388 oneOf: ("male" | "female")[];
2389} | {
2390 type: "age";
2391 gte?: DemographicAge;
2392 lt?: DemographicAge;
2393} | {
2394 type: "appType";
2395 oneOf: ("ios" | "android")[];
2396} | {
2397 type: "area";
2398 oneOf: DemographicArea[];
2399} | {
2400 type: "subscriptionPeriod";
2401 gte?: DemographicSubscriptionPeriod;
2402 lt?: DemographicSubscriptionPeriod;
2403};
2404export type DemographicFilterObject = DemographicObject | FilterOperatorObject<DemographicObject>;
2405export type NarrowcastProgressResponse = ({
2406 phase: "waiting";
2407} | (({
2408 phase: "sending" | "succeeded";
2409} | {
2410 phase: "failed";
2411 failedDescription: string;
2412}) & {
2413 successCount: number;
2414 failureCount: number;
2415 targetCount: string;
2416 acceptedTime: string;
2417 completedTime: string;
2418})) & {
2419 errorCode?: 1 | 2;
2420};
2421type AudienceGroupJob = {
2422 audienceGroupJobId: number;
2423 audienceGroupId: number;
2424 description: string;
2425 type: "DIFF_ADD";
2426 audienceCount: number;
2427 created: number;
2428} & ({
2429 jobStatus: "QUEUED" | "WORKING" | "FINISHED";
2430} | {
2431 jobStatus: "FAILED";
2432 failedType: "INTERNAL_ERROR";
2433});
2434export type AudienceGroupStatus = "IN_PROGRESS" | "READY" | "EXPIRED" | "FAILED";
2435export type AudienceGroupCreateRoute = "OA_MANAGER" | "MESSAGING_API";
2436type _AudienceGroup = {
2437 audienceGroupId: number;
2438 description: string;
2439 audienceCount: number;
2440 created: number;
2441 isIfaAudience: boolean;
2442 permission: "READ" | "READ_WRITE";
2443 createRoute: AudienceGroupCreateRoute;
2444} & ({
2445 status: Exclude<AudienceGroupStatus, "FAILED">;
2446} | {
2447 status: "FAILED";
2448 failedType: "AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT" | "INTERNAL_ERROR";
2449}) & ({
2450 type: "UPLOAD";
2451} | {
2452 type: "CLICK";
2453 clickUrl: string;
2454} | {
2455 type: "IMP";
2456 requestId: string;
2457});
2458export type AudienceGroup = _AudienceGroup & {
2459 jobs: AudienceGroupJob[];
2460};
2461export type AudienceGroups = _AudienceGroup[];
2462export type AudienceGroupAuthorityLevel = "PUBLIC" | "PRIVATE";
2463export type ChannelAccessToken = {
2464 access_token: string;
2465 expires_in: number;
2466 token_type: "Bearer";
2467 key_id?: string;
2468};
2469export type VerifyAccessToken = {
2470 scope: string;
2471 client_id: string;
2472 expires_in: number;
2473};
2474export type VerifyIDToken = {
2475 scope: string;
2476 client_id: string;
2477 expires_in: number;
2478 iss: string;
2479 sub: string;
2480 aud: number;
2481 exp: number;
2482 iat: number;
2483 nonce: string;
2484 amr: string[];
2485 name: string;
2486 picture: string;
2487 email: string;
2488};
2489/**
2490 * Response body of get group summary.
2491 *
2492 * @see [Get group summary](https://developers.line.biz/en/reference/messaging-api/#get-group-summary)
2493 */
2494export type GroupSummaryResponse = {
2495 groupId: string;
2496 groupName: string;
2497 pictureUrl?: string;
2498};
2499/**
2500 * Response body of get members in group count and get members in room count.
2501 *
2502 * @see [Get members in group count](https://developers.line.biz/en/reference/messaging-api/#get-members-group-count)
2503 * @see [Get members in room count](https://developers.line.biz/en/reference/messaging-api/#get-members-room-count)
2504 */
2505export type MembersCountResponse = {
2506 count: number;
2507};
2508export type GetRichMenuAliasResponse = {
2509 richMenuAliasId: string;
2510 richMenuId: string;
2511};
2512export type GetRichMenuAliasListResponse = {
2513 aliases: GetRichMenuAliasResponse[];
2514};
2515/**
2516 * Response body of get bot info.
2517 *
2518 * @see [Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info)
2519 */
2520export type BotInfoResponse = {
2521 userId: string;
2522 basicId: string;
2523 premiumId?: string;
2524 displayName: string;
2525 pictureUrl?: string;
2526 chatMode: "chat" | "bot";
2527 markAsReadMode: "auto" | "manual";
2528};
2529/**
2530 * Response body of get webhook endpoint info.
2531 *
2532 * @see [Get get webhook endpoint info](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information)
2533 */
2534export type WebhookEndpointInfoResponse = {
2535 endpoint: string;
2536 active: boolean;
2537};
2538/**
2539 * Response body of test webhook endpoint.
2540 *
2541 * @see [Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint)
2542 */
2543export type TestWebhookEndpointResponse = {
2544 success: boolean;
2545 timestamp: string;
2546 statusCode: number;
2547 reason: string;
2548 detail: string;
2549};
2550export interface ApiResponseType<T> {
2551 httpResponse: Response;
2552 body: T;
2553}
2554export {};