Message Edit
 

Message edit lets the user make modifications to a message. This is displayed as a response to the user when an internal component is triggered on the Cliq platform. A message edit can be invoked by invoking a button function.
​The list of attributes required to invoke a message edit are given in the table below. The mandatory fields are indicated with a *
 

Attribute NameData TypeDescription
type*StringAn identifier to edit message.
Allowed values:
type=message_edit
text*StringA response message.

Besides this, you can use other message objects as attributes. Head on over here to know more.

Syntax for message edit

 


{
"type":"message_edit",
"text":text
};

 

To understand platform message edit, let's take a simple example of a Tickets bot posting details of unassigned tickets. On executing a bot menu action, displays the user with a message that contains details about the ticket along with a Claim Ticket button. When the user clicks on the button, the message gets edited with a new info: Olivia (First name of the user) has claimed the ticket along with the ticket details. Follow the syntax below for a better understanding.

Sample bot menu handler code
 


response = Map();
response.put("text","#137  Payments processing server down");
card = Map();
card.put("title","Unassigned tickets");
card.put("theme","modern-inline");
response.put("card",card);
buttonsList = list();
buttonsList0 = Map();
buttonsList0.put("label","Claim Ticket");
buttonsList0.put("type","+");
action = Map();
action.put("type","invoke.function");
data = Map();
data.put("name","message");
action.put("data",data);
buttonsList0.put("action",action);
buttonsList.add(buttonsList0);
response.put("buttons",buttonsList);
return response;

 

Sample function code
 


response = Map();
slidesList = list();
slidesList0 = Map();
slidesList0.put("type","text");
text = "*Unassigned Tickets*" + "\n" + user.get("first_name") + "\t" + "has claimed the ticket" + "\t" + "#137 Payments processing server down";
char = {"text":text,"type":"message_edit"};
slidesList0.put("data"," ");
slidesList.add(slidesList0);
char.put("slides",slidesList);
return char;