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

Replies / Notifications

This chapter talks about the different formats used when replying to or sending an on-demand notification to a user.

PreviousConversational FormsNexttext

Last updated 3 years ago

Was this helpful?

CtrlK
  • Usage
  • On-demand
  • As Reply in the Conversation
  • Notification Formats

Was this helpful?

Usage

On-demand

user = User.first
user.notification.text "Hello!"
user.notification.typing 1.second
user.notification.text("How are you today?")
user.notification.send()

As Reply in the Conversation

Using the @reply instance, accessible from any action block in a context or in the callbacks from the Conversation class.

class MainContext < Conversation

  def blocks

    intent "greeting" do
    
      @reply.text "Hello!"
      @reply.typing_on(2)
      @reply.quick_reply(
        "How are you today?",
        [
          {
            title: "I'm good",
            payload: :good
          },
          {
            title: "Had better days",
            payload: :bad
          }
        ]
      )
      
    end
  
  end

end

For this case, the call to the send() method is not necessary, since it's a reply within the conversation, therefore the framework will do it automatically.

Notification Formats

In Kogno, we try to unify as many formats as possible, in order to allow developers to write a unified code for a cross-platform conversational application.

Format
Description
Platforms

text

Text message

All

button

Text message with one or more buttons.

All

quick_reply

Text message with one or more buttons below.

All

raw

Calls to each platform with raw params.

All

list

Multiple choice list.

WhatsApp

carousel

Carrousel images, title, description, link, among others.

Messenger

url

Url with image, title and description.

All

typing

Pause for X seconds.

All

image

Sends an image.

All

video

Sends a video.

All

html

Message in HTML format.

Telegram

markdown

Message in Markdown format.

Telegram

contact

Contact information.

WhatsApp & Telegram

location

Sends a location.

WhatsApp & Telegram

recurring_notification_request

Request for subscription to recurring notifications in Messenger.

Messenger

messenger_generic_template

The generic template from Messenger.

Messenger

whatsapp_template

WhatsApp media message template.

WhatApp