Bots

How to create your own bot in Appinall Introduction If you have information you would like to distribute through Appinall you can use your own bot, built into External Appinal Bots system. To do this, your bot must be compatible with the Appinalls’ mechanism of external bots for the most complete realization of the provided features. Compatibility consist to use the data structures to display your data in the Appinall format bots. The request to your bot is delivered in the form of a URL Query with several fields, of which 2 (rqv=abc&ctx=def ) to define the query, and a contextual line that the Appinalls’ server returns you from a previous request. Your bot analyzes the query and its context and generates a JSON response to display in it in Appinall. Thus implemented mechanism for dialogue between the bot and Appinall. Bot JSON response Appinall uses the following JSON format for displaying info from external bots: { “Txt”:”text for the reply:”, “Items”:[ { “Title”:”Item Title”, “Description”:”Text of item”, “Misc”:”Additional string to display”, “URL”:”http://www.somesite.com/abcd/content/1104845.html”, “ImgURL”:”http://www.somesidewithimages.com/db/PICTURES/ 264684.jpg” }, { “Title”:”Ksasteps down as India coach”, “Description”:”Abul Ksanto has stepped down “, “Misc”:”Author: Guandun – 2017-04-20 17:59:29 GMT”, “URL”:”http://www.espncricinfo.com/india/content/story/1104895.html”, “ImgURL”:”http://a.espncdn.com/combiner/i?img=/media/motion/420_700″ } ], “Btns”:[ { “Tp”:”data”, “Txt”:”Text to display”, “Cmd”:”Text sent as a command on click” }, { “Tp”:”data”, “Txt”:”Secobd Button”, “Cmd”:”*}@ is a second command” } ], “Ctx”:”eyJCb3QiOiJUb3B”, “Input”:”yes” } The symbolic Pseudo structure  is as follows: struct { Btns []struct { Cmd string `json:”Cmd”` Tp  string `json:”Tp”` Txt string `json:”Txt”` } `json:”Btns”` Ctx   string `json:”Ctx”` Items []struct { Cmd         string `json:”Cmd”` Description string `json:”Description”` ImgURL      string `json:”ImgURL”` Misc        string `json:”Misc”` Title       string `json:”Title”` URL         string `json:”URL”` } `json:”Items”` Txt string `json:”Txt”` Input string `json:”Input”` } As can be seen in the response of your bot can be 5 different elements, allowing to implement a bot with rich features: 2 arrays and 3 lines. Txt- is a “pure” text displaying on the top of the bot reply. It refers to a whole response. No HTML tags are allowed here. Items  – will show the list of result items in standard form containing 4 strings for visual elements: Title, Description, Image(URL)   and Misc It also can contain reference URL for navigating to the source on clicking Items array can be empty list Btns – will show clickable buttons to send predefined commands to your bot. Each button has 3 field: Text to display Cmd – a string to send back to your bot on clicking Type –  the only allowed value is Data Btns array also can be empty Input  – (“Yes”/”No”) defines whether the input field is shown at the moment . The field  is used to type and send a command to the bot, for example to define search criteria. The samples below show Txt field with one of displaying items and   Txt field with buttons.