Tekos
  • General overview
  • Tekos Chat Workspace
    • Tekos Chat
      • Design and Interface of chat
      • Apps
    • Tekos Chat FAQ
      • How to create a workspace for my team?
      • How to invite members to my workspace?
      • What is a room and to create it?
      • Public or private room? What is the difference?
      • What is Roles & Permissions?
      • What is power level and how does it work?
      • How do I know if my message was read?
      • How can I share a file?
      • How to search messages and/or files.
      • How do I make video calls?
      • How do I change my profile settings?
      • Notifications settings.
      • Room settings.
      • How to leave a room?
      • Lab features
  • Flow Builder
    • Tekos Flow
      • Editor UI
      • Building your first flow
        • Import / Export Flow
      • Flow.tekos library
      • Subflows
  • Omnichannel Live Chat
    • Overview
    • Channels
      • WhatsApp
  • Building Apps
    • Building Apps
      • Connecting flow with the chat
      • HTTP Requests
        • Handle query parameters passed to an HTTP endpoint
        • Handle url parameters in an HTTP endpoint
    • Chat Surfaces
      • Modals - Adaptive Cards
        • Building An Adaptive Card
        • Basic usage of Cards
        • Variables in the Cards
        • Action Buttons
      • Messages
        • Instant Messaging
          • Message types
        • Getting the Messages
        • Getting events for a room
        • Messages webhook
    • Interactivity in the Chat
      • Shortcuts
      • Slash Commands
      • Buttons
Powered by GitBook
On this page
  • Inline-button as quick replies
  • How go get them working
  • Adaptive Cards buttons
  • Hints buttons

Was this helpful?

  1. Building Apps
  2. Interactivity in the Chat

Buttons

PreviousSlash Commands

Last updated 4 years ago

Was this helpful?

Buttons are useful for many situations, where you need to get a fast response from users. We can split the available buttons to three parts: Buttons in Adaptive cards, Inline-button as quick replies and Hints buttons.

Adaptive cards and hint buttons allow you to configure the endpoint to which the button payload will be sent.

And the inline-buttons are built for quick replies or to open url. They cannot send requests to any endpoint.

Inline-button as quick replies

Buttons or Quick Replies are built in nodes that allow you to get message recipient input by sending buttons in a message. When a quick reply is tapped, the value of the button is sent in the conversation or url is opened

Available buttons:

  • URL: Open a URL inside the client.

  • Postback: Allow the user to send a predefined message to the chat.

You can set postback as a special command for tekos in node to catch the message content and do specified actions. More about it you can find in the Tekos In node documentation.

How go get them working

You need to connect buttons node with tekos out node as it is the only option for them to get working. You cannot connect buttons node with the function node & http request as they are built specially for tekos dialogue platform.

Adaptive Cards buttons

We can also use built in buttons in the adaptive cards and specify in the tekos flow actions that they will trigger.

More about this you can find in the Adaptive Cards Action.Submit tutorial

Hints buttons

Hints buttons are really similar to quick replies but instead of opening a webpage or sending a message to the chat, they send a HTTP request to defined endpoint together with defined payload to identify the request. Also when a hint button is tapped it awaits for the HTTP response code and becomes unclickable.

Hints are object inside the hint array that is included in the msg.payload object

Here is an example code of function node.

msg.roomId = "!lpeAMqZBhqNNbcQkTq:m.tekos.co" // Room Id where message will be sent
msg.url = "https://"+env.get('BASE_URL')+'/_matrix/client/r0/rooms/' +msg.roomId+ '/send/m.room.message?access_token='+global.get('user_access_token')

msg.headers ={
 "Content-type": "application/json"
}

msg.payload = {
  "body": "",
  "msgtype": "m.text",
  "hints": [
    {
    "body": "Go further", //Value displayed in the chat
    "reply":"continue", //Value sent to the endpoint
    "type": "request_url_only",
    "request_url": env.get("FLOW_URL")+"/hint_button" //Endpoint adress
    },
    {
    "body": "I want to modify", //Value displayed in the chat
    "reply":"modify", //Value sent to the endpoint
    "type": "request_url_only",
    "request_url": env.get("FLOW_URL")+"/hint_button" //Endpoint adress
    }
  ]
};
return msg;

As you can see hint element include body, replay, type and request_url objects.

Body - It is the value displayed in the chat room. Replay - It is the payload sent to the endpoint Type - should always be “request_url_only” Resuest_url - It is the defined endpoint to which the replay payload will be sent.

Example payload after tapping the “Go Further” button, we can see an id which is the body in the function node and the “msg” containing the “replay” value. But we will also receive an “roomid” in which the button was pressed and the “senderid” of the person which taped the button.

This is how the inline-buttons looks like in the chat
Tekos Flow "buttons" node
Editing the buttons node
Flow in the tekos flow
Sample adaptive card