UNPKG

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