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