carousel

Messenger Generic Templates Carousel.

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.

Last updated