How to use the messaging-api-line.Line.createCarouselTemplate function in messaging-api-line

To help you get started, we’ve selected a few messaging-api-line examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yoctol / bottender / packages / bottender / src / line / LineContext.ts View on Github external
pushCarouselTemplate(
    altText: string,
    columns: LineTypes.ColumnObject[],
    {
      imageAspectRatio,
      imageSize,
      ...options
    }: {
      imageAspectRatio?: 'rectangle' | 'square';
      imageSize?: 'cover' | 'contain';
    } & LineTypes.MessageOptions = {}
  ) {
    return this.push(
      [
        Line.createCarouselTemplate(altText, columns, {
          imageAspectRatio,
          imageSize,
          ...options,
        }),
      ],
      options
    );
  }
github zaoldyeck / cross-platform-chatbot / src / message / KKBOXMessage.js View on Github external
toLineMessage() {
        const columns = this.data.map(el => {
            return {
                thumbnailImageUrl: el.images === undefined ? el.album.images[1].url : el.images[1].url,
                title: el.name === undefined ? el.title.slice(0, 40) : el.name.slice(0, 40),
                text: el.description === undefined || el.description === '' ? ' ' : el.description.slice(0, 60),
                actions: [{
                    type: 'uri',
                    label: 'Open in KKBOX',
                    uri: this.dataType === 'artist' ? el.url : `https://widget.kkbox.com/v1/?id=${el.id}&type=${this.dataType === 'track' ? 'song' : this.dataType}`
                }]
            }
        }).slice(0, 10)
        return Line.createCarouselTemplate('為您播放', columns, {imageAspectRatio: 'square', imageSize: 'cover'})
    }
github Yoctol / bottender / packages / bottender / src / line / LineContext.ts View on Github external
replyCarouselTemplate(
    altText: string,
    columns: LineTypes.ColumnObject[],
    {
      imageAspectRatio,
      imageSize,
      ...options
    }: {
      imageAspectRatio?: 'rectangle' | 'square';
      imageSize?: 'cover' | 'contain';
    } & LineTypes.MessageOptions = {}
  ) {
    return this.reply(
      [
        Line.createCarouselTemplate(altText, columns, {
          imageAspectRatio,
          imageSize,
          ...options,
        }),
      ],
      options
    );
  }
github Yoctol / bottender / packages / bottender / src / line / LineContext.ts View on Github external
sendCarouselTemplate(
    altText: string,
    columns: LineTypes.ColumnObject[],
    {
      imageAspectRatio,
      imageSize,
      ...options
    }: {
      imageAspectRatio?: 'rectangle' | 'square';
      imageSize?: 'cover' | 'contain';
    } & LineTypes.MessageOptions = {}
  ) {
    return this.send(
      [
        Line.createCarouselTemplate(altText, columns, {
          imageAspectRatio,
          imageSize,
          ...options,
        }),
      ],
      options
    );
  }