SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
GROOGRAMGROOGRAM
¡bots de telegram con groovy!
@tf_gerson
Gerson Cabrera, desarrollador Groovy en b2boost
1
INTRODUCCIÓNINTRODUCCIÓN
Como crear un bot y con gurarlo.
Arquitectura general del bot y comunicación con
nuestra aplicación.
Ejemplos de código en Groovy.
Review de bots varios.
Conclusiones.
2 . 1
Un bot es un programa informático que ejecuta tareas
repetitivas a través de internet
2 . 2
CREAR BOTS EN TELEGRAMCREAR BOTS EN TELEGRAM
@BotFather
2 . 3
UN BOT FUNCIONA COMO UN CHATUN BOT FUNCIONA COMO UN CHAT
CUALQUIERACUALQUIERA
2 . 4
CUIDADO CON LA PRIVACIDAD CUANDOCUIDADO CON LA PRIVACIDAD CUANDO
USES BOTSUSES BOTS
2 . 5
ARQUITECTURA DE UN BOTARQUITECTURA DE UN BOT
2 . 6
TELEGRAM APITELEGRAM API
se puede consultar aquí
https://api.telegram.org/bot<token>/METHOD_NAME
https://api.telegram.org/bot<token>/sendMessage
2 . 7
CONECTAR EL WEBHOOK CON TUCONECTAR EL WEBHOOK CON TU
APLICACIÓNAPLICACIÓN
post/get:
https://api.telegram.org/bot751729:AAFJRaz8sUequ/setWebhook
body: {"url":"www.urlbase.com"}
2 . 8
¡¡PERO DAME CÓDIGO!!!¡¡PERO DAME CÓDIGO!!!
2 . 9
CONTROLLERCONTROLLER
@Controller
class TelegramController {
@Inject
TelegramHandler telegramHandler
@Post("/webhook")
void webhook(@Body Update update) {
telegramHandler.messageReceiver(update)
}
}
2 . 10
UPDATE MODELUPDATE MODEL
2 . 11
TELEGRAM HANDLERTELEGRAM HANDLER
@Log
@Singleton
class TelegramHandler {
@Inject
MessageService messageService
private static final def commands = ['start', 'help']
void messageReceiver(Update params) {
String message = params?.message?.text?.drop(1)
log.info("message received $message")
validateMessage(message)
"$message"(params)
// invokeMethod(message, params)
}
2 . 12
MESSAGE SERVICEMESSAGE SERVICE
@Singleton
class MessageService {
@Client("https://api.telegram.org/bot848542380:AAEjlY6qaxA0eE
@Inject
RxHttpClient httpClient
void sendNotificationToTelegram(String message, String chatId
httpClient.toBlocking().exchange("/sendMessage?text=$mess
}
}
2 . 13
PROBLEMAS QUE ME HE ENCONTRADOPROBLEMAS QUE ME HE ENCONTRADO
2 . 14
1. Logs y gestión de errores (Telegram reenvía por
defecto los mensajes erróneos)
2. Tienes que hablar al bot para que pueda hablarte
3. Jerarquía de bots
4. Tiempo de respuesta de tu servidor
5. Funcionalidades complejas resultan frustrantes
para usuarios no técnicos
2 . 15
EJEMPLOS DE USOEJEMPLOS DE USO
Algunos bots vienen integrados en telegram por
defecto, podemos citarlos usando @ como a cualquier
otro bot/usuario:
2 . 16
INLINE QUERIESINLINE QUERIES
2 . 17
Un bot no puede activar comandos pero puede mandar
el mensaje con una / como si fuera un link al mismo
2 . 18
@TRANSCRIBER_BOT@TRANSCRIBER_BOT
2 . 19
@NOSPOILERSBOT@NOSPOILERSBOT
2 . 20
@M30MADRIDBOT@M30MADRIDBOT
2 . 21
CONCLUSIONESCONCLUSIONES
Los bots son de gran utilidad para el desarrollador
Con gurar la privacidad
Hay que tener cuidado con la gestión de errores y
la jerarquía
Potencial ilimitado
El proceso de creación de bots se puede
automatizar fácilmente
2 . 22
AGRADECIMIENTOS Y, ¿PREGUNTAS?AGRADECIMIENTOS Y, ¿PREGUNTAS?
Groogram Github repo
2 . 23

Contenu connexe

Similaire à Groogram, bots de telegram con groovy

Creando un Bot usando aplicación de Telegram
Creando un Bot usando aplicación de TelegramCreando un Bot usando aplicación de Telegram
Creando un Bot usando aplicación de Telegramssuser8cfe271
 
Creando un bot sobre Google Cloud Platform
Creando un bot sobre Google Cloud PlatformCreando un bot sobre Google Cloud Platform
Creando un bot sobre Google Cloud PlatformDaniel Alvarez
 
Manual de usuario_rev1 Butiá
Manual de usuario_rev1  ButiáManual de usuario_rev1  Butiá
Manual de usuario_rev1 ButiáMarcos Berttoni
 
Construye tu bot con text-to-speech y conéctalo en línea
Construye tu bot con text-to-speech y conéctalo en líneaConstruye tu bot con text-to-speech y conéctalo en línea
Construye tu bot con text-to-speech y conéctalo en líneaCarlaVanesaMamaniCha
 
Los chats y su uso en educación
Los chats y su uso en educaciónLos chats y su uso en educación
Los chats y su uso en educaciónSEP
 
Cuando haces bot ya no hay stop!!
Cuando haces bot ya no hay stop!!Cuando haces bot ya no hay stop!!
Cuando haces bot ya no hay stop!!SolidQ
 
La web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitLa web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitAlex Fuentes
 
10 programas populares para twitter
10 programas populares para twitter10 programas populares para twitter
10 programas populares para twitterjesslorer10
 
Robots en Google Wave
Robots en Google WaveRobots en Google Wave
Robots en Google WaveSumavisos
 
Creando un bot con Bot Framework y LUIS
Creando un bot con Bot Framework y LUISCreando un bot con Bot Framework y LUIS
Creando un bot con Bot Framework y LUISLuis Beltran
 
Bots más humanos con Alexa
Bots más humanos con AlexaBots más humanos con Alexa
Bots más humanos con AlexaLennin Cenas
 
¡Que lo haga otro! Automatizaciones SEO para vivir mejor
¡Que lo haga otro! Automatizaciones SEO para vivir mejor¡Que lo haga otro! Automatizaciones SEO para vivir mejor
¡Que lo haga otro! Automatizaciones SEO para vivir mejorIñaki Huerta (ikhuerta)
 

Similaire à Groogram, bots de telegram con groovy (20)

Creando un Bot usando aplicación de Telegram
Creando un Bot usando aplicación de TelegramCreando un Bot usando aplicación de Telegram
Creando un Bot usando aplicación de Telegram
 
Practica adicional
Practica adicionalPractica adicional
Practica adicional
 
El arsenal del microsoft bot framework
El arsenal del microsoft bot frameworkEl arsenal del microsoft bot framework
El arsenal del microsoft bot framework
 
Creando un bot sobre Google Cloud Platform
Creando un bot sobre Google Cloud PlatformCreando un bot sobre Google Cloud Platform
Creando un bot sobre Google Cloud Platform
 
Getting Started with ChatBots
Getting Started with ChatBotsGetting Started with ChatBots
Getting Started with ChatBots
 
Manual de usuario_rev1 Butiá
Manual de usuario_rev1  ButiáManual de usuario_rev1  Butiá
Manual de usuario_rev1 Butiá
 
Construye tu bot con text-to-speech y conéctalo en línea
Construye tu bot con text-to-speech y conéctalo en líneaConstruye tu bot con text-to-speech y conéctalo en línea
Construye tu bot con text-to-speech y conéctalo en línea
 
Los chats y su uso en educación
Los chats y su uso en educaciónLos chats y su uso en educación
Los chats y su uso en educación
 
Cuando haces bot ya no hay stop!!
Cuando haces bot ya no hay stop!!Cuando haces bot ya no hay stop!!
Cuando haces bot ya no hay stop!!
 
Introducción a Bot Framework Composer
Introducción a Bot Framework ComposerIntroducción a Bot Framework Composer
Introducción a Bot Framework Composer
 
La web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitLa web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo Toolkit
 
Creando Bots para Microsoft Teams
Creando Bots para Microsoft TeamsCreando Bots para Microsoft Teams
Creando Bots para Microsoft Teams
 
10 programas populares para twitter
10 programas populares para twitter10 programas populares para twitter
10 programas populares para twitter
 
Robots en Google Wave
Robots en Google WaveRobots en Google Wave
Robots en Google Wave
 
Novedades en MetaTrader 4 y mql4
Novedades en MetaTrader 4 y mql4Novedades en MetaTrader 4 y mql4
Novedades en MetaTrader 4 y mql4
 
Protocolo1
Protocolo1Protocolo1
Protocolo1
 
Creando un bot con Bot Framework y LUIS
Creando un bot con Bot Framework y LUISCreando un bot con Bot Framework y LUIS
Creando un bot con Bot Framework y LUIS
 
Bots más humanos con Alexa
Bots más humanos con AlexaBots más humanos con Alexa
Bots más humanos con Alexa
 
¡Que lo haga otro! Automatizaciones SEO para vivir mejor
¡Que lo haga otro! Automatizaciones SEO para vivir mejor¡Que lo haga otro! Automatizaciones SEO para vivir mejor
¡Que lo haga otro! Automatizaciones SEO para vivir mejor
 
Instalación chat alianza
Instalación chat alianzaInstalación chat alianza
Instalación chat alianza
 

Groogram, bots de telegram con groovy