Merge branch 'feature/monorepo' of github.com:leifermendez/bot-whatsapp into feature/monorepo

This commit is contained in:
Leifer Mendez
2022-10-29 12:16:21 +02:00
7 changed files with 149 additions and 1 deletions

View File

@@ -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",

95
packages/io/TODO.md Normal file
View File

@@ -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'])
```

0
packages/io/index.js Normal file
View File

View File

@@ -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'])

View File

22
packages/io/package.json Normal file
View File

@@ -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": {
}
}

14
packages/provider/TODO.md Normal file
View File

@@ -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_