From 7cdfcdac645a1cd3ff835e2ceb0d338e3dcb5a59 Mon Sep 17 00:00:00 2001 From: Leifer Mendez Date: Tue, 18 Jan 2022 20:58:16 +0100 Subject: [PATCH] update readme --- README.md | 39 +++++++++++++++++--------- sql-bot.sql | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 sql-bot.sql diff --git a/README.md b/README.md index ddbdb3c..0ec94de 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,10 @@ #### Actualizado Enero 2022 El siguiente proyecto se realizó con fines educativos para el canal de [Youtube (Leifer Mendez)](https://www.youtube.com/channel/UCgrIGp5QAnC0J8LfNJxDRDw?sub_confirmation=1) donde aprendemos como usando node.js podemos crear un chatbot increíble que además le agregamos inteligencia artificial gracias al servicio de dialogflow. -

- -

- - +![](https://i.giphy.com/media/OBDi3CXC83WkNeLEZP/giphy.webp) > Si tienes una cuenta en __heroku__ puedes desplegar este proyecto con 1 click -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/leifermendez/bot-whatsapp) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/leifermendez/bot-ventas) > Comprarme un cafe! @@ -20,14 +16,14 @@ El siguiente proyecto se realizó con fines educativos para el canal de [Youtube #### Video Creación 🤖 - [Ver Video 1](https://www.youtube.com/watch?v=A_Xu0OR_HkE) -- [Ver Video 2 (Actulización)](https://www.youtube.com/watch?v=A_Xu0OR_HkE) +- [¿Como instalarlo? (Actulización)](https://youtu.be/5lEMCeWEJ8o) #### ¿Que puedo hacer con este chatbot? Puedes crear tus flujos de trabajo, ya sea usando mysql, dialogflow o simplemente condiciones en el codigo. IMAGE -## Instruciones +### Instruciones __Descargar o Clonar repositorio__ ![](https://i.imgur.com/dSpUbFz.png) @@ -54,7 +50,25 @@ Escanea el el código QR desde tu aplicación de Whatsapp > Cuando sale este mensaje tu BOT está __listo__ para trabajar! ![](https://i.imgur.com/bhYHUyH.png) -## ¿Como usarlo el chatbot de whatsapp? +### Configurar +Recuerda debes de crear tu archivo __.env__ basado en el archivo __.env.example__ +``` +######DATABASE: none, mysql, dialogflow + +DEFAULT_MESSAGE=true +SAVE_MEDIA=true +PORT=3000 +DATABASE=none +LANGUAGE=es +SQL_HOST= +SQL_USER= +SQL_PASS= +SQL_DATABASE= +``` + +> Si quieres usar la conexion via _mysql_ puedes importar el archivo [sql-bot.sql](s) + +### ¿Como usarlo el chatbot de whatsapp? > Escribe un mensaje al whatsapp que vinculaste con tu BOT ![](https://i.imgur.com/OSUgljQ.png) @@ -65,8 +79,7 @@ con el historial de conversación con el número de tu cliente ![](https://i.imgur.com/lrMLgR8.png) ![](https://i.imgur.com/UYcoUSV.png) -## Preguntar al BOT -> Puedes interactuar con el bot ejemplo escribele __Quieromeme__ y el bot debe responderte con la imagen - -![](https://i.imgur.com/cNAS51I.png) +### Preguntar al BOT +> Puedes interactuar con el bot ejemplo escribele __hola__ y el bot debe responderte! +![](https://i.imgur.com/cNAS51I.png) \ No newline at end of file diff --git a/sql-bot.sql b/sql-bot.sql new file mode 100644 index 0000000..0bbda74 --- /dev/null +++ b/sql-bot.sql @@ -0,0 +1,79 @@ +-- MySQL dump 10.13 Distrib 8.0.27, for Win64 (x86_64) +-- +-- Host: 127.0.0.1 Database: db_test +-- ------------------------------------------------------ +-- Server version 5.7.33 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `initial` +-- + +DROP TABLE IF EXISTS `initial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `initial` ( + `option_key` varchar(500) DEFAULT NULL, + `keywords` varchar(45) DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `initial` +-- + +LOCK TABLES `initial` WRITE; +/*!40000 ALTER TABLE `initial` DISABLE KEYS */; +INSERT INTO `initial` VALUES ('STEP_1','hola, hola!,ola,inicio,welcome',2),('STEP_2','cursos,info,curso',3),('STEP_2_1','angular',4),('STEP_2_2','node',5),('STEP_2_3','ngrx',6),('STEP_2_4','aws',7),('STEP_3','asesor',8),('STEP_4','muchas gracias,gracias,vale gracias',9); +/*!40000 ALTER TABLE `initial` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `response` +-- + +DROP TABLE IF EXISTS `response`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `response` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `option_key` varchar(45) DEFAULT NULL, + `replyMessage` varchar(45) DEFAULT NULL, + `trigger` varchar(45) DEFAULT NULL, + `media` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `response` +-- + +LOCK TABLES `response` WRITE; +/*!40000 ALTER TABLE `response` DISABLE KEYS */; +INSERT INTO `response` VALUES (1,'STEP_1','Hola soy el bot escribe curso',NULL,NULL),(2,'STEP_2','Te envio esto',NULL,'https://s2.q4cdn.com/175719177/files/doc_presentations/Placeholder-PDF.pdf'); +/*!40000 ALTER TABLE `response` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2022-01-18 20:52:34