mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
ci: ⚡ add github release
ci: ⚡ add github release
This commit is contained in:
1
.github/workflows/netlify.yml
vendored
1
.github/workflows/netlify.yml
vendored
@@ -3,7 +3,6 @@ name: 📄 (PROD) Desplegando documentacion
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
|
||||||
- next-release
|
- next-release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/releases-dev.yml
vendored
2
.github/workflows/releases-dev.yml
vendored
@@ -3,7 +3,7 @@ name: 🚀 (DEV) Liberando versiones
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- next-release
|
- release/next
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
############ RELEASE ############
|
############ RELEASE ############
|
||||||
|
|||||||
5
.github/workflows/releases.yml
vendored
5
.github/workflows/releases.yml
vendored
@@ -1,8 +1,9 @@
|
|||||||
name: 🚀⚡ Liberando versiones
|
name: 🚀⚡ Liberando versiones
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [created]
|
branches:
|
||||||
|
- release/production
|
||||||
jobs:
|
jobs:
|
||||||
############ RELEASE ############
|
############ RELEASE ############
|
||||||
release:
|
release:
|
||||||
|
|||||||
@@ -97,5 +97,8 @@
|
|||||||
"npm": "please-use-yarn",
|
"npm": "please-use-yarn",
|
||||||
"yarn": ">=3"
|
"yarn": ">=3"
|
||||||
},
|
},
|
||||||
"author": "Leifer Mendez <leifer33@gmail.com>"
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/core": "^4.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/bot",
|
"name": "@bot-whatsapp/bot",
|
||||||
"version": "0.0.52-alpha.0",
|
"version": "0.0.53-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.bot.cjs",
|
"main": "./lib/bundle.bot.cjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/cli",
|
"name": "@bot-whatsapp/cli",
|
||||||
"version": "0.0.59-alpha.0",
|
"version": "0.0.60-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-bot-whatsapp",
|
"name": "create-bot-whatsapp",
|
||||||
"version": "0.0.70-alpha.0",
|
"version": "0.0.71-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/database",
|
"name": "@bot-whatsapp/database",
|
||||||
"version": "0.0.51-alpha.0",
|
"version": "0.0.52-alpha.0",
|
||||||
"description": "Esto es el conector a mysql, pg, mongo",
|
"description": "Esto es el conector a mysql, pg, mongo",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -47,13 +47,20 @@ export default component$(() => {
|
|||||||
npm create bot-whatsapp@latest
|
npm create bot-whatsapp@latest
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex w-full sm:w-auto">
|
<div class="flex w-full sm:w-auto gap-3">
|
||||||
<a
|
<a
|
||||||
href="/docs"
|
href="/docs"
|
||||||
class="btn bg-gray-50 dark:bg-transparent"
|
class="btn bg-gray-50 dark:bg-transparent"
|
||||||
>
|
>
|
||||||
Ver documentación
|
Ver documentación
|
||||||
</a>
|
</a>
|
||||||
|
<a
|
||||||
|
target={'_blank'}
|
||||||
|
href="https://youtu.be/DEIyGyJNGa8"
|
||||||
|
class="btn bg-gray-50 dark:bg-transparent"
|
||||||
|
>
|
||||||
|
Ver video
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ Estamos trabajando en el apartado de la documentación lo más claro posible. Pu
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Meta: Configuración
|
||||||
|
|
||||||
|
Estamos trabajando en el apartado de la documentación lo más claro posible. Puedes encontrar los [detalles aquí](/docs/providers/meta)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
<Navigation
|
<Navigation
|
||||||
pages={[
|
pages={[
|
||||||
{ name: 'Conversaciones', link: '/docs/providers' },
|
{ name: 'Conversaciones', link: '/docs/providers' },
|
||||||
|
|||||||
@@ -1,3 +1,159 @@
|
|||||||
|
import Alert from '../../../../components/widgets/Alert'
|
||||||
|
import Navigation from '../../../../components/widgets/Navigation'
|
||||||
|
|
||||||
# Meta
|
# Meta
|
||||||
|
|
||||||
...
|
La Plataforma de WhatsApp Business permite a medianas y grandes empresas comunicarse con sus clientes a gran escala.
|
||||||
|
Puedes iniciar conversaciones con clientes en apenas unos minutos, enviarles notificaciones de atención al cliente o actualizaciones de compras, ofrecerles un nivel de servicio personalizado y
|
||||||
|
prestarles ayuda a través del canal que ellos prefieran.
|
||||||
|
|
||||||
|
### Requerimientos
|
||||||
|
|
||||||
|
- Registrar una cuenta de [facebook developers](https://developers.facebook.com/apps)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Requerimientos
|
||||||
|
|
||||||
|
Debes crear una aplicación nueva. Para ello haz clic en el botón **Crear aplicación**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
En esta pantalla debes de seleccionar **Empresa o Business**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
En el siguiente paso debes escribir un nombre al tu aplicación también colocar un email de contacto y seleccionar la aplicación de Test Business
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Ahora dirígete a la sección de Ajustes de WhatsApp.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Está la parte donde encontraras el token acceso y también puedes ver el número **desde donde** se envía los mensajes de WhatsApp
|
||||||
|
y **a donde** se va a enviar.
|
||||||
|
Como estás en la versión de prueba, deberás dar de alta los números a los que quieres enviar.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
En esta misma página puedes encontrar el apartado de **Webhook** que pronto necesitaremos usar
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
En el **archivo principal** del bot donde estás implementando la función del adaptador de meta vas a colocar los siguientes datos:
|
||||||
|
|
||||||
|
- **numberId:** Lo puedes encontrar en la pagina anterior
|
||||||
|
- **jwtToken:** Lo puedes encontrar en la pagina anterior
|
||||||
|
- **verifyToken:** Puedes escribir lo que quieras es como una palabra clave
|
||||||
|
|
||||||
|
<Alert>
|
||||||
|
En el ejemplo de abajo puedes ver como una sugerencia de como puede ser
|
||||||
|
utilizando variables de entorno
|
||||||
|
</Alert>
|
||||||
|
|
||||||
|
```js
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
|
||||||
|
const adapterProvider = createProvider(MetaProvider, {
|
||||||
|
jwtToken: process.env.JWTOKEN, //EAARBW3ZBGU0UBAACDjtQIzI8JuEa.............
|
||||||
|
numberId: process.env.NUMBER_ID, //103975305758520
|
||||||
|
verifyToken: process.env.VERIFY_TOKEN, //LO_QUE_SEA
|
||||||
|
})
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Luego de ejecutar el bot encontraras un mensaje en la consola similar al siguiente.
|
||||||
|
Donde podrás encontrar la URL para tu **webhook**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npm start
|
||||||
|
|
||||||
|
> bot-whatsapp-base-meta-memory@1.0.0 start
|
||||||
|
> node app.js
|
||||||
|
|
||||||
|
|
||||||
|
[meta]: Agregar esta url "WHEN A MESSAGE COMES IN"
|
||||||
|
[meta]: POST http://localhost:3000/webhook
|
||||||
|
[meta]: Más información en la documentacion
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ¿Ahora que hago?
|
||||||
|
|
||||||
|
Podrás observar que el bot inicia un servicio HTTP (endpoint) que debe estar en un servidor en linea para que puedas conectarlo con Meta.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Opción 1:
|
||||||
|
|
||||||
|
Puedes hacer pruebas en local atrevés de un servidor proxy tunnel.
|
||||||
|
Descarga **[ngork](https://ngrok.com/download)** es una herramienta gratuita que nos ayudara con esto.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Esto genera una URL en línea que podemos usar en la parte de **WebHook** de Meta
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Opción 2:
|
||||||
|
|
||||||
|
Si ya tienes desplegado tu bot en un servidor tienes que obtener la IP publica o subdominio que te proporcionaron. **Ejemplo** si estas usando
|
||||||
|
[Railway](https://railway.app/) puedes ir a la seccion de ajustes y generar un subdominio. Ya tendriamos el **WebHook**
|
||||||
|
`https://base-twilio-memory-production.up.railway.app/twilio-hook`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<Navigation
|
||||||
|
pages={[
|
||||||
|
{ name: 'Proveedores', link: '/docs/providers' },
|
||||||
|
{ name: 'Meta', link: '/docs/providers/meta' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/portal",
|
"name": "@bot-whatsapp/portal",
|
||||||
"version": "0.0.9-alpha.0",
|
"version": "0.0.10-alpha.0",
|
||||||
"description": "Portal WEB para escanear QR",
|
"description": "Portal WEB para escanear QR",
|
||||||
"main": "./lib/portal.http.cjs",
|
"main": "./lib/portal.http.cjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/provider",
|
"name": "@bot-whatsapp/provider",
|
||||||
"version": "0.0.57-alpha.0",
|
"version": "0.0.58-alpha.0",
|
||||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -3,16 +3,50 @@ const { join } = require('path')
|
|||||||
const { execFile } = require('node:child_process')
|
const { execFile } = require('node:child_process')
|
||||||
const process = require('node:process')
|
const process = require('node:process')
|
||||||
const util = require('node:util')
|
const util = require('node:util')
|
||||||
|
const { Octokit } = require('@octokit/core')
|
||||||
|
|
||||||
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
|
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
|
||||||
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
|
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
|
||||||
const [PKG_ARG, PKG_ARG_VERSION, NPM_TOKEN] = process.argv.slice(2) || [null]
|
const [PKG_ARG, PKG_ARG_VERSION, NPM_TOKEN, GITHUB_TOKEN] = process.argv.slice(
|
||||||
|
2
|
||||||
|
) || [null]
|
||||||
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
||||||
|
|
||||||
const cmd = util.promisify(execFile)
|
const cmd = util.promisify(execFile)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publicar Release en Github
|
||||||
|
* @param {*} name
|
||||||
|
* @param {*} tag_name
|
||||||
|
* @param {*} auth
|
||||||
|
* @param {*} owner
|
||||||
|
* @param {*} repo
|
||||||
|
*/
|
||||||
|
const githubGithubRelease = async (
|
||||||
|
name = '',
|
||||||
|
tag_name = '',
|
||||||
|
auth = '',
|
||||||
|
owner = 'codigoencasa',
|
||||||
|
repo = 'bot-whatsapp'
|
||||||
|
) => {
|
||||||
|
const octokit = new Octokit({
|
||||||
|
auth,
|
||||||
|
})
|
||||||
|
|
||||||
|
await octokit.request(`POST /repos/${owner}/${repo}/releases`, {
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
tag_name,
|
||||||
|
name,
|
||||||
|
body: 'Description of the release',
|
||||||
|
draft: false,
|
||||||
|
prerelease: false,
|
||||||
|
generate_release_notes: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Token
|
* Create Token
|
||||||
*/
|
*/
|
||||||
@@ -147,6 +181,7 @@ const publishRelease = async (packageName, latest = null) => {
|
|||||||
const main = async () => {
|
const main = async () => {
|
||||||
if (PKG_ARG) {
|
if (PKG_ARG) {
|
||||||
let EXIST_VERSION = true
|
let EXIST_VERSION = true
|
||||||
|
const githubToken = GITHUB_TOKEN ? GITHUB_TOKEN.split('=').at(1) : null
|
||||||
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
||||||
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||||
const pkgNumber = PKG_ARG_VERSION
|
const pkgNumber = PKG_ARG_VERSION
|
||||||
@@ -161,6 +196,7 @@ const main = async () => {
|
|||||||
}
|
}
|
||||||
await packRelease(pkgName)
|
await packRelease(pkgName)
|
||||||
await publishRelease(pkgName, pkgNumber)
|
await publishRelease(pkgName, pkgNumber)
|
||||||
|
await githubGithubRelease(`v${pkgNumber}`, pkgNumber, githubToken)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
FROM node:lts-bullseye as bot
|
FROM node:18-bullseye as bot
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm i
|
RUN npm i
|
||||||
COPY . .
|
COPY . .
|
||||||
|
ARG RAILWAY_STATIC_URL
|
||||||
|
ARG PUBLIC_URL
|
||||||
ARG PORT
|
ARG PORT
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|||||||
@@ -5,26 +5,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
**Con esta librería, puedes construir flujos automatizados de conversación de manera agnóstica al proveedor de WhatsApp,** configurar respuestas automatizadas para preguntas frecuentes, recibir y responder mensajes de manera automatizada, y hacer un seguimiento de las interacciones con los clientes. Además, puedes configurar fácilmente disparadores que te ayudaran a expandir las funcionalidades sin límites. **[Ver más informacion](https://bot-whatsapp.netlify.app/)**
|
**Con esta librería, puedes construir flujos automatizados de conversación de manera agnóstica al proveedor de WhatsApp,** configurar respuestas automatizadas para preguntas frecuentes, recibir y responder mensajes de manera automatizada, y hacer un seguimiento de las interacciones con los clientes. Además, puedes configurar fácilmente disparadores que te ayudaran a expandir las funcionalidades sin límites. **[Ver documentación](https://bot-whatsapp.netlify.app/)**
|
||||||
|
|
||||||
```js
|
|
||||||
const main = async () => {
|
|
||||||
const adapterDB = new MockAdapter()
|
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
|
||||||
|
|
||||||
const adapterProvider = createProvider(BaileysProvider, {
|
|
||||||
accountSid: process.env.ACC_SID,
|
|
||||||
authToken: process.env.ACC_TOKEN,
|
|
||||||
vendorNumber: process.env.ACC_VENDOR,
|
|
||||||
})
|
|
||||||
|
|
||||||
createBot({
|
|
||||||
flow: adapterFlow,
|
|
||||||
provider: adapterProvider,
|
|
||||||
database: adapterDB,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
npm install
|
||||||
|
|||||||
@@ -5,86 +5,62 @@ const {
|
|||||||
addKeyword,
|
addKeyword,
|
||||||
} = require('@bot-whatsapp/bot')
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
require('./server.http')
|
const QRPortalWeb = require('@bot-whatsapp/portal')
|
||||||
|
|
||||||
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
||||||
const JsonFileAdapter = require('@bot-whatsapp/database/json')
|
const JsonFileAdapter = require('@bot-whatsapp/database/json')
|
||||||
|
|
||||||
/**
|
const flowDocs = addKeyword([
|
||||||
* Aqui declaramos los flujos hijos, los flujos se declaran de atras para adelante, es decir que si tienes un flujo de este tipo:
|
'doc',
|
||||||
*
|
'documentacion',
|
||||||
* Menu Principal
|
'documentación',
|
||||||
* - SubMenu 1
|
]).addAnswer([
|
||||||
* - Submenu 1.1
|
'📄 Aquí encontras las documentación recuerda que puedes mejorarla',
|
||||||
* - Submenu 2
|
'https://bot-whatsapp.netlify.app/',
|
||||||
* - Submenu 2.1
|
])
|
||||||
*
|
|
||||||
* Primero declaras los submenus 1.1 y 2.1, luego el 1 y 2 y al final el principal.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const flowBolsos2 = addKeyword(['bolsos2', '2'])
|
const flowTuto = addKeyword(['tutorial', 'tuto']).addAnswer([
|
||||||
.addAnswer('🤯 *MUCHOS* bolsos ...')
|
'🙌 Aquí encontras un ejemplo rapido',
|
||||||
.addAnswer('y mas bolsos... bla bla')
|
'https://bot-whatsapp.netlify.app/docs/example/',
|
||||||
|
])
|
||||||
|
|
||||||
const flowZapatos2 = addKeyword(['zapatos2', '2'])
|
const flowGracias = addKeyword(['gracias', 'grac']).addAnswer([
|
||||||
.addAnswer('🤯 repito que tengo *MUCHOS* zapatos.')
|
'🚀 Puedes aportar tu granito de arena a este proyecto',
|
||||||
.addAnswer('y algunas otras cosas.')
|
'[*opencollective*] https://opencollective.com/bot-whatsapp',
|
||||||
|
'[*buymeacoffee*] https://www.buymeacoffee.com/leifermendez',
|
||||||
|
'[*patreon*] https://www.patreon.com/leifermendez',
|
||||||
|
])
|
||||||
|
|
||||||
const flowZapatos = addKeyword(['1', 'zapatos', 'ZAPATOS'])
|
const flowDiscord = addKeyword(['discord']).addAnswer([
|
||||||
.addAnswer('🤯 Veo que elegiste zapatos')
|
'🤪 Únete al discord',
|
||||||
.addAnswer('Tengo muchos zapatos...bla bla')
|
'https://link.codigoencasa.com/DISCORD',
|
||||||
.addAnswer(
|
])
|
||||||
['Manda:', '*(2) Zapatos2*', 'para mas información'],
|
|
||||||
{ capture: true },
|
|
||||||
(ctx) => {
|
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
|
||||||
console.log(ctx)
|
|
||||||
},
|
|
||||||
[flowZapatos2]
|
|
||||||
)
|
|
||||||
|
|
||||||
const flowBolsos = addKeyword(['2', 'bolsos', 'BOLSOS'])
|
|
||||||
.addAnswer('🙌 Veo que elegiste bolsos')
|
|
||||||
.addAnswer('Tengo muchos bolsos...bla bla')
|
|
||||||
.addAnswer(
|
|
||||||
['Manda:', '*(2) Bolsos2*', 'para mas información.'],
|
|
||||||
{ capture: true },
|
|
||||||
(ctx) => {
|
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
|
||||||
console.log(ctx)
|
|
||||||
},
|
|
||||||
[flowBolsos2]
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Declarando flujo principal
|
|
||||||
*/
|
|
||||||
|
|
||||||
const flowPrincipal = addKeyword(['hola', 'ole', 'alo'])
|
const flowPrincipal = addKeyword(['hola', 'ole', 'alo'])
|
||||||
.addAnswer(['Hola, bienvenido a mi tienda', '¿Como puedo ayudarte?'])
|
.addAnswer('🙌 Hola bienvenido a este *Chatbot*')
|
||||||
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc ...'])
|
|
||||||
.addAnswer(
|
.addAnswer(
|
||||||
['Para continuar escribe:', '*(1) Zapatos*', '*(2) Bolsos*'],
|
[
|
||||||
{ capture: true },
|
'te comparto los siguientes links de interes sobre el proyecto',
|
||||||
(ctx) => {
|
'👉 *doc* para ver la documentación',
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
'👉 *gracias* para ver la lista de videos',
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
'👉 *discord* unirte al discord',
|
||||||
console.log(ctx)
|
],
|
||||||
},
|
null,
|
||||||
[flowBolsos, flowZapatos]
|
null,
|
||||||
|
[flowDocs, flowGracias, flowTuto, flowDiscord]
|
||||||
)
|
)
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const adapterDB = new JsonFileAdapter()
|
const adapterDB = new JsonFileAdapter()
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
const adapterProvider = createProvider(BaileysProvider)
|
const adapterProvider = createProvider(BaileysProvider)
|
||||||
|
|
||||||
createBot({
|
createBot({
|
||||||
flow: adapterFlow,
|
flow: adapterFlow,
|
||||||
provider: adapterProvider,
|
provider: adapterProvider,
|
||||||
database: adapterDB,
|
database: adapterDB,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
QRPortalWeb()
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-bailey-json",
|
"name": "base-bailey-json",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
|
"@bot-whatsapp/portal": "latest",
|
||||||
"@adiwajshing/baileys": "4.4.0",
|
"@adiwajshing/baileys": "4.4.0",
|
||||||
"mime-types": "2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"wa-sticker-formatter": "4.3.2"
|
"wa-sticker-formatter": "4.3.2"
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link rel="preconnect" href="https://rsms.me/" />
|
|
||||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
|
||||||
<title>🤖 Crear chatbot WhatsApp en minutos</title>
|
|
||||||
<style>
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-self: center;
|
|
||||||
align-items: center;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div
|
|
||||||
style="
|
|
||||||
display: flex;
|
|
||||||
gap: 2rem;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
style="
|
|
||||||
box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
|
|
||||||
rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
object-fit: contain;
|
|
||||||
"
|
|
||||||
width="400"
|
|
||||||
height="400"
|
|
||||||
src="qr.png"
|
|
||||||
alt="Escanear QR"
|
|
||||||
/>
|
|
||||||
<div style="width: 400px; display: grid; gap: 1rem">
|
|
||||||
<h1 style="margin: 0">Whatsapp QR</h1>
|
|
||||||
<p>
|
|
||||||
<strong
|
|
||||||
>F5 para actualizar, el codigo se actualiza cada minuto. </strong
|
|
||||||
><br />
|
|
||||||
Con esta libreria, puedes configurar respuestas
|
|
||||||
automatizadas para preguntas frecuentes , recibir y
|
|
||||||
responder mensajes de manera automatizada, y hacer un
|
|
||||||
seguimiento de las interacciones con los clientes. Además,
|
|
||||||
nuestro Chatbot se integra fácilmente con otros sistemas y
|
|
||||||
herramientas que ya esté utilizando en su negocio.
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
style="
|
|
||||||
background: white;
|
|
||||||
box-shadow: rgb(0 0 0 / 16%) 0px 10px 36px 0px,
|
|
||||||
rgb(0 0 0 / 6%) 0px 0px 0px 1px;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #1a1a1a;
|
|
||||||
border: solid 1px #afafaf;
|
|
||||||
"
|
|
||||||
href="https://bot-whatsapp.netlify.app/"
|
|
||||||
>Ver documentación</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
const http = require('http')
|
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Levantar un HTTP Server
|
|
||||||
*/
|
|
||||||
http.createServer(function (req, res) {
|
|
||||||
var cssPath = undefined
|
|
||||||
var fileStream = undefined
|
|
||||||
var imagePath = undefined
|
|
||||||
|
|
||||||
if (req.url === '/') {
|
|
||||||
fs.readFile('./public/index.html', 'UTF-8', function (err, html) {
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/html' })
|
|
||||||
res.end(html)
|
|
||||||
})
|
|
||||||
} else if (req.url.match('.css$')) {
|
|
||||||
cssPath = path.join(__dirname, 'public', req.url)
|
|
||||||
fileStream = fs.createReadStream(cssPath, 'UTF-8')
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/css' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else if (req.url.match('.png$')) {
|
|
||||||
imagePath = path.join(__dirname, req.url)
|
|
||||||
fileStream = fs.createReadStream(imagePath)
|
|
||||||
res.writeHead(200, { 'Content-Type': 'image/png' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else {
|
|
||||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
|
||||||
res.end('No Page Found')
|
|
||||||
}
|
|
||||||
}).listen(PORT, () => console.log(`Escanear QR Code http://localhost:${PORT}`))
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
FROM node:lts-bullseye as bot
|
FROM node:18-bullseye as bot
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm i
|
RUN npm i
|
||||||
COPY . .
|
COPY . .
|
||||||
|
ARG RAILWAY_STATIC_URL
|
||||||
|
ARG PUBLIC_URL
|
||||||
ARG PORT
|
ARG PORT
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|||||||
@@ -5,26 +5,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
**Con esta librería, puedes construir flujos automatizados de conversación de manera agnóstica al proveedor de WhatsApp,** configurar respuestas automatizadas para preguntas frecuentes, recibir y responder mensajes de manera automatizada, y hacer un seguimiento de las interacciones con los clientes. Además, puedes configurar fácilmente disparadores que te ayudaran a expandir las funcionalidades sin límites. **[Ver más informacion](https://bot-whatsapp.netlify.app/)**
|
**Con esta librería, puedes construir flujos automatizados de conversación de manera agnóstica al proveedor de WhatsApp,** configurar respuestas automatizadas para preguntas frecuentes, recibir y responder mensajes de manera automatizada, y hacer un seguimiento de las interacciones con los clientes. Además, puedes configurar fácilmente disparadores que te ayudaran a expandir las funcionalidades sin límites. **[Ver documentación](https://bot-whatsapp.netlify.app/)**
|
||||||
|
|
||||||
```js
|
|
||||||
const main = async () => {
|
|
||||||
const adapterDB = new MockAdapter()
|
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
|
||||||
|
|
||||||
const adapterProvider = createProvider(BaileysProvider, {
|
|
||||||
accountSid: process.env.ACC_SID,
|
|
||||||
authToken: process.env.ACC_TOKEN,
|
|
||||||
vendorNumber: process.env.ACC_VENDOR,
|
|
||||||
})
|
|
||||||
|
|
||||||
createBot({
|
|
||||||
flow: adapterFlow,
|
|
||||||
provider: adapterProvider,
|
|
||||||
database: adapterDB,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
npm install
|
||||||
|
|||||||
@@ -5,86 +5,62 @@ const {
|
|||||||
addKeyword,
|
addKeyword,
|
||||||
} = require('@bot-whatsapp/bot')
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
require('./server.http')
|
const QRPortalWeb = require('@bot-whatsapp/portal')
|
||||||
|
|
||||||
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
||||||
const MockAdapter = require('@bot-whatsapp/database/mock')
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
/**
|
const flowDocs = addKeyword([
|
||||||
* Aqui declaramos los flujos hijos, los flujos se declaran de atras para adelante, es decir que si tienes un flujo de este tipo:
|
'doc',
|
||||||
*
|
'documentacion',
|
||||||
* Menu Principal
|
'documentación',
|
||||||
* - SubMenu 1
|
]).addAnswer([
|
||||||
* - Submenu 1.1
|
'📄 Aquí encontras las documentación recuerda que puedes mejorarla',
|
||||||
* - Submenu 2
|
'https://bot-whatsapp.netlify.app/',
|
||||||
* - Submenu 2.1
|
])
|
||||||
*
|
|
||||||
* Primero declaras los submenus 1.1 y 2.1, luego el 1 y 2 y al final el principal.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const flowBolsos2 = addKeyword(['bolsos2', '2'])
|
const flowTuto = addKeyword(['tutorial', 'tuto']).addAnswer([
|
||||||
.addAnswer('🤯 *MUCHOS* bolsos ...')
|
'🙌 Aquí encontras un ejemplo rapido',
|
||||||
.addAnswer('y mas bolsos... bla bla')
|
'https://bot-whatsapp.netlify.app/docs/example/',
|
||||||
|
])
|
||||||
|
|
||||||
const flowZapatos2 = addKeyword(['zapatos2', '2'])
|
const flowGracias = addKeyword(['gracias', 'grac']).addAnswer([
|
||||||
.addAnswer('🤯 repito que tengo *MUCHOS* zapatos.')
|
'🚀 Puedes aportar tu granito de arena a este proyecto',
|
||||||
.addAnswer('y algunas otras cosas.')
|
'[*opencollective*] https://opencollective.com/bot-whatsapp',
|
||||||
|
'[*buymeacoffee*] https://www.buymeacoffee.com/leifermendez',
|
||||||
|
'[*patreon*] https://www.patreon.com/leifermendez',
|
||||||
|
])
|
||||||
|
|
||||||
const flowZapatos = addKeyword(['1', 'zapatos', 'ZAPATOS'])
|
const flowDiscord = addKeyword(['discord']).addAnswer([
|
||||||
.addAnswer('🤯 Veo que elegiste zapatos')
|
'🤪 Únete al discord',
|
||||||
.addAnswer('Tengo muchos zapatos...bla bla')
|
'https://link.codigoencasa.com/DISCORD',
|
||||||
.addAnswer(
|
])
|
||||||
['Manda:', '*(2) Zapatos2*', 'para mas información'],
|
|
||||||
{ capture: true },
|
|
||||||
(ctx) => {
|
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
|
||||||
console.log(ctx)
|
|
||||||
},
|
|
||||||
[flowZapatos2]
|
|
||||||
)
|
|
||||||
|
|
||||||
const flowBolsos = addKeyword(['2', 'bolsos', 'BOLSOS'])
|
|
||||||
.addAnswer('🙌 Veo que elegiste bolsos')
|
|
||||||
.addAnswer('Tengo muchos bolsos...bla bla')
|
|
||||||
.addAnswer(
|
|
||||||
['Manda:', '*(2) Bolsos2*', 'para mas información.'],
|
|
||||||
{ capture: true },
|
|
||||||
(ctx) => {
|
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
|
||||||
console.log(ctx)
|
|
||||||
},
|
|
||||||
[flowBolsos2]
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Declarando flujo principal
|
|
||||||
*/
|
|
||||||
|
|
||||||
const flowPrincipal = addKeyword(['hola', 'ole', 'alo'])
|
const flowPrincipal = addKeyword(['hola', 'ole', 'alo'])
|
||||||
.addAnswer(['Hola, bienvenido a mi tienda', '¿Como puedo ayudarte?'])
|
.addAnswer('🙌 Hola bienvenido a este *Chatbot*')
|
||||||
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc ...'])
|
|
||||||
.addAnswer(
|
.addAnswer(
|
||||||
['Para continuar escribe:', '*(1) Zapatos*', '*(2) Bolsos*'],
|
[
|
||||||
{ capture: true },
|
'te comparto los siguientes links de interes sobre el proyecto',
|
||||||
(ctx) => {
|
'👉 *doc* para ver la documentación',
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
'👉 *gracias* para ver la lista de videos',
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
'👉 *discord* unirte al discord',
|
||||||
console.log(ctx)
|
],
|
||||||
},
|
null,
|
||||||
[flowBolsos, flowZapatos]
|
null,
|
||||||
|
[flowDocs, flowGracias, flowTuto, flowDiscord]
|
||||||
)
|
)
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const adapterDB = new MockAdapter()
|
const adapterDB = new MockAdapter()
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
const adapterProvider = createProvider(BaileysProvider)
|
const adapterProvider = createProvider(BaileysProvider)
|
||||||
|
|
||||||
createBot({
|
createBot({
|
||||||
flow: adapterFlow,
|
flow: adapterFlow,
|
||||||
provider: adapterProvider,
|
provider: adapterProvider,
|
||||||
database: adapterDB,
|
database: adapterDB,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
QRPortalWeb()
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-bailey-memory",
|
"name": "base-bailey-memory",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
|
"@bot-whatsapp/portal": "latest",
|
||||||
"@adiwajshing/baileys": "4.4.0",
|
"@adiwajshing/baileys": "4.4.0",
|
||||||
"mime-types": "2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"wa-sticker-formatter": "4.3.2"
|
"wa-sticker-formatter": "4.3.2"
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link rel="preconnect" href="https://rsms.me/" />
|
|
||||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
|
||||||
<title>🤖 Crear chatbot WhatsApp en minutos</title>
|
|
||||||
<style>
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-self: center;
|
|
||||||
align-items: center;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div
|
|
||||||
style="
|
|
||||||
display: flex;
|
|
||||||
gap: 2rem;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
style="
|
|
||||||
box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
|
|
||||||
rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
object-fit: contain;
|
|
||||||
"
|
|
||||||
width="400"
|
|
||||||
height="400"
|
|
||||||
src="qr.png"
|
|
||||||
alt="Escanear QR"
|
|
||||||
/>
|
|
||||||
<div style="width: 400px; display: grid; gap: 1rem">
|
|
||||||
<h1 style="margin: 0">Whatsapp QR</h1>
|
|
||||||
<p>
|
|
||||||
<strong
|
|
||||||
>F5 para actualizar, el codigo se actualiza cada minuto. </strong
|
|
||||||
><br />
|
|
||||||
Con esta libreria, puedes configurar respuestas
|
|
||||||
automatizadas para preguntas frecuentes , recibir y
|
|
||||||
responder mensajes de manera automatizada, y hacer un
|
|
||||||
seguimiento de las interacciones con los clientes. Además,
|
|
||||||
nuestro Chatbot se integra fácilmente con otros sistemas y
|
|
||||||
herramientas que ya esté utilizando en su negocio.
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
style="
|
|
||||||
background: white;
|
|
||||||
box-shadow: rgb(0 0 0 / 16%) 0px 10px 36px 0px,
|
|
||||||
rgb(0 0 0 / 6%) 0px 0px 0px 1px;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #1a1a1a;
|
|
||||||
border: solid 1px #afafaf;
|
|
||||||
"
|
|
||||||
href="https://bot-whatsapp.netlify.app/"
|
|
||||||
>Ver documentación</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
const http = require('http')
|
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Levantar un HTTP Server
|
|
||||||
*/
|
|
||||||
http.createServer(function (req, res) {
|
|
||||||
var cssPath = undefined
|
|
||||||
var fileStream = undefined
|
|
||||||
var imagePath = undefined
|
|
||||||
|
|
||||||
if (req.url === '/') {
|
|
||||||
fs.readFile('./public/index.html', 'UTF-8', function (err, html) {
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/html' })
|
|
||||||
res.end(html)
|
|
||||||
})
|
|
||||||
} else if (req.url.match('.css$')) {
|
|
||||||
cssPath = path.join(__dirname, 'public', req.url)
|
|
||||||
fileStream = fs.createReadStream(cssPath, 'UTF-8')
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/css' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else if (req.url.match('.png$')) {
|
|
||||||
imagePath = path.join(__dirname, req.url)
|
|
||||||
fileStream = fs.createReadStream(imagePath)
|
|
||||||
res.writeHead(200, { 'Content-Type': 'image/png' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else {
|
|
||||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
|
||||||
res.end('No Page Found')
|
|
||||||
}
|
|
||||||
}).listen(PORT, () => console.log(`Escanear QR Code http://localhost:${PORT}`))
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-bailey-mongo",
|
"name": "base-bailey-mongo",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link rel="preconnect" href="https://rsms.me/" />
|
|
||||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
|
||||||
<title>🤖 Crear chatbot WhatsApp en minutos</title>
|
|
||||||
<style>
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-self: center;
|
|
||||||
align-items: center;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div
|
|
||||||
style="
|
|
||||||
display: flex;
|
|
||||||
gap: 2rem;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
style="
|
|
||||||
box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
|
|
||||||
rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
object-fit: contain;
|
|
||||||
"
|
|
||||||
width="400"
|
|
||||||
height="400"
|
|
||||||
src="qr.png"
|
|
||||||
alt="Escanear QR"
|
|
||||||
/>
|
|
||||||
<div style="width: 400px; display: grid; gap: 1rem">
|
|
||||||
<h1 style="margin: 0">Whatsapp QR</h1>
|
|
||||||
<p>
|
|
||||||
<strong
|
|
||||||
>F5 para actualizar, el codigo se actualiza cada minuto. </strong
|
|
||||||
><br />
|
|
||||||
Con esta libreria, puedes configurar respuestas
|
|
||||||
automatizadas para preguntas frecuentes , recibir y
|
|
||||||
responder mensajes de manera automatizada, y hacer un
|
|
||||||
seguimiento de las interacciones con los clientes. Además,
|
|
||||||
nuestro Chatbot se integra fácilmente con otros sistemas y
|
|
||||||
herramientas que ya esté utilizando en su negocio.
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
style="
|
|
||||||
background: white;
|
|
||||||
box-shadow: rgb(0 0 0 / 16%) 0px 10px 36px 0px,
|
|
||||||
rgb(0 0 0 / 6%) 0px 0px 0px 1px;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #1a1a1a;
|
|
||||||
border: solid 1px #afafaf;
|
|
||||||
"
|
|
||||||
href="https://bot-whatsapp.netlify.app/"
|
|
||||||
>Ver documentación</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
const http = require('http')
|
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Levantar un HTTP Server
|
|
||||||
*/
|
|
||||||
http.createServer(function (req, res) {
|
|
||||||
var cssPath = undefined
|
|
||||||
var fileStream = undefined
|
|
||||||
var imagePath = undefined
|
|
||||||
|
|
||||||
if (req.url === '/') {
|
|
||||||
fs.readFile('./public/index.html', 'UTF-8', function (err, html) {
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/html' })
|
|
||||||
res.end(html)
|
|
||||||
})
|
|
||||||
} else if (req.url.match('.css$')) {
|
|
||||||
cssPath = path.join(__dirname, 'public', req.url)
|
|
||||||
fileStream = fs.createReadStream(cssPath, 'UTF-8')
|
|
||||||
res.writeHead(200, { 'Content-Type': 'text/css' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else if (req.url.match('.png$')) {
|
|
||||||
imagePath = path.join(__dirname, req.url)
|
|
||||||
fileStream = fs.createReadStream(imagePath)
|
|
||||||
res.writeHead(200, { 'Content-Type': 'image/png' })
|
|
||||||
fileStream.pipe(res)
|
|
||||||
} else {
|
|
||||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
|
||||||
res.end('No Page Found')
|
|
||||||
}
|
|
||||||
}).listen(PORT, () => console.log(`Escanear QR Code http://localhost:${PORT}`))
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-bailey-mysql",
|
"name": "base-bailey-mysql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-meta-json",
|
"name": "base-meta-json",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-meta-memory",
|
"name": "base-meta-memory",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-meta-mongo",
|
"name": "base-meta-mongo",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-meta-mysql",
|
"name": "base-meta-mysql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-twilio-json",
|
"name": "base-twilio-json",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-twilio-memory",
|
"name": "base-twilio-memory",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-twilio-mongo",
|
"name": "base-twilio-mongo",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-twilio-mysql",
|
"name": "base-twilio-mysql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-venom-json",
|
"name": "base-venom-json",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-venom-memory",
|
"name": "base-venom-memory",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-venom-mongo",
|
"name": "base-venom-mongo",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-venom-mysql",
|
"name": "base-venom-mysql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-wweb-json",
|
"name": "base-wweb-json",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-wweb-memory",
|
"name": "base-wweb-memory",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-wweb-mongo",
|
"name": "base-wweb-mongo",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-base-wweb-mysql",
|
"name": "base-wweb-mysql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
|
|||||||
@@ -1100,6 +1100,7 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@commitlint/cli": ^17.3.0
|
"@commitlint/cli": ^17.3.0
|
||||||
"@commitlint/config-conventional": ^17.3.0
|
"@commitlint/config-conventional": ^17.3.0
|
||||||
|
"@octokit/core": ^4.1.0
|
||||||
"@rollup/plugin-commonjs": ^23.0.2
|
"@rollup/plugin-commonjs": ^23.0.2
|
||||||
"@rollup/plugin-json": ^5.0.1
|
"@rollup/plugin-json": ^5.0.1
|
||||||
"@rollup/plugin-node-resolve": ^15.0.1
|
"@rollup/plugin-node-resolve": ^15.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user