fix: Update Dockerfile

This commit is contained in:
Davidson Gomes 2023-07-31 15:27:47 -03:00
parent 0dca009c01
commit 84366002db
5 changed files with 113 additions and 90 deletions

View File

@ -1,16 +1,17 @@
FROM node:16.18-alpine
LABEL version="1.1.3" description="Api to control whatsapp features through http requests."
LABEL version="1.5.0" description="Api to control whatsapp features through http requests."
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
LABEL contact="contato@agenciadgcode.com"
RUN apk update && apk upgrade && \
apk add --no-cache git
apk add --no-cache git tzdata ffmpeg wget curl
WORKDIR /evolution
COPY ./package.json .
ENV TZ=America/Sao_Paulo
ENV DOCKER_ENV=true
ENV SERVER_URL=http://localhost:8080
@ -50,7 +51,7 @@ ENV REDIS_ENABLED=false
ENV REDIS_URI=redis://redis:6379
ENV REDIS_PREFIX_KEY=evolution
ENV WEBHOOK_GLOBAL_URL=<url>
ENV WEBHOOK_GLOBAL_URL=
ENV WEBHOOK_GLOBAL_ENABLED=false
ENV WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
@ -105,4 +106,7 @@ COPY . .
RUN npm run build
HEALTHCHECK --interval=1m --retries=250 --start-period=2m \
CMD curl --fail http://$SERVER_URL/ || exit 1
CMD [ "node", "./dist/src/main.js" ]

View File

@ -7,7 +7,7 @@
"string": [
{
"name": "api_access_token",
"value": "CHATWOOT_USER_TOKEN"
"value": "CHATWOOT_ADMIN_USER_TOKEN"
},
{
"name": "chatwoot_url",
@ -16,6 +16,14 @@
{
"name": "n8n_url",
"value": "https://N8N_URL"
},
{
"name": "organization",
"value": "ORGANIZATION_NAME"
},
{
"name": "logo",
"value": "ORGANIZATION_LOGO"
}
]
},
@ -26,7 +34,7 @@
"type": "n8n-nodes-base.set",
"typeVersion": 2,
"position": [
1840,
1820,
880
]
},
@ -45,7 +53,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"EvolutionAPI\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"https://evolution-api.com/files/evolution-api-favicon.png\"\n}",
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"Bot {{ $('Info Base').item.json[\"organization\"] }}\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"{{ $('Info Base').item.json[\"logo\"] }}\"\n}",
"options": {}
},
"id": "61742c2d-d195-4a68-a2eb-a36839b6376a",
@ -53,7 +61,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2240,
2220,
880
]
},
@ -72,7 +80,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"name\": \"StartEvolution\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
"jsonBody": "={\n \"name\": \"Start {{ $('Info Base').item.json[\"organization\"] }}\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
"options": {}
},
"id": "866ddf42-2d5f-4bf2-8552-2379a5cdc2a5",
@ -80,7 +88,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2040,
2020,
880
]
},
@ -118,7 +126,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2440,
2420,
880
]
},
@ -137,7 +145,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"name\": \"Create Inbox EvolutionAPI\",\n \"description\": \"Create Inbox EvolutionAPI\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Info Base').item.json[\"api_access_token\"] }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n \n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n\n\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
"jsonBody": "={\n \"name\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"description\": \"Create Inbox EvolutionAPI\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Info Base').item.json[\"api_access_token\"] }}&organization={{ $('Info Base').item.json[\"organization\"] }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n \n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n\n\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
"options": {}
},
"id": "d89ed76c-a5e9-42e6-b55b-e779e9a33a53",
@ -145,14 +153,14 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2660,
2620,
880
]
},
{
"parameters": {
"content": "## Workflow Para Configurar admin\n**Aqui você prepara o Chatwoot Principal com um usuário (Superadmin) que poderá criar empresas e caixas de entrada**\n**Instruções**\n**No node Info Base, configure as variáveis de seu Chatwoot e N8N**\n**Obs: A variável api_access_token é o token do usuário que irá poder criar as empresas**",
"width": 1129.7777777777778
"width": 894.6435495898575
},
"id": "a4597492-843a-44c7-836a-f30c91d46a20",
"name": "Sticky Note",
@ -224,7 +232,7 @@
},
"active": false,
"settings": {},
"versionId": "4f0e166f-00fb-4ce6-989e-03c036351e35",
"versionId": "5275c59f-9230-4149-9107-e87c86759427",
"id": "HmHVbJIXCOd57rBU",
"meta": {
"instanceId": "4ff16e963c7f5197d7e99e6239192860914312fea0ce2a9a7fd14d74a0a0e906"

View File

@ -128,16 +128,16 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2380,
2360,
840
]
},
{
"parameters": {
"fromEmail": "contato@agenciadgcode.com",
"fromEmail": "={{ $('Info Base').item.json[\"from_email\"] }}",
"toEmail": "={{ $('LimpaDados').item.json.email }}",
"subject": "Bem vindo ao Chatwoot",
"text": "=Olá seja bem vindo:\n\nAbaixo segue seus dados de acesso iniciais:\n\nURL: {{ $('Info Base').item.json[\"chatwoot_url\"] }}\n\nLoging: {{ $('LimpaDados').item.json[\"email\"] }}\n\nSenha: {{ $('LimpaDados').item.json[\"password\"] }}",
"subject": "=Bem vindo à {{ $('Info Base').item.json[\"organization\"] }}",
"text": "=Olá seja bem vindo:\n\nAbaixo segue seus dados de acesso:\n\nURL: {{ $('Info Base').item.json[\"chatwoot_url\"] }}\n\nuser: {{ $('LimpaDados').item.json[\"email\"] }}\n\nSenha: {{ $('LimpaDados').item.json[\"password\"] }}",
"options": {}
},
"id": "2d0b3e35-6e51-4e9b-90b4-6382dc6fec88",
@ -145,7 +145,7 @@
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2,
"position": [
3180,
3160,
840
],
"credentials": {
@ -161,7 +161,7 @@
"string": [
{
"name": "api_access_token",
"value": "TOKEN PLATAFORM"
"value": "CHATWOOT_PLATFORM_TOKEN"
},
{
"name": "chatwoot_url",
@ -171,6 +171,18 @@
"name": "n8n_url",
"value": "https://N8N_URL"
},
{
"name": "organization",
"value": "ORGANIZATION_NAME"
},
{
"name": "logo",
"value": "ORGANIZATION_LOGO"
},
{
"name": "from_email",
"value": "FROM_EMAIL"
},
{
"name": "name",
"value": "={{ $json.name_company }}"
@ -249,7 +261,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"EvolutionAPI\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"https://evolution-api.com/files/evolution-api-favicon.png\"\n}",
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"Bot {{ $('Info Base').item.json[\"organization\"] }}\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"{{ $('Info Base').item.json[\"logo\"] }}\"\n}",
"options": {}
},
"id": "974e672e-fa4a-44ab-b6df-7aacd2bdb329",
@ -257,7 +269,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2800,
2760,
840
]
},
@ -276,7 +288,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"name\": \"Create Inbox EvolutionAPI\",\n \"description\": \"Create Inbox EvolutionAPI\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Cria Usuario').item.json.access_token }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
"jsonBody": "={\n \"name\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"description\": \"Create Inbox EvolutionAPI\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Cria Usuario').item.json.access_token }}&organization={{ $('Info Base').item.json[\"organization\"] }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
"options": {}
},
"id": "fb5597d4-0af1-461b-912b-7671a88c8368",
@ -284,7 +296,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
3000,
2960,
840
]
},
@ -303,7 +315,7 @@
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"name\": \"StartEvolution\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
"jsonBody": "={\n \"name\": \"Start {{ $('Info Base').item.json[\"organization\"] }}\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
"options": {}
},
"id": "a09bc90a-d643-422c-90ae-f8baa41ee532",
@ -311,7 +323,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
2600,
2560,
840
]
},
@ -435,7 +447,7 @@
},
"active": true,
"settings": {},
"versionId": "5638171c-d64e-404f-b0f1-c8fbe4ec6fb0",
"versionId": "98d3de5d-b1b2-4e13-b6e6-07fa827f54fd",
"id": "mVLlfZvGjtR8SZLT",
"meta": {
"instanceId": "4ff16e963c7f5197d7e99e6239192860914312fea0ce2a9a7fd14d74a0a0e906"

View File

@ -126,7 +126,7 @@
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1600,
1620,
300
]
},
@ -153,39 +153,6 @@
300
]
},
{
"parameters": {
"operation": "limit"
},
"id": "c498a51e-53c5-4f0e-9aaa-eb1ebc4fbcb5",
"name": "Recupera Primeira Inbox",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 2.2,
"position": [
1180,
300
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.payload[0].name }}",
"value2": "StartEvolution"
}
]
}
},
"id": "40f705df-b9ff-4645-94ec-e7a5a0ca4777",
"name": "é StartEvolution?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1380,
300
]
},
{
"parameters": {
"content": "## Workflow Para Criar Inbox\n**Aqui você configura a comunicação entre o chatwoot e a Evolution API para criar novas instâncias a partir do chatwoot**\n**Instruções**\n**No node Info Base, configure as variáveis de seu Chatwoot e Evolution API**",
@ -215,7 +182,11 @@
},
{
"name": "global_api_key",
"value": "GLOBAL_API_KEY"
"value": "EVOLUTION_GLOBAL_API_KEY"
},
{
"name": "organization",
"value": "={{ $json.query.organization }}"
},
{
"name": "instance_name",
@ -282,6 +253,39 @@
540,
300
]
},
{
"parameters": {
"operation": "limit"
},
"id": "9ed7331d-f2fd-4ee0-8730-2ae7f444aa1e",
"name": "Recupera Primeira Inbox",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 2.2,
"position": [
1200,
300
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.payload[0].name }}",
"value2": "=Start {{ $('Info Base').item.json[\"organization\"] }}"
}
]
}
},
"id": "40f705df-b9ff-4645-94ec-e7a5a0ca4777",
"name": "é Start Inbox?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1400,
300
]
}
],
"pinData": {},
@ -308,28 +312,6 @@
]
]
},
"Recupera Primeira Inbox": {
"main": [
[
{
"node": "é StartEvolution?",
"type": "main",
"index": 0
}
]
]
},
"é StartEvolution?": {
"main": [
[
{
"node": "Deleta Inbox Start",
"type": "main",
"index": 0
}
]
]
},
"Cria Instancia": {
"main": [
[
@ -351,11 +333,33 @@
}
]
]
},
"Recupera Primeira Inbox": {
"main": [
[
{
"node": "é Start Inbox?",
"type": "main",
"index": 0
}
]
]
},
"é Start Inbox?": {
"main": [
[
{
"node": "Deleta Inbox Start",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {},
"versionId": "ee6fcc3a-3815-4f9b-9a6b-e282c66fc37b",
"versionId": "6fcdaf0a-5bf9-4c3a-b518-364246bd92c2",
"id": "ByW2ccjR4XPrOyio",
"meta": {
"instanceId": "4ff16e963c7f5197d7e99e6239192860914312fea0ce2a9a7fd14d74a0a0e906"

View File

@ -5,11 +5,6 @@
<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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" 'unsafe-inline' crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<link rel="shortcut icon" href="/images/atendai-logo.png" type="image/x-icon">
<title>Instance Manager</title>
</head>