diff --git a/packages/cli/package.json b/packages/cli/package.json index 46b62cd..cee6606 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,8 +1,9 @@ { "name": "cli", - "version": "1.0.0", + "version": "0.0.1", "description": "", "main": "index.js", + "private":true, "scripts": { "cli:dev": "NODE_ENV=dev node ./index.js", "cli:rollup": "rollup index.js --config ./rollup-cli.config.js", diff --git a/packages/io/TODO.md b/packages/io/TODO.md new file mode 100644 index 0000000..04567d1 --- /dev/null +++ b/packages/io/TODO.md @@ -0,0 +1,95 @@ +# @bot-whatsapp/io + + +### Caso de uso +> Una persona escribe `hola` + +__addKeyword__ recibe `string | string[]` +> `sensitivy` false _default_ + +- [] addKeyword +- [] addAnswer +- [] Si ha contactado previamente. Seguir continuida + +```js +// bootstrap.js Como iniciar el provider +const { inout, provider, database } = require('@bot-whatsapp') + +/** + * async whatsapp-web, twilio, meta + * */ + +const bootstrap = async () => { + console.log(`Iniciando....`) + const client = await provider.start() + /** + * - QR + * - Endpoint + * - Check Token Meta, Twilio + * - Return events? on message + * */ + console.log(`Fin...`) + // Esto es opcional ? no deberia ser necesario + client.on('message', ({number, body,...}) => { + // Incoming message + }) +} + +``` + +```js +// flow.js Como agregar keywords y respuestas +const { inout, provider, database } = require('@bot-whatsapp') + +await inout.addKeyword('hola') +.addAnswer('Bienvenido a tu tienda 🥲') +.addAnswer('escribe *catalogo* o *ofertas*') + +await inout.addKeyword(['catalogo','ofertas']) +.addAnswer('Este es nuestro CATALOGO mas reciente!',{buttons:[ + {"body":"Xiaomi"}, + {"body":"Samsung"} +]}) + +await inout.addKeyword('Xiaomi') +.addAnswer('Estos son nuestro productos XIAOMI ....',{media:'https://....'}) +.addAnswer('Si quieres mas info escrbie *info*') + + +await inout +.addKeyword('chao!') +.addAnswer('bye!') +.addAnswer('Recuerda que tengo esta promo',{ + media:'https://media2.giphy.com/media/VQJu0IeULuAmCwf5SL/giphy.gif', +}) + +await inout.addKeyword('Modelo C',{sensitivy:false}) +.addAnswer('100USD', {media:'http//:...'}) + +await inout.addKeyword('hola!',{sensitivy:false}) +.addAnswer('Bievenido Escribe *productos*') + +await inout.addKeyword('productos',{sensitivy:false}) +.addAnswer('Esto son los mas vendidos') +.addAnswer('*PC1* Precio 10USD',{media:'https://....'}) +.addAnswer('*PC2* Precio 10USD',{media:'https://....'}) + +await inout.addKeyword('PC1',{sensitivy:false}) +.addAnswer('Bievenido Escribe *productos*') + + + +const answerOne = await inout.addAnswer({ + message:'Como estas!', + media:'https://media2.giphy.com/media/VQJu0IeULuAmCwf5SL/giphy.gif', +}) + + +const otherAnswer = await inout.addAnswer('Aprovecho para decirte!') + +answerOne.push(otherAnswer) + + +inout.addKeywords(['hola','hi','ola']) + +``` diff --git a/packages/io/index.js b/packages/io/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/io/keyword/addKeyword.js b/packages/io/keyword/addKeyword.js new file mode 100644 index 0000000..dc45e81 --- /dev/null +++ b/packages/io/keyword/addKeyword.js @@ -0,0 +1,16 @@ +/** + * + * @param {*} message `string | string[]` + * @param {*} options {sensitivy:boolean} defaulta false + */ +const addKeyword = (message, options) => { + if (typeof message === 'string') return 1 + return 0 +} + +module.exports = { addKeyword } +// await inout.addKeyword('hola') +// .addAnswer('Bienvenido a tu tienda 🥲') +// .addAnswer('escribe *catalogo* o *ofertas*') + +// await inout.addKeyword(['catalogo','ofertas']) \ No newline at end of file diff --git a/packages/io/keyword/index.js b/packages/io/keyword/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/io/package.json b/packages/io/package.json new file mode 100644 index 0000000..aec99b4 --- /dev/null +++ b/packages/io/package.json @@ -0,0 +1,22 @@ +{ + "name": "io", + "version": "0.0.1", + "description": "", + "main": "index.js", + "private": true, + "scripts": { + "io:dev": "NODE_ENV=dev node ./index.js", + "io:rollup": "rollup index.js --config ./rollup-cli.config.js", + "format:check": "prettier --check .", + "format:write": "prettier --write .", + "lint:check": "eslint .", + "lint:fix": "eslint --fix .", + "build:io": "npm run format:write && npm run lint:fix && npm run io:rollup" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + + } +} \ No newline at end of file diff --git a/packages/provider/TODO.md b/packages/provider/TODO.md new file mode 100644 index 0000000..4efe110 --- /dev/null +++ b/packages/provider/TODO.md @@ -0,0 +1,14 @@ +# @bot-whatsapp/provider + +```js +// bootstrap.js Como iniciar el provider +const { inout, provider, database } = require('@bot-whatsapp') + +provider.start() +provider.close() + +``` + +- [ ] whatsapp-web.js _verificar update_ +- [ ] Meta _verificar tokens_ +- [ ] Twilio _verificar tokens_ \ No newline at end of file