Messaging API client for LINE
npm install messaging-api-line> Messaging API client for LINE
![]()
- Installation
- Usage
- API Reference
- Reply API
- Imagemap Messages
- Template Messages
- Flex Messages
- Push API
- Imagemap Messages
- Template Messages
- Flex Messages
- Multicast API
- Imagemap Messages
- Template Messages
- Flex Messages
- Quick Replies
- Content API
- Profile API
- Group/Room Member Profile API
- Group/Room Member IDs API
- Leave API
- Rich Menu API
- Account Link API
- LINE Front-end Framework API
- LINE Pay
- Debug Tips
- Testing
``sh`
npm i --save messaging-api-line
or
`sh`
yarn add messaging-api-line
`js
const { LineClient } = require('messaging-api-line');
// get accessToken and channelSecret from LINE developers website
const client = new LineClient({
accessToken: ACCESS_TOKEN,
channelSecret: CHANNEL_SECRET,
});
`
messaging-api-line uses axios as HTTP client. We use axios-error package to wrap API error instances for better formatting error messages. Directly calling console.log with the error instance will return formatted message. If you'd like to get the axios request, response, or config, you can still get them via those keys on the error instance.
`js`
client.replyText(token, text).catch((error) => {
console.log(error); // formatted error message
console.log(error.stack); // error stack trace
console.log(error.config); // axios request config
console.log(error.request); // HTTP request
console.log(error.response); // HTTP response
});
All methods return a Promise.
Responds to events from users, groups, and rooms.
Responds messages using specified reply token.
| Param | Type | Description |
| -------- | --------------- | ----------------------------------------------------------------------- |
| token | String | replyToken received via webhook. |Array
| messages |
Example:
`js`
client.reply(REPLY_TOKEN, [
{
type: 'text',
text: 'Hello!',
},
]);
replyToken can only be used once, but you can send up to 5 messages using the same token.
`js
const { Line } = require('messaging-api-line');
client.reply(REPLY_TOKEN, [
Line.createText('Hello'),
Line.createImage({
originalContentUrl: 'https://example.com/original.jpg',
previewImageUrl: 'https://example.com/preview.jpg',
}),
Line.createText('End'),
]);
`
There are a bunch of factory methods can be used to create messages:
- Line.createText(text, options)Line.createImage(image, options)
- Line.createVideo(video, options)
- Line.createAudio(audio, options)
- Line.createLocation(location, options)
- Line.createSticker(sticker, options)
- Line.createImagemap(altText, imagemap, options)
- Line.createTemplate(altText, template, options)
- Line.createButtonTemplate(altText, buttonTemplate, options)
- Line.createConfirmTemplate(altText, confirmTemplate, options)
- Line.createCarouselTemplate(altText, columns, options)
- Line.createImageCarouselTemplate(altText, columns, options)
- Line.createFlex(altText, contents, options)
-
- Official DocsResponds text message using specified reply token.

You can include LINE original emoji in text messages using character codes. For a list of LINE emoji that can be sent in LINE chats, see the emoji list.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| text | | Text of the message to be sent. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyText(REPLY_TOKEN, 'Hello!');
- Official DocsResponds image message using specified reply token.


| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| image.originalContentUrl | | Image URL. |String
| image.previewImageUrl | | Preview image URL. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyImage(REPLY_TOKEN, {
originalContentUrl: 'https://example.com/original.jpg',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsResponds video message using specified reply token.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| video.originalContentUrl | | URL of video file. |String
| video.previewImageUrl | | URL of preview image. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyVideo(REPLY_TOKEN, {
originalContentUrl: 'https://example.com/original.mp4',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsResponds audio message using specified reply token.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| audio.originalContentUrl | | URL of audio file. |Number
| audio.duration | | Length of audio file (milliseconds). |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyAudio(REPLY_TOKEN, {
originalContentUrl: 'https://example.com/original.m4a',
duration: 240000,
});
- Official DocsResponds location message using specified reply token.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |Object
| location | | Object contains location's parameters. |String
| location.title | | Title of the location. |String
| location.address | | Address of the location. |Number
| location.latitude | | Latitude of the location. |Number
| location.longitude | | Longitude of the location. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyLocation(REPLY_TOKEN, {
title: 'my location',
address: '〒150-0002 東京都渋谷区渋谷2丁目21−1',
latitude: 35.65910807942215,
longitude: 139.70372892916203,
});
- Official DocsResponds sticker message using specified reply token.
For a list of stickers that can be sent with the Messaging API, see the sticker list.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| sticker.packageId | | Package ID. |String
| sticker.stickerId | | Sticker ID. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replySticker(REPLY_TOKEN, { packageId: '1', stickerId: '1' });
- Official DocsResponds imagemap message using specified reply token.

| Param | Type | Description |
| ----------------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Object
| imagemap | | Object contains imagemap's parameters. |String
| imagemap.baseUrl | | Base URL of image. |Object
| imagemap.baseSize | | Base size object. |Number
| imagemap.baseSize.width | | Width of base image. |Number
| imagemap.baseSize.height | | Height of base image. |Object
| imagemap.video | | Video object. |String
| imagemap.video.originalContentUrl | | URL of the video file (Max: 1000 characters). |String
| imagemap.video.previewImageUrl | | URL of the preview image (Max: 1000 characters). |Number
| imagemap.video.area.x | | Horizontal position of the video area relative to the top-left corner of the imagemap area. |Number
| imagemap.video.area.y | | Vertical position of the video area relative to the top-left corner of the imagemap area. |Number
| imagemap.video.area.width | | Width of the video area. |Number
| imagemap.video.area.height | | Height of the video area. |String
| imagemap.video.externalLink.linkUri | | Webpage URL. Called when the label displayed after the video is tapped. |String
| imagemap.video.externalLink.label | | Label. Displayed after the video is finished. |Array
| imagemap.actions |
Example:
`js`
client.replyImagemap(REPLY_TOKEN, 'this is an imagemap', {
baseUrl: 'https://example.com/bot/images/rm001',
baseSize: {
width: 1040,
height: 1040,
},
actions: [
{
type: 'uri',
linkUri: 'https://example.com/',
area: {
x: 0,
y: 0,
width: 520,
height: 1040,
},
},
{
type: 'message',
text: 'hello',
area: {
x: 520,
y: 0,
width: 520,
height: 1040,
},
},
],
});
- Official DocsResponds template message using specified reply token.
| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Object
| template | | Object with the contents of the template. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyTemplate(REPLY_TOKEN, 'this is a template', {
type: 'buttons',
thumbnailImageUrl: 'https://example.com/bot/images/image.jpg',
title: 'Menu',
text: 'Please select',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=123',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=123',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/123',
},
],
});
- Official DocsAlias: replyButtonsTemplate.
Responds button template message using specified reply token.

| Param | Type | Description |
| ----------------------------------- | --------------- | --------------------------------------------------------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Object
| buttonTemplate | | Object contains buttonTemplate's parameters. |String
| buttonTemplate.thumbnailImageUrl | | Image URL of buttonTemplate. |String
| buttonTemplate.imageAspectRatio | | Aspect ratio of the image. Specify one of the following values: rectangle, square |String
| buttonTemplate.imageSize | | Size of the image. Specify one of the following values: cover, contain |String
| buttonTemplate.imageBackgroundColor | | Background color of image. Specify a RGB color value. The default value is #FFFFFF (white). |String
| buttonTemplate.title | | Title of buttonTemplate. |String
| buttonTemplate.text | | Message text of buttonTemplate. |Object
| buttonTemplate.defaultAction | | Action when image is tapped; set for the entire image, title, and text area. |Array
| buttonTemplate.actions |
Example:
`js`
client.replyButtonTemplate(REPLY_TOKEN, 'this is a template', {
thumbnailImageUrl: 'https://example.com/bot/images/image.jpg',
title: 'Menu',
text: 'Please select',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=123',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=123',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/123',
},
],
});
- Official DocsResponds confirm template message using specified reply token.

| Param | Type | Description |
| ------------------------ | --------------- | --------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Object
| confirmTemplate | | Object contains confirmTemplate's parameters. |String
| confirmTemplate.text | | Message text of confirmTemplate. |Array
| confirmTemplate.actions |
Example:
`js`
client.replyConfirmTemplate(REPLY_TOKEN, 'this is a confirm template', {
text: 'Are you sure?',
actions: [
{
type: 'message',
label: 'Yes',
text: 'yes',
},
{
type: 'message',
label: 'No',
text: 'no',
},
],
});
- Official DocsResponds carousel template message using specified reply token.

| Param | Type | Description |
| ------------------------ | --------------- | ------------------------------------------------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Array
| carouselItems |
Example:
`js`
client.replyCarouselTemplate(REPLY_TOKEN, 'this is a carousel template', [
{
thumbnailImageUrl: 'https://example.com/bot/images/item1.jpg',
title: 'this is menu',
text: 'description',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=111',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=111',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/111',
},
],
},
{
thumbnailImageUrl: 'https://example.com/bot/images/item2.jpg',
title: 'this is menu',
text: 'description',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=222',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=222',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/222',
},
],
},
]);
- Official DocsResponds image carousel template message using specified reply token.

| Param | Type | Description |
| ------------------------ | --------------- | ---------------------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Array
| carouselItems |
Example:
`js`
client.replyImageCarouselTemplate(
REPLY_TOKEN,
'this is an image carousel template',
[
{
imageUrl: 'https://example.com/bot/images/item1.jpg',
action: {
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=111',
},
},
{
imageUrl: 'https://example.com/bot/images/item2.jpg',
action: {
type: 'message',
label: 'Yes',
text: 'yes',
},
},
{
imageUrl: 'https://example.com/bot/images/item3.jpg',
action: {
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/222',
},
},
]
);
- Official DocsResponds flex message using specified reply token.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------------------------------------------------------------- |
| token | String | replyToken received via webhook. |String
| altText | | Alternative text. |Object
| contents | | Flex Message container object. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.replyFlex(REPLY_TOKEN, 'this is a flex', {
type: 'bubble',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Header text',
},
],
},
hero: {
type: 'image',
url: 'https://example.com/flex/images/image.jpg',
},
body: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Body text',
},
],
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Footer text',
},
],
},
styles: {
comment: 'See the example of a bubble style object',
},
});
Sends messages to a user, group, or room at any time.
Sends messages using ID of the receiver.
| Param | Type | Description |
| -------- | --------------- | ----------------------------------------------------------------------- |
| userId | String | ID of the receiver. |Array
| messages |
Example:
`js`
client.push(USER_ID, [
{
type: 'text',
text: 'Hello!',
},
]);
- Official DocsSends text message using ID of the receiver.

You can include LINE original emoji in text messages using character codes. For a list of LINE emoji that can be sent in LINE chats, see the emoji list.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| text | | Text of the message to be sent. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushText(USER_ID, 'Hello!');
- Official DocsSends image message using ID of the receiver.


| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| image.originalContentUrl | | Image URL. |String
| image.previewImageUrl | | Preview image URL. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushImage(USER_ID, {
originalContentUrl: 'https://example.com/original.jpg',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsSends video message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| video.originalContentUrl | | URL of video file. |String
| video.previewImageUrl | | URL of preview image. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushVideo(USER_ID, {
originalContentUrl: 'https://example.com/original.mp4',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsSends audio message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| audio.originalContentUrl | | URL of audio file. |Number
| audio.duration | | Length of audio file (milliseconds). |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushAudio(USER_ID, {
originalContentUrl: 'https://example.com/original.m4a',
duration: 240000,
});
- Official DocsSends location message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |Object
| location | | Object contains location's parameters. |String
| location.title | | Title of the location. |String
| location.address | | Address of the location. |Number
| location.latitude | | Latitude of the location. |Number
| location.longitude | | Longitude of the location. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushLocation(USER_ID, {
title: 'my location',
address: '〒150-0002 東京都渋谷区渋谷2丁目21−1',
latitude: 35.65910807942215,
longitude: 139.70372892916203,
});
- Official DocsSends sticker message using ID of the receiver.
For a list of stickers that can be sent with the Messaging API, see the sticker list.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| sticker.packageId | | Package ID. |String
| sticker.stickerId | | Sticker ID. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushSticker(USER_ID, { packageId: '1', stickerId: '1' });
- Official DocsSends imagemap message using ID of the receiver.

| Param | Type | Description |
| ----------------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Object
| imagemap | | Object contains imagemap's parameters. |String
| imagemap.baseUrl | | Base URL of image. |Object
| imagemap.baseSize | | Base size object. |Number
| imagemap.baseSize.width | | Width of base image. |Number
| imagemap.baseSize.height | | Height of base image. |Object
| imagemap.video | | Video object. |String
| imagemap.video.originalContentUrl | | URL of the video file (Max: 1000 characters). |String
| imagemap.video.previewImageUrl | | URL of the preview image (Max: 1000 characters). |Number
| imagemap.video.area.x | | Horizontal position of the video area relative to the top-left corner of the imagemap area. |Number
| imagemap.video.area.y | | Vertical position of the video area relative to the top-left corner of the imagemap area. |Number
| imagemap.video.area.width | | Width of the video area. |Number
| imagemap.video.area.height | | Height of the video area. |String
| imagemap.video.externalLink.linkUri | | Webpage URL. Called when the label displayed after the video is tapped. |String
| imagemap.video.externalLink.label | | Label. Displayed after the video is finished. |Array
| imagemap.actions |
Example:
`js`
client.pushImagemap(USER_ID, 'this is an imagemap', {
baseUrl: 'https://example.com/bot/images/rm001',
baseSize: {
width: 1040,
height: 1040,
},
actions: [
{
type: 'uri',
linkUri: 'https://example.com/',
area: {
x: 0,
y: 0,
width: 520,
height: 1040,
},
},
{
type: 'message',
text: 'hello',
area: {
x: 520,
y: 0,
width: 520,
height: 1040,
},
},
],
});
- Official DocsSends template message using ID of the receiver.
| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Object
| template | | Object with the contents of the template. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushTemplate(USER_ID, 'this is a template', {
type: 'buttons',
thumbnailImageUrl: 'https://example.com/bot/images/image.jpg',
title: 'Menu',
text: 'Please select',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=123',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=123',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/123',
},
],
});
- Official DocsAlias: pushButtonsTemplate.
Sends button template message using ID of the receiver.

| Param | Type | Description |
| ----------------------------------- | --------------- | --------------------------------------------------------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Object
| buttonTemplate | | Object contains buttonTemplate's parameters. |String
| buttonTemplate.thumbnailImageUrl | | Image URL of buttonTemplate. |String
| buttonTemplate.imageAspectRatio | | Aspect ratio of the image. Specify one of the following values: rectangle, square |String
| buttonTemplate.imageSize | | Size of the image. Specify one of the following values: cover, contain |String
| buttonTemplate.imageBackgroundColor | | Background color of image. Specify a RGB color value. The default value is #FFFFFF (white). |String
| buttonTemplate.title | | Title of buttonTemplate. |String
| buttonTemplate.text | | Message text of buttonTemplate. |Object
| buttonTemplate.defaultAction | | Action when image is tapped; set for the entire image, title, and text area. |Array
| buttonTemplate.actions |
Example:
`js`
client.pushButtonTemplate(USER_ID, 'this is a template', {
thumbnailImageUrl: 'https://example.com/bot/images/image.jpg',
title: 'Menu',
text: 'Please select',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=123',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=123',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/123',
},
],
});
- Official DocsSends confirm template message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | --------------- | --------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Object
| confirmTemplate | | Object contains confirmTemplate's parameters. |String
| confirmTemplate.text | | Message text of confirmTemplate. |Array
| confirmTemplate.actions |
Example:
`js`
client.pushConfirmTemplate(USER_ID, 'this is a confirm template', {
text: 'Are you sure?',
actions: [
{
type: 'message',
label: 'Yes',
text: 'yes',
},
{
type: 'message',
label: 'No',
text: 'no',
},
],
});
- Official DocsSends carousel template message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | --------------- | ------------------------------------------------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Array
| carouselItems |
Example:
`js`
client.pushCarouselTemplate(USER_ID, 'this is a carousel template', [
{
thumbnailImageUrl: 'https://example.com/bot/images/item1.jpg',
title: 'this is menu',
text: 'description',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=111',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=111',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/111',
},
],
},
{
thumbnailImageUrl: 'https://example.com/bot/images/item2.jpg',
title: 'this is menu',
text: 'description',
actions: [
{
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=222',
},
{
type: 'postback',
label: 'Add to cart',
data: 'action=add&itemid=222',
},
{
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/222',
},
],
},
]);
- Official DocsSends image carousel template message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | --------------- | ---------------------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Array
| carouselItems |
Example:
`js`
client.pushImageCarouselTemplate(
USER_ID,
'this is an image carousel template',
[
{
imageUrl: 'https://example.com/bot/images/item1.jpg',
action: {
type: 'postback',
label: 'Buy',
data: 'action=buy&itemid=111',
},
},
{
imageUrl: 'https://example.com/bot/images/item2.jpg',
action: {
type: 'message',
label: 'Yes',
text: 'yes',
},
},
{
imageUrl: 'https://example.com/bot/images/item3.jpg',
action: {
type: 'uri',
label: 'View detail',
uri: 'http://example.com/page/222',
},
},
]
);
- Official DocsSends flex message using ID of the receiver.

| Param | Type | Description |
| ------------------------ | -------- | -------------------------------------------------------------------------------------------------- |
| userId | String | ID of the receiver. |String
| altText | | Alternative text. |Object
| contents | | Flex Message container object. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.pushFlex(USER_ID, 'this is a flex', {
type: 'bubble',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Header text',
},
],
},
hero: {
type: 'image',
url: 'https://example.com/flex/images/image.jpg',
},
body: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Body text',
},
],
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Footer text',
},
],
},
styles: {
comment: 'See the example of a bubble style object',
},
});
Sends messages to multiple users at any time.
Sends messages to multiple users.
| Param | Type | Description |
| -------- | --------------- | ----------------------------------------------------------------------- |
| userIds | Array | IDs of the receivers. |Array
| messages |
Example:
`js`
client.multicast(
[USER_ID],
[
{
type: 'text',
text: 'Hello!',
},
]
);
- Official DocsSends text message to multiple users.

You can include LINE original emoji in text messages using character codes. For a list of LINE emoji that can be sent in LINE chats, see the emoji list.

| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| text | | Text of the message to be sent. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastText([USER_ID], 'Hello!');
- Official DocsSends image message to multiple users.


| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| image.originalContentUrl | | Image URL. |String
| image.previewImageUrl | | Preview image URL. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastImage([USER_ID], {
originalContentUrl: 'https://example.com/original.jpg',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsSends video message to multiple users.

| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| video.originalContentUrl | | URL of video file. |String
| video.previewImageUrl | | URL of preview image. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastVideo([USER_ID], {
originalContentUrl: 'https://example.com/original.mp4',
previewImageUrl: 'https://example.com/preview.jpg',
});
- Official DocsSends audio message to multiple users.

| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| audio.originalContentUrl | | URL of audio file. |Number
| audio.duration | | Length of audio file (milliseconds). |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastAudio([USER_ID], {
originalContentUrl: 'https://example.com/original.m4a',
duration: 240000,
});
- Official DocsSends location message to multiple users.

| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |Object
| location | | Object contains location's parameters. |String
| location.title | | Title of the location. |String
| location.address | | Address of the location. |Number
| location.latitude | | Latitude of the location. |Number
| location.longitude | | Longitude of the location. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastLocation([USER_ID], {
title: 'my location',
address: '〒150-0002 東京都渋谷区渋谷2丁目21−1',
latitude: 35.65910807942215,
longitude: 139.70372892916203,
});
- Official DocsSends sticker message to multiple users.
For a list of stickers that can be sent with the Messaging API, see the sticker list.

| Param | Type | Description |
| ------------------------ | --------------- | -------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| sticker.packageId | | Package ID. |String
| sticker.stickerId | | Sticker ID. |Object
| options | | Optional options. |Object
| options.quickReply | | Quick reply object to attach to the message. |Array
| options.quickReply.items | | Quick reply items. |
Example:
`js`
client.multicastSticker([USER_ID], {
packageId: '1',
stickerId: '1',
});
- Official DocsSends imagemap message to multiple users.

| Param | Type | Description |
| ----------------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
| userIds | Array | IDs of the receivers. |String
| altText | | Alternative text. |Object
| imagemap | | Object contains imagemap's parameters. |String
| imagemap.baseUrl | | Base URL of image. |Object
| imagemap.baseSize | | Base size object. |Number
| imagemap.baseSize.width | | Width of base image. |Number
| imagemap.baseSize.height | | Height of base image. |Object
| imagemap.video | | Video object. |String` | URL of the video file (Max: 1000 characters).
| imagemap.video.originalContentUrl |