Skip to content

Commit

Permalink
More on evolution
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanogueira committed Mar 8, 2024
1 parent 0582645 commit 0641525
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .envs/.local/.chatwoot
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REDIS_URL=redis://redis_chatwoot:6379
# If you are using docker-compose, set this variable's value to be any string,
# which will be the password for the redis service running inside the docker-compose
# to make it secure
REDIS_PASSWORD=pgpwd
#REDIS_PASSWORD=pgpwd
# Redis Sentinel can be used by passing list of sentinel host and ports e,g. sentinel_host1:port1,sentinel_host2:port2
REDIS_SENTINELS=
# Redis sentinel master name is required when using sentinel, default value is "mymaster".
Expand Down
5 changes: 3 additions & 2 deletions chatwoot-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ services:
volumes:
- postgres_storage:/var/lib/postgresql/data
environment:
- POSTGRES_DB=chatwoot
- POSTGRES_DB=chatwoot_production
- POSTGRES_USER=postgres
# Please provide your own password.
- POSTGRES_PASSWORD=pgpwd

redis_chatwoot:
image: redis:alpine
restart: always
command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
#command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
command: ["sh", "-c", "redis-server"]
env_file: ./.envs/.local/.chatwoot
volumes:
- redis_storage:/data
Expand Down
2 changes: 1 addition & 1 deletion local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ services:
- local_evolution_instances:/evolution/instances
- local_evolution_store:/evolution/store
env_file:
- ./compose/local/evolution/.env
- ./compose/local/evolution/env
command: ['node', './dist/src/main.js']

apache:
Expand Down
26 changes: 26 additions & 0 deletions rocket_connect/instance/management/commands/dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,32 @@ def handle_django(self):
else:
print("CONNECTOR UPDATED: ", connector)


#
# create default evolution connector
#

connector, connector_created = server.connectors.get_or_create(
external_token="ROCKETCHAT_EVOLUTION_EXTERNAL_TOKEN"
)
connector.config = {
"webhook": "http://django.local:8000/connector/ROCKETCHAT_EVOLUTION_EXTERNAL_TOKEN/",
"endpoint": "http://evolution:8080",
"secret_key": "B6D711FCDE4D4FD5936544120E713976",
"instance_name": "rocketchat_evolution_test",
"include_connector_status": True,
"enable_ack_receipt": True,
"outcome_attachment_description_as_new_message": True,
}
connector.name = "EVOLUTION"
connector.connector_type = "evolution"
connector.save()
if connector_created:
print("CONNECTOR CREATED: ", connector)
else:
print("CONNECTOR UPDATED: ", connector)


#
# create default codechat connector
#
Expand Down
14 changes: 3 additions & 11 deletions rocket_connect/plugins/evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,13 @@ def initialize(self):
'MESSAGES_UPDATE',
'MESSAGES_DELETE',
'SEND_MESSAGE',
'CONTACTS_SET',
'CONTACTS_UPSERT',
'CONTACTS_UPDATE',
'PRESENCE_UPDATE',
'CHATS_SET',
'CHATS_UPSERT',
'CHATS_UPDATE',
'CHATS_DELETE',
'GROUPS_UPSERT',
'GROUP_UPDATE',
'GROUP_PARTICIPANTS_UPDATE',
'CONNECTION_UPDATE',
'CALL',
'NEW_JWT_TOKEN'],
'url': 'http://django.local:8000/connector/ROCKETCHAT_CODECHAT_EXTERNAL_TOKEN',
'url': webhook_url,
'webhook_base64': True}
connect_instance_response = requests.request(
"POST", endpoint_webhook_set, json=payload, headers=headers
Expand Down Expand Up @@ -452,10 +444,10 @@ def get_incoming_visitor_id(self):

class ConnectorConfigForm(BaseConnectorConfigForm):
webhook = forms.CharField(
help_text="Where WPPConnect will send the events", required=True, initial=""
help_text="Where Evolution will send the events", required=True, initial=""
)
endpoint = forms.CharField(
help_text="Where your WPPConnect is installed",
help_text="Where your Evolution is installed",
required=True,
initial="http://codechat:8083",
)
Expand Down
2 changes: 1 addition & 1 deletion rocketchat-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
mode: host

mongodb:
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-5.0}
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-4.4}
restart: on-failure
volumes:
- local_rocket_mongodb_data:/bitnami/mongodb
Expand Down

0 comments on commit 0641525

Please sign in to comment.