Buttons
Last updated
Last updated
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.
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.
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.
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 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.
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.