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
  • raw(params=Hash, type=String)
  • Platforms
  • Usage
  • Messenger
  • WhatsApp
  • Telegram

Was this helpful?

  1. Replies / Notifications

raw

Creates messages or making calls to the each platform API, by sending specific raw parameters for each of them.

Previousquick_replyNextlist

Last updated 2 years ago

Was this helpful?

raw(params=Hash, type=String)

Platforms

Platform
Supported

Messenger

WhatsApp

Telegram

Usage

For the correct operation of this method, there are parameters on each platform that must not be included, since Kogno will include them subsequently.

Messenger

Example call extracted from

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<PSID>"
  },
  "message":{
    "text":"hello, world!"
  }
}' "https://graph.facebook.com/v14.0/me/messages?access_token=<PAGE_ACCESS_TOKEN>"

The params in raw() method will populate the "message" field from the JSON in the call above.

@reply.raw(
  {
    :text => "Hello, world!"
  }
)

WhatsApp

curl -X  POST \
 'https://graph.facebook.com/v13.0/FROM_PHONE_NUMBER_ID/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "PHONE_NUMBER",
  "type": "text",
  "text": { // the text object
    "preview_url": false,
    "body": "Hello, world!"
  }
}'

Must not be included the following params: messaging_product and recipient_type since Kogno will include them subsequently.

@reply.raw(
  {
    type: :text,
    text: {
      body: "Hello, world!"
    }
  } 
)

Telegram

@reply.raw(
  {
    :text => "Hello, world!"
  }
)

Additionally, in Telegram, the argument type can be passed with values like "sendPhoto", "sendAudio", "forwardMessage" and so on. If none is defined, by default the method used will be "sendMessage".

@reply.raw(
  {
    :photo => "https://www.gitbook.com/cdn-cgi/image/width=32,height=32,fit=contain,dpr=2,format=auto/https%3A%2F%2Ffiles.gitbook.com%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LvKT8QLxtgmljG5_-j1%252Ficon%252FNq9E3zigmAxZ0dgztUo0%252Flogo.png%3Falt%3Dmedia%26token%3D4fe5ec39-04ff-4572-836c-3aad704c3785"
  },
  "sendPhoto"
)

Example call extracted from

Only chat_id must not be included, for more information read the .

View .

Messenger Documentation
WhatsApp Documentation
Telegram documentation
Full Available Methods in Telegram