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

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 Messenger Documentation
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

Example call extracted from WhatsApp Documentation
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

Only chat_id must not be included, for more information read the Telegram documentation.
@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"
)
Last modified 2mo ago
Copy link
On this page
raw(params=Hash, type=String)
Platforms
Usage
Messenger
WhatsApp
Telegram