Closed bbaruque closed 7 years ago
In this issue, a mock up was implemented that enables our Telegram Chatbot to receive messages and answer in a simple manner using an api.ai agent as a language parser. In order to do so, a webservice was built, using Java Spark, and deployed on Heroku.
As a first approach, api.ai’s Telegram One-Click-Integration was used, so the Telegram messages were transferred directly to api.ai. The parsed output was then transmitted to the webservice via webhook. Unfortunately, this approach does not allow accessing a lot of functionalities provided by Telegram, for example handling location attachment or accessing user data directly.
Because of this fact, a structure similar to the one proposed #21 was implemented, in which Telegram is connected directly with our webservice using webhook and a Telegram API. The extracted messages from Telegram are then directed to the api.ai agent using the http API.
The next steps would be to organize the already existing code into a useful package and class structure as well as implementing tests and a logging mechanism to debug easily, together with configuring the repository in a way that the setup configurations won't be publicly accessible.
Used examples during development Telegram Webhook Example using Java Spark: https://github.com/pengrad/java-telegram-bot-api/tree/master/sample/src/main/java/com/pengrad/telegrambot/sample/spark
Example Java api.ai agent (used for first approach - one click integration): https://github.com/mrisney/api-ai-agent
How would the telegram bot + API.ai "talk" to our server aplication? A mock up service will be implemented.