Kogno
  • Introduction
  • Getting Started
    • Configuration
    • Starting the Server
    • Messenger Configuration
    • Telegram Configuration
    • WhatsApp Configuration
    • NLP Configuration
  • Conversation Class
  • Contexts
    • Blocks
      • before_anything
      • postback
      • deep_link
      • command
      • any_attachment
      • regular_expression
      • keyword
      • any_number
      • any_text
      • intent
      • entity
      • membership
      • recurring_notification
      • everything_else
      • after_all
    • Sub Contexts
    • Routing
    • Sequences
    • Conversational Forms
  • Replies / Notifications
    • text
    • button
    • quick_reply
    • raw
    • list
    • carousel
    • url
    • typing
    • image
    • video
    • html
    • markdown
    • contact
    • location
    • recurring_notification_request
    • messenger_generic_template
    • whatsapp_template
  • Templates
  • Models
    • User model
  • Scheduled Messages
  • Telegram Inline Query
  • Command Line
  • Global Methods
  • Internationalization
Powered by GitBook
On this page
  1. Replies / Notifications

carousel

Messenger Generic Templates Carousel.

PreviouslistNexturl

Last updated 3 years ago

Was this helpful?

CtrlK
  • carousel(elements=Array, quick_replies=Array, image_aspect_ratio=:horizontal|:square)
  • Platforms
  • Usage
  • Params

Was this helpful?

carousel(elements=Array, quick_replies=Array, image_aspect_ratio=:horizontal|:square)

Platforms

Platform
Supported

Messenger

WhatsApp

Telegram

Usage

news = feed_entries("https://rss.nytimes.com/services/xml/rss/nyt/World.xml")

@reply.notification.carousel(
  news[0..9].map{|article|
    {
      title: article.title,
      image_url: article.image.to_s,
      subtitle: article.summary.to_s.truncate(50),
      default_action: {
        type: :web_url,
        url: article.url,
        webview_height_ratio: :tall,
        messenger_extensions: true
      },
      buttons: [
        {
          type: :web_url,
          url: article.url,
          title: "Read more",
          webview_height_ratio: :tall,
          messenger_extensions: true
        }
      ]
    }
  },
  [
    {
      title: "Read CNN",
      payload: "news/cnn_carousel"
    }
  ],
  :square
)

For a complete list of template properties, see the Generic Template reference in Messenger Platform.

Params

Name
Description

elements

Required.

Array with Messenger Generic Templates. There can be no more than 10 items.

quick_replies

Optional. Array of quick replies displayed bellow the carousel.

image_aspect_ratio

Optional. Carousel images can be :horizontal or :square.

By default :horizontal.