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
  • quick_reply(text=String, buttons=Array/Hash, params=Hash)
  • Platforms
  • Usage
  • Payload formats
  • To the same context
  • To a different context
  • With params
  • Arguments
  • Extra params

Was this helpful?

  1. Replies / Notifications

quick_reply

A text message followed by one or more buttons that disappear after being clicked.

quick_reply(text=String, buttons=Array/Hash, params=Hash)

Platforms

Platform
Supported
Native Name

Messenger

WhatsApp

Telegram

Usage

Can be called as reply or On-Demand, for this example we'll use @reply inside the conversation.

@reply.quick_reply(
  "Hello, how can I help today?",
  [
    {
      title: "Create an account",
      payload: "profile/create_account"
    },
    {
      title: "Read TOS",
      payload: "read_tos"
    },
    {
      title: "Feature Product",
      payload: set_payload("products/view", { product_id: 10 })
    }
  ]
)

Payload formats

To the same context

"read_tos"

To a different context

"profile/create_account"

With params

set_payload("products/view", { product_id: 10 })

Arguments

Name
Description

text

Required.

The text displayed above the buttons.

buttons

Required. One or several buttons that can be payloads or links in some platforms.

params

Optional. Extra parameters that may vary between platforms.

Extra params

Below are some unified or built-in parameters from this framework.

typed_postbacks

@reply.button(
  "Hello, how are you today?",
  [
    {
      title: "Good",
      payload: "good_mood"
    },
    {
      title: "Bad",
      payload: "bad_mood"
    }
  ],
  { typed_postbacks: true }
)

slice_replies

Only available in Telegram, it allows displaying a defined amount of buttons in rows.

@reply.button(
  "Choose a number from 1 to 10",
  (1..10).map{|number|
    {
      title: "Number: #{number}",
      payload: set_payload(:number_response,{ number: number})
    }
  },
  { slice_replies: 3  }
)  

For more information, read more about the expected params for each platform:

PreviousbuttonNextraw

Last updated 2 years ago

Was this helpful?

In either case, the click event will be captured by a block (if declared) in the context defined in the payload route.

Regardless of the value of config.typed_postbacks in the , this feature can be enabled/disabled independently passing this parameter with true or false.

postback
main configuration
Messenger
WhatsApp
Telegram
quick_replies
InteractiveMessages / button
InlineKeyboardMarkup