codechat/api
API for communication with whatsapp.
10K+
Maintained by:
Where to get help:
Where to file issues:
This code is an implementation of Baileys, as a stable and scalable RestFull Api service, which controls whatsapp functions.
With this you can create multiservice chats, service bots or any other system that uses whatsapp. With this code you don't need to know javascript for nodejs, just start the server and make the language requests you feel most comfortable with.
All environment variables have the value described in this document as default.
Enviroment | type | Required | Default value |
---|---|---|---|
SERVER_PORT | int | ✅ | 8084 |
SESSION_HTTP_SECRET | string | ✅ | "************" |
Enviroment | type | Required | Default value |
---|---|---|---|
LOG_LEVEL | string | 🚫 | ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK |
LOG_COLOR | boolen | 🚫 | true |
Determine how long the instance should be deleted from memory in case of no connection.
Default time: 5 minutes.
If you don't even want an expiration, enter the value false
.
Enviroment | type | Required | Default value |
---|---|---|---|
INSTANCE_EXPIRATION_TIME | int or boolean | 🚫 | 5 |
Define a global webhook that will listen for enabled events from all instances.
Enviroment | type | Required | Default value |
---|---|---|---|
WEBHOOK_GLOBAL_URL | string | 🚫 | "" |
WEBHOOK_GLOBAL_ENABLED | boolen | 🚫 | false |
Current compatibility is with postgres only.
Enviroment | type | Required | Default value |
---|---|---|---|
DATABASE_URL | string | ✅ | "" |
DATABASE_SYNC_MESSAGES | boolean | 🚫 | true |
DATABASE_SAVE_DATA_NEW_MESSAGE | boolean | 🚫 | true |
DATABASE_SAVE_MESSAGE_UPDATE | boolean | 🚫 | true |
DATABASE_SAVE_DATA_CONTACTS | boolean | 🚫 | true |
DATABASE_SAVE_DATA_CHATS | boolean | 🚫 | true |
DATABASE_SAVE_LOGS | boolean | 🚫 | true |
Whatsapp connection data can be saved in redis.
Enviroment | type | Required | Default value |
---|---|---|---|
REDIS_ENABLED | boolean | 🚫 | false |
DATABASE_SYNC_MESSAGES | boolean | 🚫 | true |
DATABASE_SAVE_DATA_NEW_MESSAGE | boolean | 🚫 | true |
DATABASE_SAVE_MESSAGE_UPDATE | boolean | 🚫 | true |
Name that will be displayed on smartphone connection
Enviroment | type | Required | Default value |
---|---|---|---|
CONFIG_SESSION_PHONE_CLIENT | string | 🚫 | "CodeChat_V1" |
CONFIG_SESSION_PHONE_NAME | boolean | 🚫 | "Edge" |
Enviroment | type | Required | Default value |
---|---|---|---|
QRCODE_LIMIT | int | 🚫 | 5 seconds |
QRCODE_EXPIRATION_TIME | int | 🚫 | 20 seconds |
Enviroment | type | Required | Default value |
---|---|---|---|
CONNECTION_TIMEOUT | int | 🚫 | 120 seconds |
Defines an authentication type for the api
Define a global apikey to access all instances.
OBS: This key must be inserted in the request header to create an instance.
Enviroment | type | Required | Default value |
---|---|---|---|
AUTHENTICATION_GLOBAL_AUTH_TOKEN | string | ✅ | "************" |
Enviroment | type | Required | Default value |
---|---|---|---|
AUTHENTICATION_JWT_EXPIRES_IN | int | ✅ | 0 |
AUTHENTICATION_JWT_SECRET | string | ✅ | "************" |
Enviroment | type | Required | Default value |
---|---|---|---|
S3_ENABLED | boolena | 🚫 | false |
S3_ACCESS_KEY | string | 🚫 | "************" |
S3_SECRET_KEY | string | 🚫 | "************" |
S3_BUCKET | string | 🚫 | "bucket_name" |
S3_PORT | string | 🚫 | 9000 |
S3_ENDPOINT | string | 🚫 | "127.0.01" |
S3_USE_SSL | string | 🚫 | false |
docker run -d --restart 'always' \
--name 'api-codechat' \
--mount 'type=bind,source=/data/instances,target=/codechat/instances' \
--publish '8083:8083' \
--hostname 'codechat' \
--env-file './env' \
--network 'codechat-net' \
codechat/api:latest
version: '3.8'
networks:
public-network:
driver: bridge
services:
api:
container_name: codechat_api
image: codechat/api:latest
restart: unless-stopped
ports:
- 8084:8084
volumes:
- instances_connecteds:/codechat/instances
environment:
- SERVER_PORT=8084
- SESSION_SECRET=W0NvZGVDaGF0XTpbU2Vzc
- LOG_LEVEL=ERROR|WARN|INFO|DEBUG|LOG|VERBOSE|DARK
- LOG_COLOR=true
- DATABASE_ENABLED=true
- DATABASE_URL=postgres://[USER]:[PASS]@[HOST]:[PORT]/[DATABASE_NAME]?schema=public
- DATABASE_SYNC_MESSAGES=true
- DATABASE_SAVE_DATA_NEW_MESSAGE=true
- DATABASE_SAVE_MESSAGE_UPDATE=true
- DATABASE_SAVE_DATA_CONTACTS=true
- DATABASE_SAVE_DATA_CHATS=true
- GLOBAL_WEBHOOK_URL=url
- GLOBAL_WEBHOOK_ENABLED=false
- INSTANCE_EXPIRATION_TIME=false
- CONFIG_SESSION_PHONE_CLIENT=CodeChat_V1
- CONFIG_SESSION_PHONE_NAME=Edge
- QRCODE_LIMIT=10
- QRCODE_EXPIRATION_TIME=60
- CONNECTION_TIMEOUT=300
- AUTHENTICATION_GLOBAL_AUTH_TOKEN=zYzP7ocstxh3SJ23D4FZTCu4ehnM8v4hu
- AUTHENTICATION_JWT_EXPIRES_IN=0
- AUTHENTICATION_JWT_SECRET=3RFYiiRmvNiokSBrLZzx
# - REDIS_ENABLED=false
# - REDIS_URI=redis://[HOST]/5
# - REDIS_PREFIX=codechat
# - S3_ENABLED=false
# - S3_ACCESS_KEY=[ACCESS_KEY]
# - S3_SECRET_KEY=[SECRET_KEY]
# - S3_BUCKET=[BUCKET]
# - S3_PORT=9000
# - S3_ENDPOINT=[ENDPOINT]
# - S3_USE_SSL=false
networks:
- public-network
# redis_cache:
# image: redis:latest
# container_name: redis_cache
# volumes:
# - redis_data:/data
# ports:
# - "6379:6379"
# networks:
# - public_network
volumes:
instances_connecteds:
driver: local
# redis_data:
# driver: local
By CodeChat ©
docker pull codechat/api